* [Patch] Message mode headers list
@ 1997-09-21 19:32 Matt Simmons
0 siblings, 0 replies; only message in thread
From: Matt Simmons @ 1997-09-21 19:32 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]
I changed message.el such that message-default-mail-headers,
message-default-news-headers, and message-default-headers can be a bit
more flexible. Specifically, they can be:
1) A string - the string will be inserted as before
2) A function - the function will be evaluated, and the string it
returns will be used as the headers to be inserted
3) A list - the list can contain strings and/or functions. They
will be evaluated one at a time as in 1 and 2. The
results of the evaluation will be concatenated and
used as headers.
I also took a crack at modifying the customization stuff for the three
variables, but I don't know how successful I was.
The motivation for this change? I need some way to insert the output
from a random X-Face function I wrote (see my web page) along with the
other default headers I set up.
Matt
--
Matt Simmons - simmonmt@acm.org - http://www.netcom.com/~simmonmt
Television: A medium. So called because it is neither rare nor well
done. --Ernie Kovacs
[-- Attachment #2: message.patch --]
[-- Type: application/octet-stream, Size: 5193 bytes --]
*** /tmp/T0a005Rx Sun Sep 21 14:31:37 1997
--- message.el Sun Sep 21 14:30:04 1997
***************
*** 538,561 ****
"A list of actions to be performed after postponing a message.")
(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."
:group 'message-headers
! :type 'string)
(defcustom message-default-mail-headers ""
! "*A string of header lines to be inserted in outgoing mails."
:group 'message-headers
:group 'message-mail
! :type 'string)
(defcustom message-default-news-headers ""
! "*A string of header lines to be inserted in outgoing news
! articles."
:group 'message-headers
:group 'message-news
! :type 'string)
;; Note: could use /usr/ucb/mail instead of sendmail;
;; options -t, and -v if not interactive.
--- 538,580 ----
"A list of actions to be performed after postponing a message.")
(defcustom message-default-headers ""
! "*Header lines to be inserted in outgoing messages.
It is inserted before you edit the message, so you can edit or delete
! these lines. It can be one of three things:
! 1) A string to be inserted as-is
! 2) A function that, when evaluated, will return a string
! or 3) A list of one or more of the above."
:group 'message-headers
! :type '(choice string
! (function fun)
! (list (choice string
! (function fun)))))
(defcustom message-default-mail-headers ""
! "*Header lines to be inserted in outgoing mails.
! This can be one of three things:
! 1) A string to be inserted as-is
! 2) A function that, when evaluated, will return a string
! or 3) A list of one or more of the above."
:group 'message-headers
:group 'message-mail
! :type '(choice string
! (function fun)
! (list (choice string
! (function fun)))))
(defcustom message-default-news-headers ""
! "*Header lines to be inserted in outgoing news.
! This can be one of three things:
! 1) A string to be inserted as-is
! 2) A function that, when evaluated, will return a string
! or 3) A list of one or more of the above."
:group 'message-headers
:group 'message-news
! :type '(choice string
! (function fun)
! (list (choice string
! (function fun)))))
;; Note: could use /usr/ucb/mail instead of sendmail;
;; options -t, and -v if not interactive.
***************
*** 2696,2701 ****
--- 2715,2746 ----
(or mail-host-address
(message-make-fqdn)))
+ (defun message-make-default-headers (hlist)
+ "Return default mail headers.
+ Build string consisting of headers indicated by hlist. (See documentation
+ for `message-default-headers', `message-default-mail-headers' and
+ `message-default-news-headers')"
+ (let ((retstr nil)
+ thishdr)
+ (if (not (listp hlist))
+ (setq hlist (list hlist)))
+ (while hlist
+ (setq thishdr (pop hlist))
+ (setq retstr
+ (concat retstr
+ (cond ((stringp thishdr)
+ thishdr)
+ ((functionp thishdr)
+ (funcall thishdr))
+ ((listp thishdr)
+ ;; anybody who needs this code has issues
+ (setq hlist (append thishdr hlist))
+ nil)
+ (t (error "Unknown header element %S" thishdr))))))
+ retstr))
+
+
+
(defun message-generate-headers (headers)
"Prepare article HEADERS.
Headers already prepared in the buffer are not modified."
***************
*** 2997,3003 ****
headers)
(delete-region (point) (progn (forward-line -1) (point)))
(when message-default-headers
! (insert message-default-headers))
(put-text-property
(point)
(progn
--- 3042,3048 ----
headers)
(delete-region (point) (progn (forward-line -1) (point)))
(when message-default-headers
! (insert (message-make-default-headers message-default-headers)))
(put-text-property
(point)
(progn
***************
*** 3007,3013 ****
(forward-line -1)
(when (message-news-p)
(when message-default-news-headers
! (insert message-default-news-headers))
(when message-generate-headers-first
(message-generate-headers
(delq 'Lines
--- 3052,3058 ----
(forward-line -1)
(when (message-news-p)
(when message-default-news-headers
! (insert (message-make-default-headers message-default-news-headers)))
(when message-generate-headers-first
(message-generate-headers
(delq 'Lines
***************
*** 3015,3021 ****
(copy-sequence message-required-news-headers))))))
(when (message-mail-p)
(when message-default-mail-headers
! (insert message-default-mail-headers))
(when message-generate-headers-first
(message-generate-headers
(delq 'Lines
--- 3060,3066 ----
(copy-sequence message-required-news-headers))))))
(when (message-mail-p)
(when message-default-mail-headers
! (insert (message-make-default-headers message-default-mail-headers)))
(when message-generate-headers-first
(message-generate-headers
(delq 'Lines
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1997-09-21 19:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-09-21 19:32 [Patch] Message mode headers list Matt Simmons
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).