summaryrefslogtreecommitdiff
path: root/lisp/longlines.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2005-11-18 19:40:35 +0000
committerChong Yidong <cyd@stupidchicken.com>2005-11-18 19:40:35 +0000
commit0f157ad54951893cb525dd3753ff7b6c3a72e74a (patch)
tree6c6436927701f5909898e679c73646d3d31985e7 /lisp/longlines.el
parent0d876a1479852af55fe83901c1381883a4cf89ea (diff)
downloademacs-0f157ad54951893cb525dd3753ff7b6c3a72e74a.tar.gz
Add hacks for citation in mail-mode and message-mode.
Diffstat (limited to 'lisp/longlines.el')
-rw-r--r--lisp/longlines.el23
1 files changed, 20 insertions, 3 deletions
diff --git a/lisp/longlines.el b/lisp/longlines.el
index 4ee85d646e5..ec912c5c880 100644
--- a/lisp/longlines.el
+++ b/lisp/longlines.el
@@ -137,7 +137,21 @@ are indicated with a symbol."
(add-hook 'after-change-functions
'longlines-after-change-function nil t)
(add-hook 'post-command-hook
- 'longlines-post-command-function nil t)))
+ 'longlines-post-command-function nil t))
+
+ ;; Hacks to make longlines play nice with various modes.
+ (cond ((eq major-mode 'mail-mode)
+ (or mail-citation-hook
+ (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)
+ (make-local-variable 'message-indent-citation-function)
+ (if (not (listp message-indent-citation-function))
+ (setq message-indent-citation-function
+ (list message-indent-citation-function)))
+ (add-to-list 'message-indent-citation-function
+ 'longlines-decode-region t)))
+ )
;; Turn off longlines mode
(setq buffer-file-format (delete 'longlines buffer-file-format))
(if longlines-showing
@@ -298,8 +312,11 @@ Otherwise, return nil. Text cannot be moved across hard newlines."
(1+ (current-column)))
space))))))
-(defun longlines-decode-region (beg end)
- "Turn all newlines between BEG and END into hard newlines."
+(defun longlines-decode-region (&optional beg end)
+ "Turn all newlines between BEG and END into hard newlines.
+If BEG and END are nil, the point and mark are used."
+ (if (null beg) (setq beg (point)))
+ (if (null end) (setq end (mark t)))
(save-excursion
(goto-char (min beg end))
(while (search-forward "\n" (max beg end) t)