Changes committed gnus/lisp (ChangeLog message.el)

"Reiner Steib" <[email protected]>
Newsgroups gmane.emacs.gnus.commits
Message-ID <[email protected]>
Modified: ChangeLog message.el

(message-replace-header): New helper function.
(message-recipients-without-full-name): New variable.
(message-simplify-recipients): New command.


Index: ChangeLog
diff -u gnus/lisp/ChangeLog:7.1802 gnus/lisp/ChangeLog:7.1803
--- ChangeLog:7.1802	Wed Mar 19 17:22:04 2008
+++ ChangeLog	Wed Mar 19 17:38:11 2008
@@ -4,6 +4,9 @@
 	function.
 	(message-alter-recipients-function): New variable.
 	(message-get-reply-headers): Use it.
+	(message-replace-header): New helper function.
+	(message-recipients-without-full-name): New variable.
+	(message-simplify-recipients): New command.
 
 	* mml.el (mml-menu): Add toggle for gnus-gcc-externalize-attachments.
 
Index: message.el
diff -u gnus/lisp/message.el:7.248 gnus/lisp/message.el:7.249
--- message.el:7.248	Wed Mar 19 17:22:04 2008
+++ message.el	Wed Mar 19 17:38:11 2008
@@ -7932,6 +7932,56 @@
 	  (kill-buffer buff))))
     (message "%s message(s) sent, %s skipped." sent skipped)))
 
+(defun message-replace-header (header new-value &optional after force)
+  "Remove HEADER and insert the NEW-VALUE.
+If AFTER, insert after this header.  If FORCE, insert new field
+even if NEW-VALUE is empty."
+  ;; Similar to `nnheader-replace-header' but for message buffers.
+  (save-excursion
+    (save-restriction
+      (message-narrow-to-headers)
+      (message-remove-header header))
+    (when (or force (> (length new-value) 0))
+      (if after
+	  (message-position-on-field header after)
+	(message-position-on-field header))
+      (insert new-value))))
+
+(defcustom message-recipients-without-full-name
+  (list "[email protected]"
+	"[email protected]"
+	"[email protected]"
+	"[email protected]"
+	"[email protected]")
+  "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-strip-full-names
+		 (string-match
+		  (regexp-opt message-strip-full-names)
+		  (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))
+      ", "))))
+
 (when (featurep 'xemacs)
   (require 'messagexmas)
   (message-xmas-redefine))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.