(message-elide-ellipsis): Document the format specs in the ellipsis.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Tue, 15 Mar 2011 19:37:01 +0000 (20:37 +0100)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Tue, 15 Mar 2011 19:37:01 +0000 (20:37 +0100)
lisp/ChangeLog
lisp/message.el

index 398086d..0e5895a 100644 (file)
@@ -1,3 +1,13 @@
+2011-03-15  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * message.el (message-elide-ellipsis): Document the format specs in the
+       ellipsis.
+
+2011-03-15  Reiner Steib  <Reiner.Steib@gmx.de>
+
+       * message.el (message-elide-region): Allow the ellipsis to say how many
+       lines were removed.
+
 2011-03-15  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus-win.el (gnus-configure-frame): Protect against trying to restore
 2011-03-15  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus-win.el (gnus-configure-frame): Protect against trying to restore
index c939303..198c5d8 100644 (file)
@@ -49,6 +49,7 @@
 (require 'mail-parse)
 (require 'mml)
 (require 'rfc822)
 (require 'mail-parse)
 (require 'mml)
 (require 'rfc822)
+(require 'format-spec)
 
 (autoload 'mailclient-send-it "mailclient") ;; Emacs 22 or contrib/
 
 
 (autoload 'mailclient-send-it "mailclient") ;; Emacs 22 or contrib/
 
@@ -442,7 +443,10 @@ whitespace)."
   :group 'message-various)
 
 (defcustom message-elide-ellipsis "\n[...]\n\n"
   :group 'message-various)
 
 (defcustom message-elide-ellipsis "\n[...]\n\n"
-  "*The string which is inserted for elided text."
+  "*The string which is inserted for elided text.
+This is a format-spec string, and you can use %l to say how many
+lines were removed, and %c to say how many characters were
+removed."
   :type 'string
   :link '(custom-manual "(message)Various Commands")
   :group 'message-various)
   :type 'string
   :link '(custom-manual "(message)Various Commands")
   :group 'message-various)
@@ -3579,8 +3583,12 @@ Note that this should not be used in newsgroups."
 An ellipsis (from `message-elide-ellipsis') will be inserted where the
 text was killed."
   (interactive "r")
 An ellipsis (from `message-elide-ellipsis') will be inserted where the
 text was killed."
   (interactive "r")
-  (kill-region b e)
-  (insert message-elide-ellipsis))
+  (let ((lines (count-lines b e))
+        (chars (- e b)))
+    (kill-region b e)
+    (insert (format-spec message-elide-ellipsis
+                         `((?l . ,lines)
+                           (?c . ,chars))))))
 
 (defvar message-caesar-translation-table nil)
 
 
 (defvar message-caesar-translation-table nil)