With use-hard-newlines, M-q reformat the paragraph as a single line

This commit is contained in:
Christophe Troestler 2016-05-07 02:41:04 +02:00
parent b6a1e1cef8
commit d2ae534ad8
1 changed files with 14 additions and 0 deletions

View File

@ -324,8 +324,22 @@ message-thread by removing the In-Reply-To header."
(define-key map (kbd "C-S-u") 'mu4e-update-mail-and-index)
(define-key map (kbd "C-c C-u") 'mu4e-update-mail-and-index)
(define-key map (kbd "C-c C-k") 'mu4e-message-kill-buffer)
(define-key map (kbd "M-q") 'mu4e-fill-paragraph)
map)))
(defun mu4e-fill-paragraph (&optional region)
"If `use-hard-newlines', takes a multi-line paragraph and makes
it into a single line of text. Assume paragraphs are separated
by blank lines. If `use-hard-newlines' is not enabled, this
simply executes `fill-paragraph'."
;; Inspired by https://www.emacswiki.org/emacs/UnfillParagraph
(interactive (progn (barf-if-buffer-read-only) '(t)))
(if use-hard-newlines
(let ((fill-column (point-max))
(use-hard-newlines nil)); rfill "across" hard newlines
(fill-paragraph nil region))
(fill-paragraph nil region)))
(define-key-after
(lookup-key text-mode-map [menu-bar text])
[mu4e-hard-newlines]