Article View: news.software.readers
Article #12892Re: References headers: a software solution
From: Karl_Kleinpaste
Date: Thu, 17 Nov 1994 18:22
Date: Thu, 17 Nov 1994 18:22
262 lines
11701 bytes
11701 bytes
Following Tim Pierce's lead, below is a patch to GNU Emacs 19.27's
rnewspost.el and sendmail.el modules. There are 3 particular purposes
to these patches, but the important one at hand is that they provide
the generation of Usenet-compliant References: headers for mailed
replies. I use GNUS as my unified news-and-mail interface, so these
address my needs completely; related patches may be indicated for
RMAIL and VM, but I wouldn't know personally.
Just as the US Supreme Court observed that the solution to bad speech
is more speech, the solution to non-compliant software is enhanced
software. We shouldn't be arguing over how to deal with poorly-
formatted mail replies with which gateways have trouble; we should be
seeing to it that proper formatting is done.
(Other things done with this patch: Provides ^C^F^O in the *mail*
buffer as a way to get at the "optional CC list," a simple means to
include the original To/Cc people in a reply's Cc, useful when you see
mail in a quasi-newsgroup and want to "reply to all"; and an ability
to define your own "sendmail -f" address via the user-mail-addr variable.)
cheers,
--karl
________________
*** /afs/cs.cmu.edu/misc/gnu-emacs/common-depot/19.27/lib/emacs/19.27/lisp/rnewspost.el Mon Aug 24 21:57:37 1992
--- rnewspost.el Thu Nov 17 13:10:34 1994
***************
*** 201,211 ****
;; the fcc: and bcc: fields
(let ((mail-self-blind nil)
(mail-archive-file-name nil))
! (mail-setup to subject in-reply-to nil replybuffer nil)
(beginning-of-line)
(delete-region (point) (progn (forward-line 1) (point)))
(goto-char (point-max)))
! (mail-setup to subject in-reply-to nil replybuffer nil))
;;;(mail-position-on-field "Posting-Front-End")
;;;(insert (emacs-version))
(goto-char (point-max))
--- 201,211 ----
;; the fcc: and bcc: fields
(let ((mail-self-blind nil)
(mail-archive-file-name nil))
! (mail-setup to subject nil nil replybuffer nil nil)
(beginning-of-line)
(delete-region (point) (progn (forward-line 1) (point)))
(goto-char (point-max)))
! (mail-setup to subject nil nil replybuffer nil nil))
;;;(mail-position-on-field "Posting-Front-End")
;;;(insert (emacs-version))
(goto-char (point-max))
***************
*** 269,275 ****
(setq from (mail-fetch-field "from")
subject (mail-fetch-field "subject")
reply-to (mail-fetch-field "reply-to")
! date (mail-fetch-field "date"))
(setq to from)
(pop-to-buffer "*mail*")
(mail nil
--- 269,285 ----
(setq from (mail-fetch-field "from")
subject (mail-fetch-field "subject")
reply-to (mail-fetch-field "reply-to")
! date (mail-fetch-field "date")
! message-id (mail-fetch-field "message-id")
! orig-to (mail-fetch-field "to")
! orig-cc (mail-fetch-field "cc"))
! (setq optional-cc (cond ((and orig-to orig-cc)
! (concat orig-to ",\n\t" orig-cc))
! ((and orig-to (not orig-cc))
! orig-to)
! ((and (not orig-to) orig-cc)
! orig-cc)
! (t nil)))
(setq to from)
(pop-to-buffer "*mail*")
(mail nil
***************
*** 278,286 ****
(let ((stop-pos (string-match " *at \\| *@ \\| *(\\| *<" from)))
(concat (if stop-pos (substring from 0 stop-pos) from)
"'s message of "
! date))
nil
! buffer))))
;@@ the guts of news-reply and news-post-news should be combined. -tower
(defun news-reply ()
--- 288,296 ----
(let ((stop-pos (string-match " *at \\| *@ \\| *(\\| *<" from)))
(concat (if stop-pos (substring from 0 stop-pos) from)
"'s message of "
! date " " message-id "\nReferences: " message-id))
nil
! buffer nil optional-cc))))
;@@ the guts of news-reply and news-post-news should be combined. -tower
(defun news-reply ()
*** /afs/cs.cmu.edu/misc/gnu-emacs/common-depot/19.27/lib/emacs/19.27/lisp/sendmail.el Mon Aug 8 19:22:31 1994
--- sendmail.el Thu Nov 17 12:56:40 1994
***************
*** 121,126 ****
--- 121,127 ----
(defvar mail-reply-buffer nil)
(defvar mail-send-actions nil
"A list of actions to be performed upon successful sending of a message.")
+ (defvar mail-optional-cc-list nil)
(defvar mail-default-headers nil
"*A string containing header lines, to be inserted in outgoing messages.
***************
*** 158,164 ****
(defvar mail-send-hook nil
"Normal hook run before sending mail, in Mail mode.")
! (defun mail-setup (to subject in-reply-to cc replybuffer actions)
(if (eq mail-aliases t)
(progn
(setq mail-aliases nil)
--- 159,165 ----
(defvar mail-send-hook nil
"Normal hook run before sending mail, in Mail mode.")
! (defun mail-setup (to subject in-reply-to cc replybuffer actions optional-cc)
(if (eq mail-aliases t)
(progn
(setq mail-aliases nil)
***************
*** 166,171 ****
--- 167,173 ----
(build-mail-aliases))))
(setq mail-send-actions actions)
(setq mail-reply-buffer replybuffer)
+ (setq mail-optional-cc-list optional-cc)
(goto-char (point-min))
(insert "To: ")
(save-excursion
***************
*** 219,225 ****
C-c C-f move to a header field (and create it if there isn't):
C-c C-f C-t move to To: C-c C-f C-s move to Subj:
C-c C-f C-b move to BCC: C-c C-f C-c move to CC:
! C-c C-f C-f move to FCC:
C-c C-t move to message text.
C-c C-y mail-yank-original (insert current message, in Rmail).
C-c C-q mail-fill-yanked-message (fill what was yanked).
--- 221,227 ----
C-c C-f move to a header field (and create it if there isn't):
C-c C-f C-t move to To: C-c C-f C-s move to Subj:
C-c C-f C-b move to BCC: C-c C-f C-c move to CC:
! C-c C-f C-f move to FCC: C-c C-f C-o fill in auto CC:
C-c C-t move to message text.
C-c C-y mail-yank-original (insert current message, in Rmail).
C-c C-q mail-fill-yanked-message (fill what was yanked).
***************
*** 256,261 ****
--- 258,264 ----
(define-key mail-mode-map "\C-c\C-f\C-f" 'mail-fcc)
(define-key mail-mode-map "\C-c\C-f\C-c" 'mail-cc)
(define-key mail-mode-map "\C-c\C-f\C-s" 'mail-subject)
+ (define-key mail-mode-map "\C-c\C-f\C-o" 'mail-optional-cc)
(define-key mail-mode-map "\C-c\C-t" 'mail-text)
(define-key mail-mode-map "\C-c\C-y" 'mail-yank-original)
(define-key mail-mode-map "\C-c\C-q" 'mail-fill-yanked-message)
***************
*** 466,472 ****
nil errbuf nil "-oi")
;; Always specify who from,
;; since some systems have broken sendmails.
! (list "-f" (user-login-name))
;;; ;; Don't say "from root" if running under su.
;;; (and (equal (user-real-login-name) "root")
;;; (list "-f" (user-login-name)))
--- 469,477 ----
nil errbuf nil "-oi")
;; Always specify who from,
;; since some systems have broken sendmails.
! (list "-f" (if (boundp 'user-mail-addr)
! user-mail-addr
! (user-login-name)))
;;; ;; Don't say "from root" if running under su.
;;; (and (equal (user-real-login-name) "root")
;;; (list "-f" (user-login-name)))
***************
*** 648,653 ****
--- 653,670 ----
(mail-position-on-field "to"))
(insert "\nFCC: " folder))
+ (defun mail-optional-cc ()
+ "Insert mail-optional-cc-list at end of CC-field."
+ (interactive)
+ (if mail-optional-cc-list
+ (save-excursion
+ (expand-abbrev)
+ (or (mail-position-on-field "cc" t)
+ (progn (mail-position-on-field "to")
+ (insert "\nCC: ")))
+ (insert mail-optional-cc-list))
+ (message "There is no optional CC list.")))
+
(defun mail-position-on-field (field &optional soft)
(let (end
(case-fold-search t))
***************
*** 767,773 ****
;; Put these last, to reduce chance of lossage from quitting in middle of loading the file.
;;;###autoload
! (defun mail (&optional noerase to subject in-reply-to cc replybuffer actions)
"Edit a message to be sent. Prefix arg means resume editing (don't erase).
When this function returns, the buffer `*mail*' is selected.
The value is t if the message was newly initialized; otherwise, nil.
--- 784,790 ----
;; Put these last, to reduce chance of lossage from quitting in middle of loading the file.
;;;###autoload
! (defun mail (&optional noerase to subject in-reply-to cc replybuffer actions optional-cc)
"Edit a message to be sent. Prefix arg means resume editing (don't erase).
When this function returns, the buffer `*mail*' is selected.
The value is t if the message was newly initialized; otherwise, nil.
***************
*** 803,809 ****
The seventh argument ACTIONS is a list of actions to take
if/when the message is sent. Each action looks like (FUNCTION . ARGS);
when the message is sent, we apply FUNCTION to ARGS.
! This is how Rmail arranges to mark messages `answered'."
(interactive "P")
;;; This is commented out because I found it was confusing in practice.
;;; It is easy enough to rename *mail* by hand with rename-buffer
--- 820,829 ----
The seventh argument ACTIONS is a list of actions to take
if/when the message is sent. Each action looks like (FUNCTION . ARGS);
when the message is sent, we apply FUNCTION to ARGS.
! This is how Rmail arranges to mark messages `answered'.
! The eighth argument OPTIONAL-CC is a set of recipients who are
! not initially included as Cc:, but which can be added as a Cc:
! easily with \\[mail-optional-cc]."
(interactive "P")
;;; This is commented out because I found it was confusing in practice.
;;; It is easy enough to rename *mail* by hand with rename-buffer
***************
*** 860,866 ****
(or (not (buffer-modified-p))
(y-or-n-p "Unsent message being composed; erase it? "))
(progn (erase-buffer)
! (mail-setup to subject in-reply-to cc replybuffer actions)
(setq initialized t)))
(if (and buffer-auto-save-file-name
(file-exists-p buffer-auto-save-file-name))
--- 880,886 ----
(or (not (buffer-modified-p))
(y-or-n-p "Unsent message being composed; erase it? "))
(progn (erase-buffer)
! (mail-setup to subject in-reply-to cc replybuffer actions optional-cc)
(setq initialized t)))
(if (and buffer-auto-save-file-name
(file-exists-p buffer-auto-save-file-name))
--
The government which fears arms in the hands of its people...should.
Technical Details
Message-ID:
<KARL.94Nov17132220@APHRODITE.NECTAR.CS.CMU.EDU>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.mail.headers.mbox.zip!bga.com!news.sprintlink.net!howland.reston.ans.net!cs.utexas.edu!swrinde!sgiblab!uhog.mit.edu!nntp.club.cc.cmu.edu!cantaloupe.srv.cs.cmu.edu!usenet@cs.cmu.eduReferences:
<1994Nov16.184022.12638@midway.uchicago.edu>Show Full Headers
Complete Article Headers
Message-ID: <KARL.94Nov17132220@APHRODITE.NECTAR.CS.CMU.EDU> Subject: Re: References headers: a software solution Date: Thu, 17 Nov 1994 18:22:20 +0000 From: Karl_Kleinpaste@cs.cmu.edu References: <1994Nov16.184022.12638@midway.uchicago.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.mail.headers.mbox.zip!bga.com!news.sprintlink.net!howland.reston.ans.net!cs.utexas.edu!swrinde!sgiblab!uhog.mit.edu!nntp.club.cc.cmu.edu!cantaloupe.srv.cs.cmu.edu!usenet@cs.cmu.edu Newsgroups: news.admin.misc,news.software.readers,comp.mail.list-admin.software,comp.mail.headers,gnu.emacs.gnus Organization: Carnegie-Mellon Univ, Nectar Project Lines: 261 NNTP-Posting-Host: aphrodite.nectar.cs.cmu.edu