From: Josh Huber <huber@alum.wpi.edu>
Subject: Re: new Mail-Followup-To patch...please take a look...
Date: Tue, 23 Oct 2001 21:59:02 -0400 [thread overview]
Message-ID: <87bsixhk7t.fsf@mclinux.com> (raw)
In-Reply-To: <87wv1m9y6j.fsf@mclinux.com>
Yet another revision...
This one incorporates (I think) all of the changes that people have
mentioned. Caching, defaulting to use the to-(address|list) unless a
not-subscribed group parameter is present, automatically inserting
this caching function into message-subscribed-address-functions on
startup, etc.
the thing I really need help on is where these vars/defuns belong, and
the proper way to do what I did to automatically setup the
variable. (is modifying gnus-1 the right way?)
Also, general comments (as always :) are welcome. especially telling
me the right way to use elisp, etc.
Index: lisp/gnus-group.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-group.el,v
retrieving revision 6.44
diff -u -r6.44 gnus-group.el
--- lisp/gnus-group.el 2001/10/14 23:12:41 6.44
+++ lisp/gnus-group.el 2001/10/24 02:01:37
@@ -2289,6 +2289,7 @@
(gnus-group-prefixed-name
(gnus-group-real-name (car info)) method))
nil)))
+ (setq gnus-group-dirty-flag t)
(when (and new-group
(not (equal new-group group)))
(when (gnus-group-goto-group group)
Index: lisp/gnus-start.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-start.el,v
retrieving revision 6.30
diff -u -r6.30 gnus-start.el
--- lisp/gnus-start.el 2001/09/14 14:09:30 6.30
+++ lisp/gnus-start.el 2001/10/24 02:01:40
@@ -433,6 +433,41 @@
;; Byte-compiler warning.
(defvar gnus-group-line-format)
+;; mail-followup-to handling...
+(defvar gnus-group-parameter-cache nil)
+(defvar gnus-subscribed-addresses nil)
+(defvar gnus-group-dirty-flag nil)
+
+(defun gnus-find-subscribed-addresses-real ()
+ "Return a regexp matching the addresses of all subscribed mail groups.
+It consists of the `to-address' or `to-list' parameter of all groups
+with a nil `not-subscribed' parameter."
+ (let ((addresses))
+ (mapc (lambda (entry)
+ (let ((group (car entry)))
+ (when (not (gnus-group-find-parameter group 'not-subscribed))
+ (let ((address (or
+ (gnus-group-find-parameter group 'to-address)
+ (gnus-group-find-parameter group 'to-list))))
+ (when address
+ (setq addresses (cons address addresses)))))))
+ (cdr gnus-newsrc-alist))
+ (mapconcat 'regexp-quote addresses "\\|")))
+
+(defun gnus-find-subscribed-addresses ()
+ "Return a regexp matching the addresses of all subscrbied mail groups.
+This uses `gnus-group-parameter-cache' to keep track of changes to
+`gnus-parameters' and `gnus-group-dirty-flag' to keep track of interactive
+changes to group parameters."
+ (if (and (eq gnus-group-parameter-cache gnus-parameters)
+ (not gnus-group-dirty-flag)) ; how to do this?
+ gnus-subscribed-addresses
+ (progn
+ (setq gnus-group-dirty-flag nil)
+ (setq gnus-group-parameter-cache gnus-parameters)
+ (setq gnus-subscribed-addresses
+ (gnus-find-subscribed-addresses-real)))))
+
;; Suggested by Brian Edmonds <edmonds@cs.ubc.ca>.
(defvar gnus-init-inhibit nil)
(defun gnus-read-init-file (&optional inhibit-next)
@@ -746,6 +781,11 @@
(gnus-group-first-unread-group)
(gnus-configure-windows 'group)
(gnus-group-set-mode-line)
+
+ ;; set up support for generating Mail-Followup-To headers
+ (when (equal message-subscribed-address-functions '(ignore))
+ (setq message-subscribed-address-functions
+ '(gnus-find-subscribed-addresses)))
(gnus-run-hooks 'gnus-started-hook))))))
(defun gnus-start-draft-setup ()
Index: lisp/message.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/message.el,v
retrieving revision 6.137
diff -u -r6.137 message.el
--- lisp/message.el 2001/10/20 17:27:25 6.137
+++ lisp/message.el 2001/10/24 02:01:45
@@ -424,6 +424,30 @@
(const use)
(const ask)))
+(defvar message-subscribed-address-functions '(ignore)
+ "*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. These functions can be used in
+conjunction with `message-subscribed-regexps' and
+`message-subscribed-addresses'.")
+
+(defcustom message-subscribed-addresses nil
+ "*Specifies a list of addresses the user is subscribed to.
+If nil, do not use any predefined list subscriptions. This list of
+addresses can be used in conjuction with
+`message-subscribed-address-functions' and `message-subscribed-regexps'."
+ :group 'message-interface
+ :type '(repeat string))
+
+(defcustom message-subscribed-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-subscribed-address-functions' and `message-subscribed-addresses'."
+ :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 +1492,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 +1572,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 +1596,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).
@@ -1721,6 +1748,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)
@@ -2527,6 +2559,16 @@
(let ((message-deletable-headers
(if news nil message-deletable-headers)))
(message-generate-headers message-required-mail-headers))
+ ;; Generate the Mail-Followup-To header if the header is not there...
+ (if (and (or message-subscribed-regexps
+ message-subscribed-addresses
+ message-subscribed-address-functions)
+ (not (mail-fetch-field "mail-followup-to")))
+ (message-generate-headers
+ `(("Mail-Followup-To" . ,(message-make-mft))))
+ ;; otherwise, delete the MFT header if the field is empty
+ (when (equal "" (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
@@ -3536,6 +3578,29 @@
"Return the domain name."
(or mail-host-address
(message-make-fqdn)))
+
+(defun message-make-mft ()
+ "Return the Mail-Followup-To header."
+ (let* ((msg-recipients (message-options-get 'message-recipients))
+ (recipients
+ (mapcar 'mail-strip-quoted-names
+ (message-tokenize-header msg-recipients)))
+ (mft-regexps (apply 'append message-subscribed-regexps
+ (mapcar 'regexp-quote
+ message-subscribed-addresses)
+ (mapcar 'funcall
+ message-subscribed-address-functions))))
+ (save-match-data
+ (when (eval (apply 'append '(or)
+ (mapcar
+ (function (lambda (regexp)
+ (mapcar
+ (function (lambda (recipient)
+ `(string-match ,regexp
+ ,recipient)))
+ recipients)))
+ mft-regexps)))
+ msg-recipients))))
(defun message-generate-headers (headers)
"Prepare article HEADERS.
--
Josh Huber
next prev parent reply other threads:[~2001-10-24 1:59 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-23 15:24 Josh Huber
2001-10-23 15:42 ` Josh Huber
2001-10-23 16:32 ` Paul Jarc
2001-10-23 16:54 ` Josh Huber
2001-10-23 17:45 ` Paul Jarc
2001-10-23 18:54 ` Matt Armstrong
2001-10-23 19:53 ` Paul Jarc
2001-10-24 0:34 ` Josh Huber
2001-10-24 11:35 ` Per Abrahamsen
2001-10-24 12:48 ` Josh Huber
2001-10-24 16:31 ` Paul Jarc
2001-10-24 17:08 ` Per Abrahamsen
2001-10-24 17:18 ` Paul Jarc
2001-10-26 6:24 ` Kai Großjohann
2001-10-27 23:23 ` Florian Weimer
2001-10-23 16:56 ` Josh Huber
2001-10-23 17:32 ` Per Abrahamsen
2001-10-23 23:53 ` Josh Huber
2001-10-23 22:40 ` Davide G. M. Salvetti
2001-10-24 1:40 ` Paul Jarc
2001-10-24 12:45 ` Davide G. M. Salvetti
2001-10-24 13:44 ` Samuel Padgett
2001-10-24 15:23 ` Paul Jarc
2001-10-24 15:42 ` Per Abrahamsen
2001-10-24 15:51 ` Samuel Padgett
2001-10-26 6:28 ` Kai Großjohann
2001-10-27 1:19 ` Barry Fishman
2001-10-29 14:49 ` Kai Großjohann
2001-10-27 22:27 ` Florian Weimer
2001-10-24 1:59 ` Josh Huber [this message]
2001-10-24 15:02 ` Per Abrahamsen
2001-10-24 16:48 ` Paul Jarc
2001-10-24 17:13 ` Per Abrahamsen
2001-10-25 1:52 ` Josh Huber
2001-10-24 16:13 ` Paul Jarc
2001-10-24 17:19 ` Per Abrahamsen
2001-10-24 17:28 ` Paul Jarc
2001-10-24 17:38 ` Per Abrahamsen
2001-10-25 1:45 ` Josh Huber
2001-10-25 18:48 ` Josh Huber
2001-10-29 21:58 ` Matt Armstrong
2001-10-29 22:19 ` Josh Huber
2001-10-29 22:31 ` Paul Jarc
2001-10-30 2:47 ` Josh Huber
2001-10-30 3:11 ` Paul Jarc
2001-10-30 3:49 ` Matt Armstrong
2001-10-30 12:55 ` Per Abrahamsen
2001-10-30 15:31 ` Josh Huber
2001-10-31 13:44 ` ShengHuo ZHU
2001-10-31 17:28 ` Matt Armstrong
2001-10-31 17:51 ` Josh Huber
2001-10-31 18:22 ` ShengHuo ZHU
2001-10-26 6:34 ` Kai Großjohann
2001-10-26 9:07 ` Per Abrahamsen
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=87bsixhk7t.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).