emacs-devel
[Top][All Lists]
Advanced

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

Re: RMAIL, rmail-mbox-branch


From: Alexander Pohoyda
Subject: Re: RMAIL, rmail-mbox-branch
Date: 26 Nov 2003 23:44:40 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Richard Stallman <address@hidden> writes:

>     1) If RMAIL file does not exist, rmail-display-labels function
>        fails deep inside rmaildesc.el and I dont see a reason to
>        display labels if there are no messages. 
> 
> If nothing is done, will the labels from the previously displayed
> message hang around in the modeline?  If so, we should fix
> rmail-display-labels so it does the right thing when there is no
> message.  If not, your fix seems right.  Which one is it?

You were right: we need to clean the modeline after deleting the last
message. Fixed.


>     2) rmail-use-spam-filter is void variable, used in
>        rmail-get-new-mail function. It is defined in
>        rmail-spam-filter.el, but we cannot (require
>        'rmail-spam-filter) before the rmail-mode-map variable is
>        defined further in rmail.el file.
> 
> How about doing the require at a place such as the function `rmail'
> so that we know rmail-mode-map is already set up?

This approach worked. Fixed.


Other notes:
1) mail-utils is required for mail-strip-quoted-names function;
2) I changed the label separator in the modeline from " " (just
   space) to ", " (comma followed by space), which looks better, I
   believe;
3) if a message has no labels (the result variable is an empty
   string), there is no need to append a space in the end:
       orig (RMAIL 1/1 ) vs. new (RMAIL 1/1)
4) if there are labels, separate them with a semicolon:
       orig (RMAIL 1/1 deleted label2) vs. new
       new (RMAIL 1/1; deleted, label2)
5) if the last message is deleted or the RMAIL file is empty,
   display (RMAIL no messages) in the modeline;
6) the change in rmailsum.el should have been applied already, but
   is, obviously, not.


Please consider the following patch.

Index: rmail.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mail/rmail.el,v
retrieving revision 1.368.2.5
diff -u -r1.368.2.5 rmail.el
--- rmail.el    23 Feb 2003 00:33:25 -0000      1.368.2.5
+++ rmail.el    26 Nov 2003 22:21:37 -0000
@@ -49,6 +49,7 @@
 
 (eval-and-compile
   (require 'browse-url)
+  (require 'mail-utils)
   (require 'rmaildesc)
   (require 'rmailhdr))
 
@@ -645,6 +646,7 @@
 If `rmail-display-summary' is non-nil, make a summary for this RMAIL file."
   (interactive (if current-prefix-arg
                   (list (read-file-name "Run rmail on RMAIL file: "))))
+  (require 'rmail-spam-filter)
   (rmail-require-mime-maybe)
   (let* ((file-name (expand-file-name (or file-name-arg rmail-file-name)))
         ;; Use find-buffer-visiting, not get-file-buffer, for those users
@@ -2126,13 +2128,14 @@
         (setq keyword-list (rmail-desc-get-keywords rmail-current-message)))
 
     ;; Generate the result string.
-    (setq result (mapconcat '(lambda (arg) arg) keyword-list " "))
+    (setq result (mapconcat '(lambda (arg) arg) keyword-list ", "))
 
     ;; Update the mode line to display the keywords, the current
     ;; message index and the total number of messages.
     (setq mode-line-process
-         (format " %d/%d %s"
-                 rmail-current-message rmail-total-messages result))
+         (concat (format " %d/%d" rmail-current-message rmail-total-messages)
+                 (unless (string-equal result "")
+                   (concat "; " result))))
 
     ;; If rmail-enable-mime is non-nil, we may have to update
     ;; `mode-line-process' of rmail-view-buffer too.
@@ -2458,7 +2461,7 @@
       ;; out of the Rmail file so as not to break other mail agents.
       (progn
         (message "No messages to show.  Add something better soon.")
-        (rmail-display-labels)
+        (setq mode-line-process " no messages")
         (force-mode-line-update))
 
     ;; There are messages.  Show one.
Index: rmailsum.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mail/rmailsum.el,v
retrieving revision 1.127.2.2
diff -u -r1.127.2.2 rmailsum.el
--- rmailsum.el 18 Feb 2003 16:47:23 -0000      1.127.2.2
+++ rmailsum.el 26 Nov 2003 22:21:38 -0000
@@ -1081,7 +1081,8 @@
       (if (< n 1)
          (progn (message "No preceding message")
                 (setq n 1)))
-      (if (> n total)
+      (if (and (> n total)
+              (> total 0))
          (progn (message "No following message")
                 (goto-char (point-max))
                 (rmail-summary-goto-msg nil nowarn skip-rmail)))


-- 
Alexander Pohoyda <address@hidden>
PGP Key fingerprint: 7F C9 CC 5A 75 CD 89 72  15 54 5F 62 20 23 C6 44




reply via email to

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