bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#27857: add gnus-mail-avoid-redundancy


From: Lars Ingebrigtsen
Subject: bug#27857: add gnus-mail-avoid-redundancy
Date: Thu, 12 Apr 2018 14:31:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

I see that there's already kinda-sorta this feature in Message already,
but it only reacts to an explicit list of addresses.  And it's an
interactive command.  But this means that somebody was annoyed enough a
long time ago by the ugliness that a solution was attempted.  :-)

(defcustom message-recipients-without-full-name
  (list "address@hidden"
        "address@hidden"
        "address@hidden"
        "address@hidden"
        "address@hidden")
  "Mail addresses that have no full name.
Used in `message-simplify-recipients'."
  ;; Maybe the addresses could be extracted from
  ;; `gnus-parameter-to-list-alist'?
  :type '(choice (const :tag "None" nil)
                 (repeat string))
  :version "23.1" ;; No Gnus
  :group 'message-headers)

(defun message-simplify-recipients ()
  (interactive)
  (dolist (hdr '("Cc" "To"))
    (message-replace-header
     hdr
     (mapconcat
      (lambda (addrcomp)
        (if (and message-recipients-without-full-name
                 (string-match
                  (regexp-opt message-recipients-without-full-name)
                  (cadr addrcomp)))
            (cadr addrcomp)
          (if (car addrcomp)
              (message-make-from (car addrcomp) (cadr addrcomp))
            (cadr addrcomp))))
      (when (message-fetch-field hdr)
        (mail-extract-address-components
         (message-fetch-field hdr) t))
      ", "))))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no






reply via email to

[Prev in Thread] Current Thread [Next in Thread]