Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy-pasting don't get hard-lines #3

Open
DamienCassou opened this issue Feb 22, 2017 · 1 comment
Open

Copy-pasting don't get hard-lines #3

DamienCassou opened this issue Feb 22, 2017 · 1 comment

Comments

@DamienCassou
Copy link
Contributor

When copy-pasting paragraphs, you won't get any hard newlines. This means all paragraphs will be merged. Even though not strictly the responsibility of this package, I would suggest adding a command that adds hard linebreaks at the end of paragraphs.

@abstern
Copy link

abstern commented Jun 22, 2021

I, too, stumbled on this problem. For now, I've bound M-S-q to the following function, to easily fix such paragraphs 'manually':

(defun use-hard-newlines-guess (&optional beg end &rest _ignore)
  "Intuit hard newlines: mark as hard any newlines in region
  that precede a paragraph-start line."
  (interactive "r")
  (save-restriction
    (when (and beg end)
      (narrow-to-region beg end))
    ;; re-enable the use-hard-newlines minor mode, requesting to guess
    ;; which newlines should be marked as hard
    (use-hard-newlines -1 'guess)
    (use-hard-newlines 1 'guess)
    (messages-are-flowing--mark-hard-newlines (point-min) (point-max))))

The &rest _ignore is to support being added to the 'after-change-functions hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants