emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs/lisp/mail rmail.el
Date: Sat, 31 Jan 2009 13:31:45 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Eli Zaretskii <eliz>    09/01/31 13:31:45

Modified files:
        lisp/mail      : rmail.el 

Log message:
        (rmail-automatic-folder-directives, rmail): Doc fixes.
        (rmail-swap-buffers): New function.
        (rmail-change-major-mode-hook, rmail-swap-buffers-maybe, 
rmail-show-message):
        Use rmail-swap-buffers.
        (rmail-decode-region): If DESTINATION is a buffer, set the encoding of 
that
        buffer, rather than the current buffer.
        (rmail-show-message): Make error message about uuencoded mail more 
explicit.
        (rmail-show-message-maybe): Simplify code.  Doc fix.
        (rmail-show-message): Doc fix.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/mail/rmail.el?cvsroot=emacs&r1=1.486&r2=1.487

Patches:
Index: rmail.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mail/rmail.el,v
retrieving revision 1.486
retrieving revision 1.487
diff -u -b -r1.486 -r1.487
--- rmail.el    31 Jan 2009 10:08:37 -0000      1.486
+++ rmail.el    31 Jan 2009 13:31:45 -0000      1.487
@@ -480,8 +480,8 @@
 
   (FOLDERNAME FIELD REGEXP [ FIELD REGEXP ] ... )
 
-Where FOLDERNAME is the name of a BABYL format folder to put the
-message.  If any of the field regexp's are nil, then it is ignored.
+Where FOLDERNAME is the name of a folder to put the message.
+If any of the field regexp's are nil, then it is ignored.
 
 If FOLDERNAME is \"/dev/null\", it is deleted.
 If FOLDERNAME is nil then it is deleted, and skipped.
@@ -811,8 +811,8 @@
 ;;;###autoload
 (defun rmail (&optional file-name-arg)
   "Read and edit incoming mail.
-Moves messages into file named by `rmail-file-name' (a babyl format file)
- and edits that file in RMAIL Mode.
+Moves messages into file named by `rmail-file-name' and edits that
+file in RMAIL Mode.
 Type \\[describe-mode] once editing that file, for a list of RMAIL commands.
 
 May be called with file name as argument; then performs rmail editing on
@@ -1260,13 +1260,18 @@
     (or buf
        (generate-new-buffer name))))
 
