🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Full-Name field should be optional

#9633
From: Mike Williams
Date: Mon, 08 Apr 1991 09:20
73 lines
3700 bytes
>>> On 3 Apr 91 05:44:44 GMT,
>>> "David" == grabiner@math.harvard.edu (David Grabiner) writes:

David> I have a mail-setup-hook which already creates a Full-Name field in any
David> mail I send out.  When I use the current version of VM (5.31), it adds
David> another Full-Name field, which I don't want.  I would like to have a
David> variable to set in my .vm file to inhibit the creation of the Full-Name
David> field.

David> Deleting the Full-Name field from my mail-setup-hook is not a solution,
David> because I often send mail from outside VM as well.

    You want something to add the extra header only if it doesn't exist,
  right?  I use a couple of general functions for this purpose:

  +--- add/remove headers ---
  |
  | (defun mail-add-header (HEADER CONTENTS &optional REPLACE)
  |   "Add the specified HEADER to the current mail message, with the given 
  | CONTENTS.  
  | If the header already exists, the contents are left unchanged, unless optional 
  | argument REPLACE is non-nil."
  |   (save-excursion
  |     (let ((header-exists (mail-position-on-field HEADER)))
  |       ;; Delete old contents if REPLACE is set
  |       (if (and header-exists REPLACE)
  | 	  (let ((end (point))
  | 		(beg (progn
  | 		       (re-search-backward (concat HEADER ": "))
  | 		       (goto-char (match-end 0)))))
  | 	    (delete-region beg end)))
  |       ;; Add new contents if REPLACE is set, or this is a new header.
  |       (if (or (not header-exists) REPLACE)
  | 	  (progn (insert CONTENTS) CONTENTS)))))
  | 
  | (defun mail-remove-header (HEADER)
  |   "Remove the specified HEADER from the current mail message."
  |   (save-excursion
  |     (if (mail-position-on-field HEADER 'soft)
  | 	(let ((end (point))
  | 	      (beg (progn
  | 		     (re-search-backward (concat HEADER ": "))
  | 		     (goto-char (match-beginning 0)))))
  | 	  (delete-region beg (1+ end))))))
  |     

    If you want make sure that one (and only one) "Full-Name" field gets
  added to all your mail, do something like:

  (setq mail-setup-hook
    '(lambda ()
        (mail-add-header "Full-Name" (user-full-name))
        ;; ... and the rest ...
        ))

  And for those of you who are bugged by the header:

  (setq mail-setup-hook
    '(lambda ()
        (mail-remove-header "Full-Name")
        ;; ... and the rest ...
        ))

  ... I know that this is overkill for just adding the Full-Name header,
  but you never know when the more general function might be useful :-)

--
    /-------------------- mike-w@cs.aukuni.ac.nz ---------------------\
    | Mike Williams, Computer Science, Auckland University, Aotearoa. |
    \-------------- What's another word for Thesaurus? ---------------/
-- 
New administrater uofa.
Technical Details
Message-ID: <MIKE-W.91Apr8092041@cs17.cs.aukuni.ac.nz>
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!waikato.ac.nz!aukuni.ac.nz!mike-w
References: <GRABINER.91Apr3004444@zariski.harvard.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f6829,fc1facd34957b5e7,start
X-Google-Attributes: gidf6829,public
X-Google-ArrivalTime: 1991-04-07 15:32:30 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!waikato.ac.nz!aukuni.ac.nz!mike-w
From: mike-w@cs.aukuni.ac.nz (Mike Williams)
Newsgroups: gnu.emacs.vm.bug
Subject: Re: Full-Name field should be optional
Message-ID: <MIKE-W.91Apr8092041@cs17.cs.aukuni.ac.nz>
Date: 8 Apr 91 09:20:41 GMT
References: <GRABINER.91Apr3004444@zariski.harvard.edu>
Sender: news@ccu1.aukuni.ac.nz (News Owner)
Distribution: gnu
Organization: Dept. of Computer Science, Auckland Uni., New Zealand
Lines: 73
In-Reply-To: grabiner@math.harvard.edu's message of 3 Apr 91 05:44:44 GMT
Nntp-Posting-Host: aucs17.cs.aukuni.ac.nz
X-News-Software: GNUS 3.13