# HG changeset patch # User Chong Yidong # Date 1132458240 0 # Node ID 9dbc51935e019fd9ec52e383c428f312d7952bac # Parent 572ca24101c29e39699f4c347fc5d6b8ee7b6989 (longlines-mode): Add a message-setup-hook. (longlines-decode-buffer): New function. diff -r 572ca24101c2 -r 9dbc51935e01 lisp/ChangeLog --- a/lisp/ChangeLog Sun Nov 20 03:31:11 2005 +0000 +++ b/lisp/ChangeLog Sun Nov 20 03:44:00 2005 +0000 @@ -3,6 +3,8 @@ * longlines.el (longlines-before-revert-hook) (longlines-after-revert-hook): New functions. (longlines-mode): Turn off longlines temporarily when reverting. + Add a message-setup-hook. + (longlines-decode-buffer): New function. 2005-11-19 Andreas Schwab diff -r 572ca24101c2 -r 9dbc51935e01 lisp/longlines.el --- a/lisp/longlines.el Sun Nov 20 03:31:11 2005 +0000 +++ b/lisp/longlines.el Sun Nov 20 03:44:00 2005 +0000 @@ -127,7 +127,7 @@ ;; longlines-wrap-lines that we'll never encounter from here (save-restriction (widen) - (longlines-decode-region (point-min) (point-max))) + (longlines-decode-buffer)) (longlines-wrap-region (point-min) (point-max)) (set-buffer-modified-p mod)) (when (and longlines-show-hard-newlines @@ -140,6 +140,7 @@ (add-hook 'mail-citation-hook 'mail-indent-citation nil t)) (add-hook 'mail-citation-hook 'longlines-decode-region nil t)) ((eq major-mode 'message-mode) + (add-hook 'message-setup-hook 'longlines-decode-buffer nil t) (make-local-variable 'message-indent-citation-function) (if (not (listp message-indent-citation-function)) (setq message-indent-citation-function @@ -325,6 +326,10 @@ (set-hard-newline-properties (match-beginning 0) (match-end 0))))) +(defun longlines-decode-buffer () + "Turn all newlines in the buffer into hard newlines." + (longlines-decode-region (point-min) (point-max))) + (defun longlines-encode-region (beg end &optional buffer) "Replace each soft newline between BEG and END with exactly one space. Hard newlines are left intact. The optional argument BUFFER exists for