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: Richard M. Stallman
Subject: [Emacs-diffs] emacs/lisp/mail pmail.el
Date: Mon, 22 Dec 2008 19:54:59 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       08/12/22 19:54:59

Modified files:
        lisp/mail      : pmail.el 

Log message:
        (pmail-swap-buffers-maybe): Variable deleted.
        All uses call the function instead.
        
        (pmail-save): Function deleted.
        (pmail-mode-map): Don't bind C-x C-s.
        (pmail-mode-1): Don't set up write-region-annotate-functions.
        (pmail-write-region-annotate): Function deleted.
        (pmail-change-major-mode-hook): Set buffer-swapped-with.
        (pmail-use-collection-buffer): Likewise.
        (pmail-show-message): Likewise.
        
        (pmail-swap-buffers-maybe): Go to pmail-buffer before
        testing anything.
        (pmail): Call pmail-swap-buffers-maybe only if already in Pmail mode.

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

Patches:
Index: pmail.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mail/pmail.el,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- pmail.el    22 Dec 2008 00:05:51 -0000      1.37
+++ pmail.el    22 Dec 2008 19:54:59 -0000      1.38
@@ -92,11 +92,6 @@
 (defvar total-messages)
 (defvar tool-bar-map)
 
-(defvar pmail-buffers-swapped-p nil
-  "A flag that is non-nil when the message view buffer and the
- message collection buffer are swapped, i.e. the Pmail buffer
- contains a single decoded message.")
-
 (defvar pmail-header-style 'normal
   "The current header display style choice, one of
 'normal (selected headers) or 'full (all headers).")
@@ -872,7 +867,8 @@
         (find-file-noselect file-name))))
     ;; Insure that the collection and view buffers are in sync and
     ;; insure that a message is not being edited.
