]> git.eshelyaron.com Git - emacs.git/commitdiff
(rmail-summary-get-sender): New function.
authorHenrik Enberg <henrik.enberg@telia.com>
Fri, 20 Jan 2006 18:50:02 +0000 (18:50 +0000)
committerHenrik Enberg <henrik.enberg@telia.com>
Fri, 20 Jan 2006 18:50:02 +0000 (18:50 +0000)
(rmail-summary-get-summary): Use it.
(rmail-summary-get-line-count): Doc fix.
(rmail-summary-get-summary-attributes): Likewise.

lisp/mail/ChangeLog
lisp/mail/rmailsum.el

index a724dfbeb92417cccacc43869114306316cdc5fa..442775761e71e1fdf09de2ace70b657a2916d566 100644 (file)
@@ -1,7 +1,10 @@
 2006-01-20  Henrik Enberg  <enberg@printf.se>
 
-       * rmailsum.el (rmail-summary-get-summary): Make sure sender is no
+       * rmailsum.el (rmail-summary-get-sender): New function.
+       (rmail-summary-get-summary): Use it.  Make sure sender is no
        longer than 25 characters.
+       (rmail-summary-get-line-count): Doc fix.
+       (rmail-summary-get-summary-attributes): Likewise.
 
        * rmailmsc.el (set-rmail-inbox-list): Rewrite to only set inbox
        list temporarily for a session.
index d9dbce0f7138aebe4768cc15fe4557919c57dd90..7c9625efe992aaf51e851114492acc7e2f4d47c3 100644 (file)
@@ -1474,10 +1474,34 @@ KEYWORDS is a comma-separated list of labels."
               (funcall sortfun reverse))
       (select-window selwin))))
 
+(defun rmail-summary-get-sender (n)
+  "Return the sender for message N.
+If sender is matches `rmail-user-mail-address-regexp' or
+`user-mail-address', return the to-address instead."
+  (let ((sender (rmail-desc-get-sender n)))
+    (if (or (null sender)
+           (string-match
+            (or rmail-user-mail-address-regexp
+                (concat "^\\("
+                        (regexp-quote (user-login-name))
+                        "\\($\\|@\\)\\|"
+                        (regexp-quote
+                         ;; Don't lose if run from init file where
+                         ;; user-mail-address is not set yet.
+                         (or user-mail-address
+                             (concat (user-login-name) "@"
+                                     (or mail-host-address
+                                         (system-name)))))
+                        "\\>\\)"))
+            sender))
+       ;; Either no sender known, or it's this user.
+       (let ((to (rmail-header-get-header "to")))
+         (concat "to: " (mail-strip-quoted-names to)))
+      sender)))
+
 (defun rmail-summary-get-line-count (n)
-  "Return a string containing the count of lines in message N for the
-  summary buffer if the User has enabled line counts, otherwise return
-  an empty string."
+  "Return a string containing the number of lines in message N.
+If `rmail-summary-line-count-flag' is nil, return the empty string."
   (if rmail-summary-line-count-flag
       (let ((lines (rmail-desc-get-line-count n)))
        (format (cond ((<= lines     9) "   [%d]")
@@ -1488,9 +1512,8 @@ KEYWORDS is a comma-separated list of labels."
     ""))
 
 (defun rmail-summary-get-summary-attributes (n)
-  "Return the attribute character codes to use in the summary buffer
-  for message N: `-' for an unseen message, `D' for a message marked
-  for deletion."
+  "Return the attribute character codes for message N.
+`-' means an unseen message, `D' means marked for deletion."
   (format "%s%s%s%s%s"
           (cond ((rmail-desc-attr-p rmail-desc-unseen-index n) "-")
                 ((rmail-desc-attr-p rmail-desc-deleted-index n) "D")
@@ -1519,7 +1542,7 @@ KEYWORDS is a comma-separated list of labels."
                     (rmail-summary-get-summary-attributes n)
                     (concat (rmail-desc-get-day-number n) "-"
                             (rmail-desc-get-month n))
-                    (rmail-desc-get-sender n)
+                    (rmail-summary-get-sender n)
                     (rmail-summary-get-line-count n)
                     (concat str subj)))))