Article View: gnu.emacs.bug
Article #87914Re: [gnu.emacs.gnus] Re: Change display of article header line in gnus?
From: John Interrante
Date: Thu, 11 Aug 1994 00:27
Date: Thu, 11 Aug 1994 00:27
45 lines
2427 bytes
2427 bytes
On 8 Aug 1994 00:25:19 -0400, amanda@iesd.auc.dk (Per Abrahamsen) said:
> I have been using this code for a year or so. It gives you the real
> name in the subject summary buffer, instead of the email address. I
> find it quite pleasant.
I've also been using a similar piece of code that I got from somebody
else. It looks perhaps a little better written, so I'll include it
below for comparison.
> Do you think it would be a good idea to include it in the gnus
> distribution?
Yes.
> Should it be default?
Yes.
;; Display posters' real names, not their e-mail addresses.
(defun gnus-lines-and-real-name (header)
(let ((lines (nntp-header-lines header))
(from (nntp-header-from header))
real-name L)
;; locate the real name if any in the From: header
(setq real-name
(cond ((string-match "^[ \t]*\\([^<>]+\\)<\\([^>]+\\)>" from)
;; Real Name <me@machine>
(substring from (match-beginning 1) (match-end 1)))
((string-match "^\\([^()]+\\)([ \t]*\\(.+\\))" from)
;; me@machine (Real Name)
(substring from (match-beginning 2) (match-end 2)))
(t from)))
;; delete certain chars from the name; for example, it is common
;; for the name to be "in quotes"
(while (setq L (string-match "[][\"\t]" real-name))
(setq real-name
(concat (substring real-name 0 L) (substring real-name (1+ L)))))
;; format and return a string containing the lines and real name
(substring (format "%3d: %-16s" lines real-name) 0 21)))
(setq gnus-optional-headers (function gnus-lines-and-real-name))
--
John Interrante <interran@uluru.stanford.edu>
Technical Details
Message-ID:
<INTERRAN.94Aug10001353@uluru.Stanford.EDU>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!primenet!netnews.asu.edu !asuvax!cs.utexas.edu!usc!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!uluru.stanford.edu!interranReferences:
<9408080418.AA10900@sunshine>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,d80126858cbab6ba X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1994-08-11 15:20:15 PST Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!primenet!netnews.asu.edu !asuvax!cs.utexas.edu!usc!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!uluru.stanford.edu!interran From: interran@uluru.stanford.edu (John Interrante) Newsgroups: gnu.emacs.bug Subject: Re: [gnu.emacs.gnus] Re: Change display of article header line in gnus? Date: 10 Aug 1994 20:27:52 -0400 Organization: Stanford University Lines: 46 Sender: daemon@cis.ohio-state.edu Approved: bug-gnu-emacs@prep.ai.mit.edu Distribution: gnu Message-ID: <INTERRAN.94Aug10001353@uluru.Stanford.EDU> References: <9408080418.AA10900@sunshine>