From 299475296b1337e63b9634ba8e06834f73e0522d Mon Sep 17 00:00:00 2001 From: David Bremner Date: Tue, 29 Dec 2009 21:35:22 -0400 Subject: add message-templ-config-exec() This function tries to match a sequence of regexps on the headers, and applies corresponding actions. --- message-templ.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/message-templ.el b/message-templ.el index 333d8ac..c76ae33 100644 --- a/message-templ.el +++ b/message-templ.el @@ -349,5 +349,26 @@ Set header-separator is MAIL-HEADER." (insert mail-header-separator "\n")) (messsage-templ-config-exec-sub template)))) +(defun message-templ-config-exec (&optional config-alist) + "Change headers according to the value of `message-templ-config-alist'." + (interactive) + (let ((case-fold-search t) + (alist (or config-alist message-templ-config-alist)) + local-variables key clist found) + (save-excursion + (while alist + (setq key (caar alist) + clist (cdar alist)) + (cond + ((stringp key) + (if (save-restriction + (message-narrow-to-headers) + (goto-char (point-min)) + (re-search-forward key nil t)) + (message-templ-config-exec-sub clist))) + ((eval key) + (message-templ-config-exec-sub clist))) + (setq alist (cdr alist)))))) + (provide 'message-templ) ;;; message-templ.el ends here -- cgit v1.2.3