-(defun rmail-change-major-mode-hook ()
-  ;; Bring the actual Rmail messages back into the main buffer.
-  (when (rmail-buffers-swapped-p)
-    (setq rmail-buffer-swapped nil)
-    (let ((modp (buffer-modified-p)))
+(defun rmail-swap-buffers ()
+  "Swap text between current buffer and `rmail-view-buffer'.
+This function preserves the current buffer's modified flag, and also
+sets the current buffer's `buffer-file-coding-system' to that of
+`rmail-view-buffer'."
+  (let ((modp (buffer-modified-p))
+       (coding
+        (with-current-buffer rmail-view-buffer
+          buffer-file-coding-system)))
       (buffer-swap-text rmail-view-buffer)
-      (set-buffer-modified-p modp))))
+    (setq buffer-file-coding-system coding)
+    (set-buffer-modified-p modp)))
 
 (defun rmail-buffers-swapped-p ()
   "Return non-nil if the message collection is in `rmail-view-buffer'."
@@ -1274,14 +1279,18 @@
   (and (buffer-live-p rmail-view-buffer)
        rmail-buffer-swapped))
 
+(defun rmail-change-major-mode-hook ()
+  ;; Bring the actual Rmail messages back into the main buffer.
+  (when (rmail-buffers-swapped-p)
+    (rmail-swap-buffers)
+    (setq rmail-buffer-swapped nil)))
+
 (defun rmail-swap-buffers-maybe ()
   "Determine if the Rmail buffer is showing a message.
 If so restore the actual mbox message collection."
   (with-current-buffer rmail-buffer
     (when (rmail-buffers-swapped-p)
-      (let ((modp (buffer-modified-p)))
-       (buffer-swap-text rmail-view-buffer)
-       (set-buffer-modified-p modp))
+      (rmail-swap-buffers)
       (setq rmail-buffer-swapped nil))))
 
 (defun rmail-mode-kill-buffer-hook ()
@@ -1909,9 +1918,16 @@
    from to (coding-system-change-eol-conversion coding 1) destination)
   ;; Don't reveal the fact we used -dos decoding, as users generally
   ;; will not expect the RMAIL buffer to use DOS EOL format.
+  (cond
+   ((null destination)
   (setq buffer-file-coding-system
        (setq last-coding-system-used
              (coding-system-change-eol-conversion coding 0))))
+   ((bufferp destination)
+    (with-current-buffer destination
+      (setq buffer-file-coding-system
+           (setq last-coding-system-used
+                 (coding-system-change-eol-conversion coding 0)))))))
 
 (defun rmail-add-mbox-headers ()
   "Validate the RFC2822 format for the new messages.
@@ -2441,31 +2457,31 @@
 
 (defun rmail-show-message-maybe (&optional n no-summary)
   "Show message number N (prefix argument), counting from start of file.
-If summary buffer is currently displayed, update current message there also."
+If summary buffer is currently displayed, update current message there also.
+N defaults to the current message."
   (interactive "p")
   (or (eq major-mode 'rmail-mode)
       (switch-to-buffer rmail-buffer))
   (rmail-swap-buffers-maybe)
   (rmail-maybe-set-message-counters)
   (widen)
-  (let ((msgnum (or n rmail-current-message))
-       (blurb (rmail-no-mail-p)))
-    (unless blurb
-      (setq blurb (rmail-show-message msgnum))
+  (let ((blurb (rmail-show-message n)))
+    (or (zerop rmail-total-messages)
+       (progn
       (when mail-mailing-lists
        (rmail-unknown-mail-followup-to))
       (if transient-mark-mode (deactivate-mark))
       ;; If there is a summary buffer, try to move to this message
-      ;; in that buffer.  But don't complain if this message
-      ;; is not mentioned in the summary.
-      ;; Don't do this at all if we were called on behalf
-      ;; of cursor motion in the summary buffer.
+         ;; in that buffer.  But don't complain if this message is
+         ;; not mentioned in the summary.  Don't do this at all if we
+         ;; were called on behalf of cursor motion in the summary
+         ;; buffer.
       (and (rmail-summary-exists) (not no-summary)
           (let ((curr-msg rmail-current-message))
             (rmail-select-summary
              (rmail-summary-goto-msg curr-msg t t))))
       (with-current-buffer rmail-buffer
-       (rmail-auto-file)))
+           (rmail-auto-file))))
     (if blurb
        (message blurb))))
 
@@ -2481,7 +2497,7 @@
          (string-match text-regexp content-type-header)))))
 
 (defun rmail-show-message (&optional msg)
-  "Show message MSG using a special view buffer.
+  "Show message MSG (default: current message) using `rmail-view-buffer'.
 Return text to display in the minibuffer if MSG is out of
 range (displaying a reasonable choice as well), nil otherwise.
 The current mail message becomes the message displayed."
@@ -2543,7 +2559,7 @@
             ((and (string= character-coding "base64") is-text-message)
              (base64-decode-region (point-min) (point-max)))
             ((eq character-coding 'uuencode)
-             (error "Not supported yet"))
+             (error "uuencoded messages are not supported yet"))
             (t))
            (rmail-decode-region (point-min) (point-max)
                                 coding-system view-buf)))
@@ -2570,9 +2586,7 @@
        ;; Update the mode-line with message status information and swap
        ;; the view buffer/mail buffer contents.
        (rmail-display-labels)
-       (let ((modp (buffer-modified-p)))
-         (buffer-swap-text rmail-view-buffer)
-         (set-buffer-modified-p modp))
+       (rmail-swap-buffers)
        (setq rmail-buffer-swapped t)
        (run-hooks 'rmail-show-message-hook)))
     blurb))




reply via email to

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