(message-kill-to-signature): Allow prefix arg to
authorKai Grossjohann <kgrossjo@eu.uu.net>
Wed, 14 Jan 2004 14:30:43 +0000 (14:30 +0000)
committerKai Grossjohann <kgrossjo@eu.uu.net>
Wed, 14 Jan 2004 14:30:43 +0000 (14:30 +0000)
specify number of lines to keep before signature.  From Vasily
Korytov.

lisp/ChangeLog
lisp/message.el

index 46b3135..2350fda 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-14  Kai Grossjohann  <kai@emptydomain.de>
+
+       * message.el (message-kill-to-signature): Allow prefix arg to
+       specify number of lines to keep before signature.  From Vasily
+       Korytov.
+
 2004-01-14  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * canlock.el: Always require sha1-el.
index 4d0837d..50520a4 100644 (file)
@@ -2761,16 +2761,23 @@ or in the synonym headers, defined by `message-header-synonyms'."
   (when (message-goto-signature)
     (forward-line -2)))
 
-(defun message-kill-to-signature ()
-  "Deletes all text up to the signature."
-  (interactive)
-  (let ((point (point)))
-    (message-goto-signature)
-    (unless (eobp)
-      (end-of-line -1))
-    (kill-region point (point))
-    (unless (bolp)
-      (insert "\n"))))
+(defun message-kill-to-signature (&optional arg)
+  "Deletes all text up to the signature. If a numberic argument or
+prefix arg is out there, leave that number of lines before the
+signature intact."
+  (interactive "p")
+  (save-excursion
+    (save-restriction
+      (let ((point (point)))
+       (narrow-to-region point (point-max))
+       (message-goto-signature)
+       (unless (eobp)
+         (if (and arg (numberp arg))
+             (forward-line (- -1 arg))
+           (end-of-line -1)))
+       (unless (= point (point))
+         (kill-region point (point))
+         (insert "\n"))))))
 
 (defun message-newline-and-reformat (&optional arg not-break)
   "Insert four newlines, and then reformat if inside quoted text.