-    (pmail-swap-buffers-maybe)
+    (if (eq major-mode 'pmail-mode)
+       (pmail-swap-buffers-maybe))
     (if (eq major-mode 'pmail-edit-mode)
        (error "Exit Pmail Edit mode before getting new mail"))
     (or (and existed (> (buffer-size) 0))
@@ -1000,7 +996,6 @@
 ;; I find I can't live without the default M-r command -- rms.
 ;;  (define-key pmail-mode-map "\er"  'pmail-search-backwards)
   (define-key pmail-mode-map "s"      'pmail-expunge-and-save)
-  (define-key pmail-mode-map "\C-x\C-s" 'pmail-save)
   (define-key pmail-mode-map "\es"    'pmail-search)
   (define-key pmail-mode-map "t"      'pmail-toggle-header)
   (define-key pmail-mode-map "u"      'pmail-undelete-previous-message)
@@ -1267,7 +1262,6 @@
   (set-syntax-table text-mode-syntax-table)
   (setq local-abbrev-table text-mode-abbrev-table)
   ;; First attempt at adding hook functions to support buffer swapping...
-  (add-hook 'write-region-annotate-functions 'pmail-write-region-annotate nil 
t)
   (add-hook 'kill-buffer-hook 'pmail-mode-kill-buffer-hook nil t)
   (add-hook 'change-major-mode-hook 'pmail-change-major-mode-hook nil t))
 
@@ -1280,22 +1274,10 @@
     (unless buf
       (generate-new-buffer name))))
 
-;; Used in write-region-annotate-functions to write Pmail files out
-;; correctly.
-(defun pmail-write-region-annotate (start end)
-  ;; When called from write-file (and auto-save), `start' is nil.
-  ;; When called from M-x write-region, we assume the user wants to save
-  ;; (part of) the inbox, not the message display data.
-  (unless (or start (not pmail-buffers-swapped-p))
-    ;;(tar-clear-modification-flags)
-    (set-buffer pmail-view-buffer)
-    (widen)
-    nil))
-
 (defun pmail-change-major-mode-hook ()
   ;; Bring the actual Pmail messages back into the main buffer.
   (when (pmail-buffers-swapped-p)
-    (current-buffer)
+    (setq buffer-swapped-with nil)
     (buffer-swap-text pmail-view-buffer)))
   ;; Throw away the summary.
   ;;(when (buffer-live-p pmail-view-buffer) (kill-buffer pmail-view-buffer)))
@@ -1347,7 +1329,6 @@
                                   (user-login-name)))))))
   (make-local-variable 'pmail-keywords)
   (set (make-local-variable 'tool-bar-map) pmail-tool-bar-map)
-  (make-local-variable 'pmail-buffers-swapped-p)
   ;; this gets generated as needed
   (setq pmail-keywords nil))
 
@@ -1420,16 +1401,6 @@
       (pmail-select-summary (set-buffer-modified-p nil))
     (pmail-show-message)))
 
-(defun pmail-save ()
-  "Save the PMAIL file."
-  (interactive)
-  (set-buffer pmail-buffer)
-  (pmail-swap-buffers-maybe)
-  (save-buffer)
-  (if (pmail-summary-exists)
-      (pmail-select-summary (set-buffer-modified-p nil))
-    (pmail-show-message)))
-
 (defun pmail-quit ()
   "Quit out of PMAIL.
 Hook `pmail-quit-hook' is run after expunging."
@@ -2231,9 +2202,9 @@
 swapped state, i.e. it currently contains a single decoded
 message rather than an entire message collection, nil otherwise."
   (let (result)
-    (when pmail-buffers-swapped-p
+    (when (pmail-buffers-swapped-p)
       (buffer-swap-text pmail-view-buffer)
-      (setq pmail-buffers-swapped-p nil
+      (setq buffer-swapped-with nil
            result pmail-current-message))
     result))
 
@@ -2243,7 +2214,7 @@
 display it.  Return nil."
   (let (result)
     (cond
-     ((not pmail-buffers-swapped-p)
+     ((not (pmail-buffers-swapped-p))
       (let ((message (or msgnum pmail-current-message)))
        (pmail-show-message message)))
      ((and msgnum (/= msgnum pmail-current-message))
@@ -2461,10 +2432,10 @@
 (defun pmail-swap-buffers-maybe ()
   "Determine if the Pmail buffer is showing a message.
 If so restore the actual mbox message collection."
-  (when pmail-buffers-swapped-p
     (with-current-buffer pmail-buffer
+    (when (pmail-buffers-swapped-p)
       (buffer-swap-text pmail-view-buffer)
-      (setq pmail-buffers-swapped-p nil))))
+      (setq buffer-swapped-with nil))))
 
 (defun pmail-show-message-maybe (&optional n no-summary)
   "Show message number N (prefix argument), counting from start of file.
@@ -2583,7 +2554,7 @@
       ;; the view buffer/mail buffer contents.
       (pmail-display-labels)
       (buffer-swap-text pmail-view-buffer)
-      (setq pmail-buffers-swapped-p t)
+      (setq buffer-swapped-with pmail-view-buffer)
       (run-hooks 'pmail-show-message-hook))
     blurb))
 
@@ -2818,7 +2789,7 @@
   (let ((orig-message pmail-current-message)
        (msg pmail-current-message)
        (reversep (< n 0))
-       (opoint (if pmail-buffers-swapped-p (point)))
+       (opoint (if (pmail-buffers-swapped-p) (point)))
        found)
     (pmail-swap-buffers-maybe)
     (pmail-maybe-set-message-counters)
@@ -3150,7 +3121,7 @@
   (when (pmail-expunge-confirmed)
     (let ((old-total pmail-total-messages)
          (opoint (with-current-buffer pmail-buffer
-                   (when pmail-buffers-swapped-p
+                   (when (pmail-buffers-swapped-p)
                      (point)))))
       (pmail-only-expunge dont-show)
       (if (pmail-summary-exists)
@@ -3209,7 +3180,7 @@
     (save-excursion
       (save-restriction
        (widen)
-       (if pmail-buffers-swapped-p
+       (if (pmail-buffers-swapped-p)
            (narrow-to-region
             (goto-char (point-min))
             (search-forward "\n\n" nil 'move))




reply via email to

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