]> git.eshelyaron.com Git - emacs.git/commitdiff
(rmail-edit-map): Move init into declaration.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 1 Feb 2009 03:26:17 +0000 (03:26 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 1 Feb 2009 03:26:17 +0000 (03:26 +0000)
(rmail-edit-mode, rmail-cease-edit): Use with-current-buffer.

lisp/ChangeLog
lisp/mail/rmailedit.el

index 959d1fb246bea88f0c24d431c0c20ac1ee15f62f..bd6da5daa157c0da3518de863d4f63f9e6ad4884 100644 (file)
@@ -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.
index 8aeacfb83967f3b80132e54013501423151c1afc..86ffdc9d2f67cda08e694910a6dab05edd08d948 100644 (file)
 
 (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 @@ to return to regular RMAIL:
 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 @@ This functions runs the normal hook `rmail-edit-mode-hook'.
   "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 @@ This functions runs the normal hook `rmail-edit-mode-hook'.
        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)