summaryrefslogtreecommitdiff
path: root/lisp/longlines.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2005-11-20 03:44:00 +0000
committerChong Yidong <cyd@stupidchicken.com>2005-11-20 03:44:00 +0000
commit2c127d45eaef9bd74ce423cc45798608d89ad48f (patch)
tree8ef8dd6e5f416267c8d0bc9a5327e271b1a4f008 /lisp/longlines.el
parentf129a4dfe3ec1402c9b0634afd9d7b6baf247bce (diff)
downloademacs-2c127d45eaef9bd74ce423cc45798608d89ad48f.tar.gz
(longlines-mode): Add a message-setup-hook.
(longlines-decode-buffer): New function.
Diffstat (limited to 'lisp/longlines.el')
-rw-r--r--lisp/longlines.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/longlines.el b/lisp/longlines.el
index 296b10cd652..85358207a2b 100644
--- a/lisp/longlines.el
+++ b/lisp/longlines.el
@@ -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