[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: functions for parsing mail addresses
From: |
Emanuel Berg |
Subject: |
Re: functions for parsing mail addresses |
Date: |
Wed, 25 Oct 2023 04:42:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Roland Winkler wrote:
> I am looking at functions in the Emacs code base for parsing
> mail addresses, trying to figure out their differences.
> But this appears to be somewhat messy.
>
> The docstring of the user variable
> `gnus-extract-address-components' says that two pre-defined
> function exist: ‘gnus-extract-address-components’, which is
> the default, quite fast, and too simplistic solution, and
> ‘mail-extract-address-components’, which works much better,
> but is slower. But it seems to me that calls of the function
> `gnus-extract-address-components' are as often hard-coded as
> the user variable `gnus-extract-address-components' is used.
I have something like that:
(defun citation-style-f ()
(let*((from (mail-header-from message-reply-headers))
(from-data (gnus-extract-address-components from))
(name (or (car from-data)
;; if the user hasn't set his name, use the
;; mail username e.g. joe for joe@hacker.com
(car (split-string (cadr from-data) "@"))))
(citation-string (format "%s wrote:\n\n" name)) )
(insert citation-string) ))
Whole file:
https://dataswamp.org/~incal/emacs-init/gnus/gnus-cite-incal.el
--
underground experts united
https://dataswamp.org/~incal