message: Allow message-default-headers to be a function
authorJulien Danjou <julien@danjou.info>
Thu, 21 Oct 2010 13:12:09 +0000 (15:12 +0200)
committerJulien Danjou <julien@danjou.info>
Thu, 21 Oct 2010 13:15:54 +0000 (15:15 +0200)
Signed-off-by: Julien Danjou <julien@danjou.info>
lisp/ChangeLog
lisp/message.el
texi/ChangeLog
texi/message.texi
todo

index a20f66a..a02a994 100644 (file)
@@ -1,3 +1,8 @@
+2010-10-21  Julien Danjou  <julien@danjou.info>
+
+       * message.el (message-setup-1): Allow message-default-headers to be a
+       function.
+
 2010-10-21  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * shr.el (shr-tag-table): Simplify.
 2010-10-21  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * shr.el (shr-tag-table): Simplify.
index d8927eb..e4217d9 100644 (file)
@@ -1183,9 +1183,10 @@ It is a vector of the following headers:
   :error "All header lines must be newline terminated")
 
 (defcustom message-default-headers ""
   :error "All header lines must be newline terminated")
 
 (defcustom message-default-headers ""
-  "*A string containing header lines to be inserted in outgoing messages.
-It is inserted before you edit the message, so you can edit or delete
-these lines."
+  "A string containing header lines to be inserted in outgoing messages.
+It is inserted before you edit the message, so you can edit or
+delete these lines.  If set to a function, it is called and its
+result is inserted."
   :version "23.2"
   :group 'message-headers
   :link '(custom-manual "(message)Message Headers")
   :version "23.2"
   :group 'message-headers
   :link '(custom-manual "(message)Message Headers")
@@ -6407,7 +6408,10 @@ are not included."
    headers)
   (delete-region (point) (progn (forward-line -1) (point)))
   (when message-default-headers
    headers)
   (delete-region (point) (progn (forward-line -1) (point)))
   (when message-default-headers
-    (insert message-default-headers)
+    (insert
+     (if (functionp message-default-headers)
+         (funcall message-default-headers)
+       message-default-headers))
     (or (bolp) (insert ?\n)))
   (insert mail-header-separator "\n")
   (forward-line -1)
     (or (bolp) (insert ?\n)))
   (insert mail-header-separator "\n")
   (forward-line -1)
index b786b3b..a5246c9 100644 (file)
@@ -1,3 +1,8 @@
+2010-10-21  Julien Danjou  <julien@danjou.info>
+
+       * message.texi (Message Headers): Allow message-default-headers to be a
+       function.
+
 2010-10-21  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus-news.texi: Mention new archive defaults.
 2010-10-21  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus-news.texi: Mention new archive defaults.
index 68341ba..14da3be 100644 (file)
@@ -1451,7 +1451,7 @@ Allegedly.
 @item message-default-headers
 @vindex message-default-headers
 This string is inserted at the end of the headers in all message
 @item message-default-headers
 @vindex message-default-headers
 This string is inserted at the end of the headers in all message
-buffers.
+buffers.  If set to a function, the returned results is inserted.
 
 @item message-subject-re-regexp
 @vindex message-subject-re-regexp
 
 @item message-subject-re-regexp
 @vindex message-subject-re-regexp
diff --git a/todo b/todo
index 9e12a6e..b12c524 100644 (file)
--- a/todo
+++ b/todo
@@ -1175,8 +1175,6 @@ gnus-killed-list:
             (yes-or-no-p "New mail has arrived.  Quit Gnus anyways? ")
             (y-or-n-p "Are you sure you want to quit Gnus? "))))
 
             (yes-or-no-p "New mail has arrived.  Quit Gnus anyways? ")
             (y-or-n-p "Are you sure you want to quit Gnus? "))))
 
-*  allow message-default-headers to be a function.
-
 *  all commands that react to the process mark should push the
  current process mark set onto the stack.
 
 *  all commands that react to the process mark should push the
  current process mark set onto the stack.