From: Josh Huber <huber@alum.wpi.edu>
Subject: Re: Generating Mail-Followup-To: headers
Date: Fri, 19 Oct 2001 16:05:03 -0400 [thread overview]
Message-ID: <87adyngzv4.fsf@mclinux.com> (raw)
In-Reply-To: <m33d4fmmlk.fsf@multivac.cwru.edu>
prj@po.cwru.edu (Paul Jarc) writes:
> And I just noticed that we don't actually need to get a cleaner
> string at all. So mail-fetch-field alone should work.
Indeed...
here's the new version:
Index: message.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/message.el,v
retrieving revision 6.131
diff -u -r6.131 message.el
--- message.el 2001/10/17 17:53:42 6.131
+++ message.el 2001/10/19 20:01:31
@@ -424,6 +424,24 @@
(const use)
(const ask)))
+(defcustom message-mft-address-functions nil
+ "*Specifies functions for determining list subscription.
+If nil, do not attempt to determine list subscribtion with functions.
+If non-nil, this variable contains a list of functions which return
+regular expressions to match lists. One such useful function might be
+`gnus-get-subscribed-addresses'. These functions can be used in
+conjunction with `message-mft-regexps'."
+ :group 'message-interface
+ :type '(repeat sexp))
+
+(defcustom message-mft-regexps nil
+ "*Specifies a list of addresses the user is subscribed to.
+If nil, do not use any predefined list subscriptions. This list of
+regular expressions can be used in conjuction with
+`message-mft-address-functions'."
+ :group 'message-interface
+ :type '(repeat regexp))
+
(defcustom message-sendmail-f-is-evil nil
"*Non-nil means don't add \"-f username\" to the sendmail command line.
Doing so would be even more evil than leaving it out."
@@ -1468,6 +1486,7 @@
(define-key message-mode-map "\C-c\C-f\C-n" 'message-goto-newsgroups)
(define-key message-mode-map "\C-c\C-f\C-d" 'message-goto-distribution)
(define-key message-mode-map "\C-c\C-f\C-f" 'message-goto-followup-to)
+ (define-key message-mode-map "\C-c\C-f\C-m" 'message-goto-mail-followup-to)
(define-key message-mode-map "\C-c\C-f\C-k" 'message-goto-keywords)
(define-key message-mode-map "\C-c\C-f\C-u" 'message-goto-summary)
(define-key message-mode-map "\C-c\C-b" 'message-goto-body)
@@ -1547,6 +1566,7 @@
["Keywords" message-goto-keywords t]
["Newsgroups" message-goto-newsgroups t]
["Followup-To" message-goto-followup-to t]
+ ["Mail-Followup-To" message-goto-mail-followup-to t]
["Distribution" message-goto-distribution t]
["Body" message-goto-body t]
["Signature" message-goto-signature t]))
@@ -1570,6 +1590,7 @@
C-c C-f C-u move to Summary C-c C-f C-n move to Newsgroups
C-c C-f C-k move to Keywords C-c C-f C-d move to Distribution
C-c C-f C-f move to Followup-To
+ C-c C-f C-m move to Mail-Followup-To
C-c C-t `message-insert-to' (add a To header to a news followup)
C-c C-n `message-insert-newsgroups' (add a Newsgroup header to a news reply)
C-c C-b `message-goto-body' (move to beginning of message text).
@@ -1714,6 +1735,11 @@
(interactive)
(message-position-on-field "Followup-To" "Newsgroups"))
+(defun message-goto-mail-followup-to ()
+ "Move point to the Mail-Followup-To header."
+ (interactive)
+ (message-position-on-field "Mail-Followup-To" "From"))
+
(defun message-goto-keywords ()
"Move point to the Keywords header."
(interactive)
@@ -2514,6 +2540,15 @@
(let ((message-deletable-headers
(if news nil message-deletable-headers)))
(message-generate-headers message-required-mail-headers))
+ ;; Generate the Mail-Followup-To header...
+ ;; only if the header doesn't exist.
+ (when (and (or message-mft-regexps message-mft-address-functions)
+ (not (message-fetch-field "mail-followup-to")))
+ (let ((Mail-Followup-To (message-make-mft)))
+ (message-generate-headers '((optional . Mail-Followup-To)))))
+ ;; otherwise, delete the MFT header if the field is empty
+ (and (string= "" (mail-fetch-field "mail-followup-to"))
+ (message-remove-header "Mail-Followup-To"))
;; Let the user do all of the above.
(run-hooks 'message-header-hook))
(unwind-protect
@@ -3523,6 +3558,17 @@
"Return the domain name."
(or mail-host-address
(message-make-fqdn)))
+
+(defun message-make-mft ()
+ "Return the Mail-Followup-To header."
+ (let ((recipients (message-options-get 'message-recipients))
+ (mft-regexps (apply 'append message-mft-regexps
+ (mapcar '(lambda (func) (funcall func))
+ message-mft-address-functions))))
+ (and (eval `(or ,@(mapcar '(lambda (regexp)
+ (and regexp (string-match regexp recipients)))
+ mft-regexps)))
+ recipients)))
(defun message-generate-headers (headers)
"Prepare article HEADERS.
here's a little support code for enabling it look at the group
parameters:
;;*===========================
;;* Mail-Followup-To settings
(setq gnus-parameters
'(("^mail\\.lists\\." (subscribed . t))))
(defun jmh-find-subscribed-addresses ()
(delete-if
nil (mapcar '(lambda (group)
(or (gnus-group-find-parameter group 'to-address)
(gnus-group-find-parameter group 'to-list)))
(delete-if-not '(lambda (group)
(gnus-group-find-parameter
group 'subscribed))
(mapcar '(lambda (item) (car item))
gnus-newsrc-alist)))))
(add-to-list 'message-mft-address-functions
(lambda ()
(mapcar 'regexp-quote (jmh-find-subscribed-addresses))))
Does anyone have any suggestions?
Running the -find-subscribed-addresses just once as a utility function
and storing those values in the message-mft-regexps variable would be
a good idea, especially since, at least my version, seems to run
pretty slow. (.5 second pause)
ttyl,
--
Josh Huber
next prev parent reply other threads:[~2001-10-19 20:05 UTC|newest]
Thread overview: 147+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-18 5:11 Matt Armstrong
2001-10-18 5:43 ` Paul Jarc
2001-10-18 16:08 ` Matt Armstrong
2001-10-18 16:19 ` Kai Großjohann
2001-10-18 16:41 ` Paul Jarc
2001-10-18 18:17 ` Kai Großjohann
2001-10-18 23:19 ` Maciej Matysiak
2001-10-19 9:03 ` Kai Großjohann
2001-11-01 21:54 ` Maciej Matysiak
2001-11-01 22:10 ` Matt Armstrong
2001-11-02 1:03 ` Samuel Padgett
2001-11-07 13:39 ` Maciej Matysiak
2001-11-07 13:30 ` Maciej Matysiak
2001-11-07 14:26 ` Per Abrahamsen
2001-11-07 14:31 ` Didier Verna
2001-11-07 14:40 ` Per Abrahamsen
2001-11-07 14:44 ` Josh Huber
2001-11-07 15:36 ` Kai Großjohann
2001-11-07 16:08 ` Matt Armstrong
2001-11-07 17:03 ` Kai Großjohann
2001-11-07 19:59 ` Josh Huber
2001-11-02 8:31 ` Kai Großjohann
2001-11-02 16:09 ` Matt Armstrong
2001-11-02 16:52 ` OT: make bbdb shut up about different email addresses? Josh Huber
2001-11-02 17:37 ` Matt Armstrong
2001-11-02 17:48 ` Jason R. Mastaler
2001-11-02 19:44 ` Matt Armstrong
2001-11-02 19:58 ` Paul Jarc
2001-11-02 18:35 ` Matt Armstrong
2001-11-02 22:27 ` Jack Twilley
2001-11-02 23:54 ` Matt Armstrong
2001-11-03 5:16 ` thoughts on spam Bill White
2001-11-03 6:33 ` Jason R. Mastaler
2001-11-03 7:29 ` SPAM? What SPAM? (was: thoughts on spam) Robin S. Socha
2001-11-03 18:13 ` Harry Putnam
2001-11-03 18:39 ` Jason R. Mastaler
2001-11-03 19:04 ` Karl Kleinpaste
2001-11-03 19:12 ` Jason R. Mastaler
2001-11-03 19:21 ` Harry Putnam
2001-11-03 22:52 ` Karl Kleinpaste
2001-11-03 14:48 ` thoughts on spam Bill White
2001-11-03 15:12 ` Stainless Steel Rat
2001-11-03 18:24 ` Jason R. Mastaler
2001-11-04 6:01 ` Stainless Steel Rat
2001-11-04 7:00 ` Jason R. Mastaler
2001-11-04 8:40 ` Stainless Steel Rat
2001-11-05 20:04 ` Jason R. Mastaler
2001-11-05 20:38 ` Stainless Steel Rat
2001-11-05 23:06 ` Jason R. Mastaler
2001-11-06 1:52 ` Stainless Steel Rat
2001-11-06 2:07 ` Stainless Steel Rat
2001-11-06 2:43 ` Paul Jarc
2001-11-06 3:05 ` Harry Putnam
2001-11-06 3:26 ` Stainless Steel Rat
2001-11-05 22:01 ` Chris Shenton
2001-11-05 22:54 ` Matt Armstrong
2001-11-03 18:26 ` Robin S. Socha
2001-11-03 18:42 ` Jason R. Mastaler
2001-11-03 18:56 ` Fabien Penso
2001-11-03 19:24 ` Robin S. Socha
2001-11-04 5:54 ` Stainless Steel Rat
2001-11-04 7:07 ` Jason R. Mastaler
2001-11-04 9:04 ` Stainless Steel Rat
2001-11-04 17:57 ` Matt Armstrong
2001-11-04 20:46 ` Stainless Steel Rat
2001-11-05 3:49 ` Paul Jarc
2001-11-05 4:34 ` Stainless Steel Rat
2001-11-05 5:27 ` Harry Putnam
2001-11-05 15:59 ` Matt Armstrong
2001-11-05 16:57 ` Stainless Steel Rat
2001-11-05 17:45 ` [OT] " Fabien Penso
2001-11-05 19:25 ` Stainless Steel Rat
2001-11-05 19:33 ` Harry Putnam
2001-11-05 19:58 ` Stainless Steel Rat
2001-11-05 20:01 ` Karl Kleinpaste
2001-11-05 20:35 ` Matt Armstrong
2001-11-06 6:51 ` Harry Putnam
2001-11-06 16:55 ` Matt Armstrong
2001-11-06 18:51 ` Harry Putnam
2001-11-06 19:19 ` Lost Mail (was thoughts on spam) Stainless Steel Rat
2001-11-06 20:02 ` thoughts on spam Matt Armstrong
2001-11-06 20:49 ` Harry Putnam
2001-11-06 19:52 ` Steinar Bang
2001-11-04 17:33 ` François Pinard
2001-11-04 17:23 ` François Pinard
2001-11-03 20:32 ` Russ Allbery
2001-11-03 18:15 ` Harry Putnam
2001-11-04 4:08 ` Bill White
2001-11-04 4:04 ` Harry Putnam
2001-11-04 4:07 ` Harry Putnam
2001-11-04 7:11 ` Bill White
2001-11-04 7:10 ` Jason R. Mastaler
2001-11-04 13:47 ` Harry Putnam
2001-11-04 17:45 ` bbdb arcana Bill White
2001-11-07 13:43 ` Generating Mail-Followup-To: headers Maciej Matysiak
2001-10-19 4:48 ` Per Abrahamsen
2001-10-19 13:46 ` Josh Huber
2001-10-19 14:08 ` Per Abrahamsen
2001-10-19 15:49 ` Paul Jarc
2001-10-19 15:29 ` Matt Armstrong
2001-10-19 16:19 ` Paul Jarc
2001-10-19 19:29 ` Matt Armstrong
2001-10-19 19:44 ` Josh Huber
2001-10-19 20:59 ` Kai Großjohann
2001-10-19 15:42 ` Paul Jarc
2001-10-19 16:16 ` Per Abrahamsen
2001-10-19 16:25 ` Paul Jarc
2001-10-19 17:01 ` Josh Huber
2001-10-19 17:04 ` Josh Huber
2001-10-19 19:46 ` Paul Jarc
2001-10-19 19:54 ` Paul Jarc
2001-10-19 20:05 ` Josh Huber [this message]
2001-10-19 20:50 ` Matt Armstrong
2001-10-19 21:12 ` Paul Jarc
2001-10-20 6:52 ` Josh Huber
2001-10-20 9:41 ` Per Abrahamsen
2001-10-21 0:58 ` Matt Armstrong
2001-10-19 20:16 ` Paul Jarc
2001-10-19 21:12 ` Josh Huber
2001-10-19 21:40 ` Paul Jarc
2001-10-20 6:25 ` Josh Huber
2001-10-19 17:51 ` Kai Großjohann
2001-10-19 18:23 ` Josh Huber
2001-10-19 20:31 ` Matt Armstrong
2001-10-19 20:53 ` Josh Huber
2001-10-19 22:28 ` Kai Großjohann
2001-10-19 23:58 ` Matt Armstrong
2001-10-20 10:56 ` Kai Großjohann
2001-10-20 11:19 ` ShengHuo ZHU
2001-10-20 4:47 ` Paul Jarc
2001-10-20 10:57 ` Kai Großjohann
2001-10-20 6:29 ` Josh Huber
2001-10-19 19:26 ` Matt Armstrong
2001-10-19 21:08 ` Kai Großjohann
2001-10-19 21:20 ` Kai Großjohann
2001-10-20 9:51 ` Per Abrahamsen
2001-10-20 10:59 ` Kai Großjohann
2001-10-19 16:31 ` Kai Großjohann
2001-10-18 16:59 ` Paul Jarc
2001-10-18 16:36 ` Josh Huber
2001-10-18 17:11 ` Paul Jarc
2001-10-18 17:56 ` Josh Huber
2001-10-18 18:52 ` Matt Armstrong
2001-10-18 19:11 ` Josh Huber
2001-10-18 19:29 ` Matt Armstrong
2001-10-18 19:27 ` Paul Jarc
2001-10-19 9:05 ` Kai Großjohann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87adyngzv4.fsf@mclinux.com \
--to=huber@alum.wpi.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).