aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-06-01 23:19:49 +0000
committerRichard M. Stallman1993-06-01 23:19:49 +0000
commit1c24b04ae54c4df1028a45445d8feecbfa8e499b (patch)
treec8405722520819077d566ebf0f4af6b80d5fec9d
parentacfb884cec67140e122bcfdf8ff0cc44dde707b6 (diff)
downloademacs-1c24b04ae54c4df1028a45445d8feecbfa8e499b.tar.gz
emacs-1c24b04ae54c4df1028a45445d8feecbfa8e499b.zip
(mail-signature): Do not insert a line with `--'.
(mail-yank-hooks): New hook variable. (mail-yank-original): Run the hook. (mail-indent-citation): New function.
-rw-r--r--lisp/mail/sendmail.el42
1 files changed, 32 insertions, 10 deletions
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 9597b9269b6..cdf2ba2da32 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -76,6 +76,16 @@ The alias definitions in `~/.mailrc' have this form:
76(defvar mail-yank-prefix nil 76(defvar mail-yank-prefix nil
77 "*Prefix insert on lines of yanked message being replied to. 77 "*Prefix insert on lines of yanked message being replied to.
78nil means use indentation.") 78nil means use indentation.")
79(defvar mail-indentation-spaces 3
80 "*Number of spaces to insert at the beginning of each cited line.
81Used by `mail-yank-original' via `mail-yank-cite'.")
82(defvar mail-yank-hooks '(mail-indent-citation)
83 "*Hook for modifying a citation just inserted in the mail buffer.
84Each hook function can find the citation between (point) and (mark t).
85And each hook function should leave point and mark around the citation
86text as modified.
87
88This is a normal hook, currently misnamed for historical reasons.")
79 89
80(defvar mail-abbrevs-loaded nil) 90(defvar mail-abbrevs-loaded nil)
81(defvar mail-mode-map nil) 91(defvar mail-mode-map nil)
@@ -538,7 +548,7 @@ the user from the mailer."
538 (end-of-line) 548 (end-of-line)
539 (or atpoint 549 (or atpoint
540 (delete-region (point) (point-max))) 550 (delete-region (point) (point-max)))
541 (insert "\n\n--\n") 551 (insert "\n\n")
542 (insert-file-contents (expand-file-name "~/.signature")))) 552 (insert-file-contents (expand-file-name "~/.signature"))))
543 553
544(defun mail-fill-yanked-message (&optional justifyp) 554(defun mail-fill-yanked-message (&optional justifyp)
@@ -553,6 +563,23 @@ Numeric argument means justify as well."
553 justifyp 563 justifyp
554 t))) 564 t)))
555 565
566(defun mail-indent-citation ()
567 "Modify text just inserted from a message to be cited.
568The inserted text should be the region.
569When this function returns, the region is again around the modified text.
570
571Normally, indent each nonblank line `mail-indentation-spaces' spaces.
572However, if `mail-yank-prefix' is non-nil, insert that prefix on each line."
573 (let ((start (point)))
574 (mail-yank-clear-headers start (mark t))
575 (if (null mail-yank-prefix)
576 (indent-rigidly start (mark t) mail-indentation-spaces)
577 (save-excursion
578 (goto-char start)
579 (while (< (point) (mark t))
580 (insert mail-yank-prefix)
581 (forward-line 1))))))
582
556(defun mail-yank-original (arg) 583(defun mail-yank-original (arg)
557 "Insert the message being replied to, if any (in rmail). 584 "Insert the message being replied to, if any (in rmail).
558Puts point before the text and mark after. 585Puts point before the text and mark after.
@@ -568,15 +595,10 @@ and don't delete any header fields."
568 (insert-buffer mail-reply-buffer) 595 (insert-buffer mail-reply-buffer)
569 (if (consp arg) 596 (if (consp arg)
570 nil 597 nil
571 (mail-yank-clear-headers start (mark t)) 598 (goto-char start)
572 (if (null mail-yank-prefix) 599 (let ((mail-indentation-spaces (if arg (prefix-numeric-value arg)
573 (indent-rigidly start (mark t) 600 mail-indentation-spaces)))
574 (if arg (prefix-numeric-value arg) 3)) 601 (run-hooks 'mail-yank-hooks)))
575 (save-excursion
576 (goto-char start)
577 (while (< (point) (mark t))
578 (insert mail-yank-prefix)
579 (forward-line 1)))))
580 ;; This is like exchange-point-and-mark, but doesn't activate the mark. 602 ;; This is like exchange-point-and-mark, but doesn't activate the mark.
581 ;; It is cleaner to avoid activation, even though the command 603 ;; It is cleaner to avoid activation, even though the command
582 ;; loop would deactivate the mark because we inserted text. 604 ;; loop would deactivate the mark because we inserted text.