changeset 101724:b87c9a6e8490

(rmail-edit-map): Move init into declaration. (rmail-edit-mode, rmail-cease-edit): Use with-current-buffer.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 01 Feb 2009 03:26:17 +0000
parents b7a685cd1bc0
children 9e2e923d8eb3
files lisp/ChangeLog lisp/mail/rmailedit.el
diffstat 2 files changed, 19 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Jan 31 23:26:35 2009 +0000
+++ b/lisp/ChangeLog	Sun Feb 01 03:26:17 2009 +0000
@@ -1,3 +1,8 @@
+2009-02-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* mail/rmailedit.el (rmail-edit-map): Move init into declaration.
+	(rmail-edit-mode, rmail-cease-edit): Use with-current-buffer.
+
 2009-01-31  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* mouse.el (mouse-drag-mode-line-1): Obey mouse-1-click-follows-link.
--- a/lisp/mail/rmailedit.el	Sat Jan 31 23:26:35 2009 +0000
+++ b/lisp/mail/rmailedit.el	Sun Feb 01 03:26:17 2009 +0000
@@ -37,14 +37,14 @@
 
 (defvar rmail-old-text)
 
-(defvar rmail-edit-map nil)
-(if rmail-edit-map
-    nil
-  ;; Make a keymap that inherits text-mode-map.
-  (setq rmail-edit-map (make-sparse-keymap))
-  (set-keymap-parent rmail-edit-map text-mode-map)
-  (define-key rmail-edit-map "\C-c\C-c" 'rmail-cease-edit)
-  (define-key rmail-edit-map "\C-c\C-]" 'rmail-abort-edit))
+(defvar rmail-edit-map
+  (let ((map (make-sparse-keymap)))
+    ;; Make a keymap that inherits text-mode-map.
+    (set-keymap-parent map text-mode-map)
+    (define-key map "\C-c\C-c" 'rmail-cease-edit)
+    (define-key map "\C-c\C-]" 'rmail-abort-edit)
+    map))
+
 
 ;; Rmail Edit mode is suitable only for specially formatted data.
 (put 'rmail-edit-mode 'mode-class 'special)
@@ -62,11 +62,10 @@
 This functions runs the normal hook `rmail-edit-mode-hook'.
 \\{rmail-edit-map}"
   (if (rmail-summary-exists)
-      (save-excursion
-	(set-buffer rmail-summary-buffer)
+      (with-current-buffer rmail-summary-buffer
 	(rmail-summary-disable)))
-  (let (rmail-buffer-swapped)
-    ;; Prevent change-major-mode-hook from unswapping the buffers.
+  (let ((rmail-buffer-swapped nil)) ; Prevent change-major-mode-hook
+                                    ; from unswapping the buffers.
     (delay-mode-hooks (text-mode))
     (use-local-map rmail-edit-map)
     (setq major-mode 'rmail-edit-mode)
@@ -105,8 +104,7 @@
   "Finish editing message; switch back to Rmail proper."
   (interactive)
   (if (rmail-summary-exists)
-      (save-excursion
-	(set-buffer rmail-summary-buffer)
+      (with-current-buffer rmail-summary-buffer
 	(rmail-summary-enable)))
   (widen)
   ;; Disguise any "From " lines so they don't start a new message.
@@ -129,7 +127,8 @@
 	headers-end)
     ;; Go back to Rmail mode, but carefully.
     (force-mode-line-update)
-    (let (rmail-buffer-swapped)
+    (let ((rmail-buffer-swapped nil)) ; Prevent change-major-mode-hook
+                                      ; from unswapping the buffers.
       (kill-all-local-variables)
       (rmail-mode-1)
       (if (boundp 'tool-bar-map)