emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp/mail pmail.el


From: Chong Yidong
Subject: [Emacs-diffs] emacs/lisp/mail pmail.el
Date: Sat, 20 Dec 2008 04:07:07 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      08/12/20 04:07:07

Modified files:
        lisp/mail      : pmail.el 

Log message:
        (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
        (pmail-get-new-mail-1): Adjust restriction after calling
        pmail-insert-inbox-text.
        (pmail-add-mbox-headers): Use save-restriction.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/mail/pmail.el?cvsroot=emacs&r1=1.32&r2=1.33

Patches:
Index: pmail.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/mail/pmail.el,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- pmail.el    15 Dec 2008 15:40:53 -0000      1.32
+++ pmail.el    20 Dec 2008 04:07:07 -0000      1.33
@@ -1581,6 +1581,7 @@
   (or (verify-visited-file-modtime (current-buffer))
       (find-file (buffer-file-name)))
   (set-buffer pmail-buffer)
+  (pmail-swap-buffers-maybe)
   (pmail-maybe-set-message-counters)
   (widen)
   ;; Get rid of all undo records for this buffer.
@@ -1626,7 +1627,8 @@
       (let ((new-messages 0)
            (spam-filter-p (and (featurep 'rmail-spam-filter)
                                pmail-use-spam-filter))
-           blurb result success suffix)
+           (blurb "")
+           result success suffix)
        (narrow-to-region (point) (point))
        ;; Read in the contents of the inbox files, renaming them as
        ;; necessary, and adding to the list of files to delete
@@ -1637,6 +1639,8 @@
        ;; Scan the new text and convert each message to
        ;; Pmail/mbox format.
        (goto-char (point-min))
+       (skip-chars-forward " \n")
+       (narrow-to-region (point) (point-max))
        (unwind-protect
            (setq new-messages (pmail-add-mbox-headers)
                  success t)
@@ -1953,6 +1957,7 @@
 Unless an Rmail attribute header already exists, add it to the
 new messages.  Return the number of new messages."
   (save-excursion
+    (save-restriction
     (let ((count 0)
          (start (point))
          (value "------U")
@@ -1976,7 +1981,7 @@
          (if (search-forward "\n\nFrom " nil 'move)
              (forward-char -5))
          (setq start (point))))
-      count)))
+       count))))
 
 ;;;; *** Pmail Message Formatting and Header Manipulation ***
 
@@ -2282,7 +2287,8 @@
       (pmail-set-message-counters)))
 
 (defun pmail-count-new-messages (&optional nomsg)
-  "Count the number of new messages in the region.
+  "Count the number of new messages.
+The buffer should be narrowed to include only the new messages.
 Output a helpful message unless NOMSG is non-nil."
   (let* ((case-fold-search nil)
         (total-messages 0)
@@ -2376,10 +2382,10 @@
     (while (search-backward "\n\nFrom " stop t)
       (forward-char 2)
       (pmail-collect-deleted start)
-      ;; Show progress after every 20 messages or so.
       (setq messages-head (cons (point-marker) messages-head)
            total-messages (1+ total-messages)
            start (point))
+      ;; Show progress after every 20 messages or so.
       (if (zerop (% total-messages 20))
          (message "Counting messages...%d" total-messages)))
     ;; Handle the first message, maybe.




reply via email to

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