]> git.eshelyaron.com Git - emacs.git/commitdiff
(longlines-mode): Add a message-setup-hook.
authorChong Yidong <cyd@stupidchicken.com>
Sun, 20 Nov 2005 03:44:00 +0000 (03:44 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sun, 20 Nov 2005 03:44:00 +0000 (03:44 +0000)
(longlines-decode-buffer): New function.

lisp/ChangeLog
lisp/longlines.el

index 28108231a61303f9a798e203a606dbcbb094ec1c..57d6d885534718a7c4d6b0058c350167b66b99d4 100644 (file)
@@ -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  <schwab@suse.de>
 
index 296b10cd6526261ee4a74637e878e8d89e017de5..85358207a2beae79911c1d10f56af35ca89de1b8 100644 (file)
@@ -127,7 +127,7 @@ are indicated with a symbol."
           ;; 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 @@ are indicated with a symbol."
                   (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 @@ If BEG and END are nil, the point and mark are used."
       (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