🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.vm.bug
Article #9714

Re: i don't want those headers in my reply

#9714
From: Piet van Oostrum
Date: Tue, 19 Mar 1991 12:47
68 lines
3709 bytes
>>>>> jbw@bigbird.bu.edu (Joe Wells) (JW) writes:

JW> The problem is that there are several different forwarding scenarios:

JW> 1) You are forwarding a message to a third party because you want them to
JW> know about it, 
JW> 2) You are forwarding a message to a third party because you want them to
JW> handle it and they not on the same system
JW> 3) You are forwarding a message to a third party because you want them to
JW> handle it.
....
JW> However, I think if we all pour massive amounts of e-mail in Kyle's
JW> mailbox he'll break down and give us the feature.  If necessary we can
JW> mail him core dumps and train schedules.  :-)  The header-stripping code
JW> already exists, so we just need a variable like
JW> vm-forwarded-unwanted-headers-regexp.  (hint)

Even with the smiley added I think the above is offensive. Kyle is doing a
great job and I think he deserves a lot of appreciation for it. He has mine
at least.

Now Joe suggests the stripping of headers in forwarded messages should be
considered on a per-message basis. This suggest to me to add a command to
mail-mode to just strip these. If you put this on a key-binding you can
have the thing stripped with one or two keystrokes. So I just put this in
my .emacs file:
you can use a prefix argument to select another regexp.

(defvar vm-forwarded-unwanted-header-regexp "^\\(Received\\|Return-Path\\|Status\\):"
  "Regular expression for headers to be stripped by vm-strip-forward-headers.")

(defvar vm-forwarded-unwanted-header-regexp2 "^\\(Received\\|Status\\):"
  "Regular expression for headers to be stripped by vm-strip-forward-headers
when called with prefix arg.")

(defun vm-strip-forward-headers (arg)
  "In a forwarded message strip the (forwarded) headers that match the
regular expression vm-forwarded-unwanted-header-regexp,
or vm-forwarded-unwanted-header-regexp2 when called with prefix arg."
  (interactive "P")
  (save-excursion
    (goto-char (point-min))
    (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$"))
    (let ((regexp (if arg
		  vm-forwarded-unwanted-header-regexp2 
		vm-forwarded-unwanted-header-regexp))
	  end-match)
      (if (re-search-forward vm-generic-header-regexp nil t)
	  (progn
	    (goto-char (match-beginning 0))
	    (while (looking-at vm-generic-header-regexp)
	      (setq end-match (match-end 0))
	      (if (looking-at regexp)
		  (delete-region (point) end-match)
		(goto-char end-match))))))))

(setq mail-setup-hook
      '(lambda ()
	 (define-key mail-mode-map "\C-c\C-z" 'vm-strip-forward-headers)
	 ))

If everybody who wants header stripping puts this in their .emacses then we
can end the discussion.
-- 
Piet* van Oostrum, Dept of Computer Science, Utrecht University,
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
Telephone: +31 30 531806   Uucp:   uunet!mcsun!ruuinf!piet
Telefax:   +31 30 513791   Internet:  piet@cs.ruu.nl   (*`Pete')
Technical Details
Message-ID: <1991Mar19.124713.24168@cs.ruu.nl>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!hp4nl!alchemy!piet
References: <9103111951.AA01707@wendy-fate.UU.NET> <JBW.91Mar17230756@bigbird.bu.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f6829,2559db4d74c03ba3
X-Google-Attributes: gidf6829,public
X-Google-ArrivalTime: 1991-03-19 06:46:34 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!hp4nl!alchemy!piet
From: piet@cs.ruu.nl (Piet van Oostrum)
Newsgroups: gnu.emacs.vm.bug
Subject: Re: i don't want those headers in my reply
Message-ID: <1991Mar19.124713.24168@cs.ruu.nl>
Date: 19 Mar 91 12:47:13 GMT
References: <9103111951.AA01707@wendy-fate.UU.NET> <JBW.91Mar17230756@bigbird.bu.edu>
Sender: piet@cs.ruu.nl (Piet van Oostrum)
Reply-To: piet@cs.ruu.nl (Piet van Oostrum)
Organization: Dept of Computer Science, Utrecht University, The Netherlands
Lines: 68
In-Reply-To: jbw@bigbird.bu.edu (Joe Wells)