From 2dc00ad0c32453ea4d5573ebac7ab041f54330fd Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 1 Feb 2009 03:39:37 +0000 Subject: [PATCH] (rmail-view-buffer): Make buffer-local. (rmail-select-summary, rmail-perm-variables, rmail-redecode-body) (rmail-undelete-previous-message, rmail-mark-message) (rmail-speedbar-buttons): Use with-current-buffer. (rmail-mode-map): Move initialization into declaration. (rmail-swap-buffers, rmail-unfontify-buffer-function) (rmail-fontify-message): Use restore-buffer-modified-p. (rmail-expunge-and-save): Don't swap buffer. (rmail-get-header, rmail-set-header, rmail-set-attribute) (rmail-apply-in-message): Swap save-excursion and save-restriction. --- lisp/ChangeLog | 11 ++ lisp/mail/rmail.el | 341 ++++++++++++++++++++++----------------------- 2 files changed, 179 insertions(+), 173 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9188230e6f7..020cc4e71cb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,16 @@ 2009-02-01 Stefan Monnier + * mail/rmail.el (rmail-view-buffer): Make buffer-local. + (rmail-select-summary, rmail-perm-variables, rmail-redecode-body) + (rmail-undelete-previous-message, rmail-mark-message) + (rmail-speedbar-buttons): Use with-current-buffer. + (rmail-mode-map): Move initialization into declaration. + (rmail-swap-buffers, rmail-unfontify-buffer-function) + (rmail-fontify-message): Use restore-buffer-modified-p. + (rmail-expunge-and-save): Don't swap buffer. + (rmail-get-header, rmail-set-header, rmail-set-attribute) + (rmail-apply-in-message): Swap save-excursion and save-restriction. + * mail/rmailsort.el (rmail-sort-messages): Use car-less-than-car if possible. diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index b2bd29c1991..3966c0edac3 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -563,6 +563,7 @@ by substituting the new message number into the existing list.") (defvar rmail-view-buffer nil "Buffer which holds RMAIL message for MIME displaying.") +(make-variable-buffer-local 'rmail-view-buffer) (put 'rmail-view-buffer 'permanent-local t) ;; `Sticky' default variables. @@ -675,10 +676,6 @@ the variable `rmail-mime-feature'.") The first parenthesized expression should match the MIME-charset name.") -;;; Regexp matching the delimiter of messages in UNIX mail format -;;; (UNIX From lines), minus the initial ^. Note that if you change -;;; this expression, you must change the code in rmail-nuke-pinhead-header -;;; that knows the exact ordering of the \\( \\) subexpressions. (defvar rmail-unix-mail-delimiter (let ((time-zone-regexp (concat "\\([A-Z]?[A-Z]?[A-Z][A-Z]\\( DST\\)?" @@ -729,7 +726,10 @@ The first parenthesized expression should match the MIME-charset name.") "\\(remote from .*\\)?" "\n")) - nil) + "Regexp matching the delimiter of messages in UNIX mail format +\(UNIX From lines), minus the initial ^. Note that if you change +this expression, you must change the code in rmail-nuke-pinhead-header +that knows the exact ordering of the \\( \\) subexpressions.") (defvar rmail-font-lock-keywords ;; These are all matched case-insensitively. @@ -774,8 +774,7 @@ The first parenthesized expression should match the MIME-charset name.") (let ((rmail-total-messages total)) ,@body)) (select-window window)))) - (save-excursion - (set-buffer rmail-summary-buffer) + (with-current-buffer rmail-summary-buffer (let ((rmail-total-messages total)) ,@body))) (rmail-maybe-display-summary))) @@ -843,15 +842,15 @@ If `rmail-display-summary' is non-nil, make a summary for this RMAIL file." (switch-to-buffer (let ((enable-local-variables nil)) (find-file-noselect file-name)))) - ;; Insure that the collection and view buffers are in sync and - ;; insure that a message is not being edited. + ;; Ensure that the collection and view buffers are in sync and + ;; ensure that a message is not being edited. (if (eq major-mode 'rmail-mode) (rmail-swap-buffers-maybe)) (if (eq major-mode 'rmail-edit-mode) (error "Exit Rmail Edit mode before getting new mail")) (or (and existed (> (buffer-size) 0)) (setq run-mail-hook t)) - ;; Insure that the Rmail file is in mbox format, the buffer is in + ;; Ensure that the Rmail file is in mbox format, the buffer is in ;; Rmail mode and has been scanned to find all the messages ;; (setting the global message variables in the process). (rmail-convert-file-maybe) @@ -942,183 +941,183 @@ The buffer is expected to be narrowed to just the header of the message." ;;; Set up Rmail mode keymaps -(defvar rmail-mode-map nil) -(if rmail-mode-map - nil - (setq rmail-mode-map (make-keymap)) - (suppress-keymap rmail-mode-map) - (define-key rmail-mode-map "a" 'rmail-add-label) - (define-key rmail-mode-map "b" 'rmail-bury) - (define-key rmail-mode-map "c" 'rmail-continue) - (define-key rmail-mode-map "d" 'rmail-delete-forward) - (define-key rmail-mode-map "\C-d" 'rmail-delete-backward) - (define-key rmail-mode-map "e" 'rmail-edit-current-message) - (define-key rmail-mode-map "f" 'rmail-forward) - (define-key rmail-mode-map "g" 'rmail-get-new-mail) - (define-key rmail-mode-map "h" 'rmail-summary) - (define-key rmail-mode-map "i" 'rmail-input) - (define-key rmail-mode-map "j" 'rmail-show-message-maybe) - (define-key rmail-mode-map "k" 'rmail-kill-label) - (define-key rmail-mode-map "l" 'rmail-summary-by-labels) - (define-key rmail-mode-map "\e\C-h" 'rmail-summary) - (define-key rmail-mode-map "\e\C-l" 'rmail-summary-by-labels) - (define-key rmail-mode-map "\e\C-r" 'rmail-summary-by-recipients) - (define-key rmail-mode-map "\e\C-s" 'rmail-summary-by-regexp) - (define-key rmail-mode-map "\e\C-t" 'rmail-summary-by-topic) - (define-key rmail-mode-map "m" 'rmail-mail) - (define-key rmail-mode-map "\em" 'rmail-retry-failure) - (define-key rmail-mode-map "n" 'rmail-next-undeleted-message) - (define-key rmail-mode-map "\en" 'rmail-next-message) - (define-key rmail-mode-map "\e\C-n" 'rmail-next-labeled-message) - (define-key rmail-mode-map "o" 'rmail-output) - (define-key rmail-mode-map "\C-o" 'rmail-output-as-seen) - (define-key rmail-mode-map "p" 'rmail-previous-undeleted-message) - (define-key rmail-mode-map "\ep" 'rmail-previous-message) - (define-key rmail-mode-map "\e\C-p" 'rmail-previous-labeled-message) - (define-key rmail-mode-map "q" 'rmail-quit) - (define-key rmail-mode-map "r" 'rmail-reply) -;; I find I can't live without the default M-r command -- rms. -;; (define-key rmail-mode-map "\er" 'rmail-search-backwards) - (define-key rmail-mode-map "s" 'rmail-expunge-and-save) - (define-key rmail-mode-map "\es" 'rmail-search) - (define-key rmail-mode-map "t" 'rmail-toggle-header) - (define-key rmail-mode-map "u" 'rmail-undelete-previous-message) - (define-key rmail-mode-map "w" 'rmail-output-body-to-file) - (define-key rmail-mode-map "\C-c\C-w" 'rmail-widen) - (define-key rmail-mode-map "x" 'rmail-expunge) - (define-key rmail-mode-map "." 'rmail-beginning-of-message) - (define-key rmail-mode-map "/" 'rmail-end-of-message) - (define-key rmail-mode-map "<" 'rmail-first-message) - (define-key rmail-mode-map ">" 'rmail-last-message) - (define-key rmail-mode-map " " 'scroll-up) - (define-key rmail-mode-map "\177" 'scroll-down) - (define-key rmail-mode-map "?" 'describe-mode) - (define-key rmail-mode-map "\C-c\C-s\C-d" 'rmail-sort-by-date) - (define-key rmail-mode-map "\C-c\C-s\C-s" 'rmail-sort-by-subject) - (define-key rmail-mode-map "\C-c\C-s\C-a" 'rmail-sort-by-author) - (define-key rmail-mode-map "\C-c\C-s\C-r" 'rmail-sort-by-recipient) - (define-key rmail-mode-map "\C-c\C-s\C-c" 'rmail-sort-by-correspondent) - (define-key rmail-mode-map "\C-c\C-s\C-l" 'rmail-sort-by-lines) - (define-key rmail-mode-map "\C-c\C-s\C-k" 'rmail-sort-by-labels) - (define-key rmail-mode-map "\C-c\C-n" 'rmail-next-same-subject) - (define-key rmail-mode-map "\C-c\C-p" 'rmail-previous-same-subject) - ) +(defvar rmail-mode-map + (let ((map (make-keymap))) + (suppress-keymap map) + (define-key map "a" 'rmail-add-label) + (define-key map "b" 'rmail-bury) + (define-key map "c" 'rmail-continue) + (define-key map "d" 'rmail-delete-forward) + (define-key map "\C-d" 'rmail-delete-backward) + (define-key map "e" 'rmail-edit-current-message) + (define-key map "f" 'rmail-forward) + (define-key map "g" 'rmail-get-new-mail) + (define-key map "h" 'rmail-summary) + (define-key map "i" 'rmail-input) + (define-key map "j" 'rmail-show-message-maybe) + (define-key map "k" 'rmail-kill-label) + (define-key map "l" 'rmail-summary-by-labels) + (define-key map "\e\C-h" 'rmail-summary) + (define-key map "\e\C-l" 'rmail-summary-by-labels) + (define-key map "\e\C-r" 'rmail-summary-by-recipients) + (define-key map "\e\C-s" 'rmail-summary-by-regexp) + (define-key map "\e\C-t" 'rmail-summary-by-topic) + (define-key map "m" 'rmail-mail) + (define-key map "\em" 'rmail-retry-failure) + (define-key map "n" 'rmail-next-undeleted-message) + (define-key map "\en" 'rmail-next-message) + (define-key map "\e\C-n" 'rmail-next-labeled-message) + (define-key map "o" 'rmail-output) + (define-key map "\C-o" 'rmail-output-as-seen) + (define-key map "p" 'rmail-previous-undeleted-message) + (define-key map "\ep" 'rmail-previous-message) + (define-key map "\e\C-p" 'rmail-previous-labeled-message) + (define-key map "q" 'rmail-quit) + (define-key map "r" 'rmail-reply) + ;; I find I can't live without the default M-r command -- rms. + ;; (define-key rmail-mode-map "\er" 'rmail-search-backwards) + (define-key map "s" 'rmail-expunge-and-save) + (define-key map "\es" 'rmail-search) + (define-key map "t" 'rmail-toggle-header) + (define-key map "u" 'rmail-undelete-previous-message) + (define-key map "w" 'rmail-output-body-to-file) + (define-key map "\C-c\C-w" 'rmail-widen) + (define-key map "x" 'rmail-expunge) + (define-key map "." 'rmail-beginning-of-message) + (define-key map "/" 'rmail-end-of-message) + (define-key map "<" 'rmail-first-message) + (define-key map ">" 'rmail-last-message) + (define-key map " " 'scroll-up) + (define-key map "\177" 'scroll-down) + (define-key map "?" 'describe-mode) + (define-key map "\C-c\C-s\C-d" 'rmail-sort-by-date) + (define-key map "\C-c\C-s\C-s" 'rmail-sort-by-subject) + (define-key map "\C-c\C-s\C-a" 'rmail-sort-by-author) + (define-key map "\C-c\C-s\C-r" 'rmail-sort-by-recipient) + (define-key map "\C-c\C-s\C-c" 'rmail-sort-by-correspondent) + (define-key map "\C-c\C-s\C-l" 'rmail-sort-by-lines) + (define-key map "\C-c\C-s\C-k" 'rmail-sort-by-labels) + (define-key map "\C-c\C-n" 'rmail-next-same-subject) + (define-key map "\C-c\C-p" 'rmail-previous-same-subject) + -(define-key rmail-mode-map [menu-bar] (make-sparse-keymap)) + (define-key map [menu-bar] (make-sparse-keymap)) + + (define-key map [menu-bar classify] + (cons "Classify" (make-sparse-keymap "Classify"))) -(define-key rmail-mode-map [menu-bar classify] - (cons "Classify" (make-sparse-keymap "Classify"))) + (define-key map [menu-bar classify input-menu] + nil) -(define-key rmail-mode-map [menu-bar classify input-menu] - nil) + (define-key map [menu-bar classify output-menu] + nil) -(define-key rmail-mode-map [menu-bar classify output-menu] - nil) + (define-key map [menu-bar classify output-body] + '("Output body to file..." . rmail-output-body-to-file)) -(define-key rmail-mode-map [menu-bar classify output-body] - '("Output body to file..." . rmail-output-body-to-file)) + (define-key map [menu-bar classify output-inbox] + '("Output..." . rmail-output)) -(define-key rmail-mode-map [menu-bar classify output-inbox] - '("Output..." . rmail-output)) + (define-key map [menu-bar classify output] + '("Output as seen..." . rmail-output-as-seen)) -(define-key rmail-mode-map [menu-bar classify output] - '("Output as seen..." . rmail-output-as-seen)) + (define-key map [menu-bar classify kill-label] + '("Kill Label..." . rmail-kill-label)) -(define-key rmail-mode-map [menu-bar classify kill-label] - '("Kill Label..." . rmail-kill-label)) + (define-key map [menu-bar classify add-label] + '("Add Label..." . rmail-add-label)) -(define-key rmail-mode-map [menu-bar classify add-label] - '("Add Label..." . rmail-add-label)) + (define-key map [menu-bar summary] + (cons "Summary" (make-sparse-keymap "Summary"))) -(define-key rmail-mode-map [menu-bar summary] - (cons "Summary" (make-sparse-keymap "Summary"))) + (define-key map [menu-bar summary senders] + '("By Senders..." . rmail-summary-by-senders)) -(define-key rmail-mode-map [menu-bar summary senders] - '("By Senders..." . rmail-summary-by-senders)) + (define-key map [menu-bar summary labels] + '("By Labels..." . rmail-summary-by-labels)) -(define-key rmail-mode-map [menu-bar summary labels] - '("By Labels..." . rmail-summary-by-labels)) + (define-key map [menu-bar summary recipients] + '("By Recipients..." . rmail-summary-by-recipients)) -(define-key rmail-mode-map [menu-bar summary recipients] - '("By Recipients..." . rmail-summary-by-recipients)) + (define-key map [menu-bar summary topic] + '("By Topic..." . rmail-summary-by-topic)) -(define-key rmail-mode-map [menu-bar summary topic] - '("By Topic..." . rmail-summary-by-topic)) + (define-key map [menu-bar summary regexp] + '("By Regexp..." . rmail-summary-by-regexp)) -(define-key rmail-mode-map [menu-bar summary regexp] - '("By Regexp..." . rmail-summary-by-regexp)) + (define-key map [menu-bar summary all] + '("All" . rmail-summary)) -(define-key rmail-mode-map [menu-bar summary all] - '("All" . rmail-summary)) + (define-key map [menu-bar mail] + (cons "Mail" (make-sparse-keymap "Mail"))) -(define-key rmail-mode-map [menu-bar mail] - (cons "Mail" (make-sparse-keymap "Mail"))) + (define-key map [menu-bar mail rmail-get-new-mail] + '("Get New Mail" . rmail-get-new-mail)) -(define-key rmail-mode-map [menu-bar mail rmail-get-new-mail] - '("Get New Mail" . rmail-get-new-mail)) + (define-key map [menu-bar mail lambda] + '("----")) -(define-key rmail-mode-map [menu-bar mail lambda] - '("----")) + (define-key map [menu-bar mail continue] + '("Continue" . rmail-continue)) -(define-key rmail-mode-map [menu-bar mail continue] - '("Continue" . rmail-continue)) + (define-key map [menu-bar mail resend] + '("Re-send..." . rmail-resend)) -(define-key rmail-mode-map [menu-bar mail resend] - '("Re-send..." . rmail-resend)) + (define-key map [menu-bar mail forward] + '("Forward" . rmail-forward)) -(define-key rmail-mode-map [menu-bar mail forward] - '("Forward" . rmail-forward)) + (define-key map [menu-bar mail retry] + '("Retry" . rmail-retry-failure)) -(define-key rmail-mode-map [menu-bar mail retry] - '("Retry" . rmail-retry-failure)) + (define-key map [menu-bar mail reply] + '("Reply" . rmail-reply)) -(define-key rmail-mode-map [menu-bar mail reply] - '("Reply" . rmail-reply)) + (define-key map [menu-bar mail mail] + '("Mail" . rmail-mail)) -(define-key rmail-mode-map [menu-bar mail mail] - '("Mail" . rmail-mail)) + (define-key map [menu-bar delete] + (cons "Delete" (make-sparse-keymap "Delete"))) -(define-key rmail-mode-map [menu-bar delete] - (cons "Delete" (make-sparse-keymap "Delete"))) + (define-key map [menu-bar delete expunge/save] + '("Expunge/Save" . rmail-expunge-and-save)) -(define-key rmail-mode-map [menu-bar delete expunge/save] - '("Expunge/Save" . rmail-expunge-and-save)) + (define-key map [menu-bar delete expunge] + '("Expunge" . rmail-expunge)) -(define-key rmail-mode-map [menu-bar delete expunge] - '("Expunge" . rmail-expunge)) + (define-key map [menu-bar delete undelete] + '("Undelete" . rmail-undelete-previous-message)) -(define-key rmail-mode-map [menu-bar delete undelete] - '("Undelete" . rmail-undelete-previous-message)) + (define-key map [menu-bar delete delete] + '("Delete" . rmail-delete-forward)) -(define-key rmail-mode-map [menu-bar delete delete] - '("Delete" . rmail-delete-forward)) + (define-key map [menu-bar move] + (cons "Move" (make-sparse-keymap "Move"))) -(define-key rmail-mode-map [menu-bar move] - (cons "Move" (make-sparse-keymap "Move"))) + (define-key map [menu-bar move search-back] + '("Search Back..." . rmail-search-backwards)) -(define-key rmail-mode-map [menu-bar move search-back] - '("Search Back..." . rmail-search-backwards)) + (define-key map [menu-bar move search] + '("Search..." . rmail-search)) -(define-key rmail-mode-map [menu-bar move search] - '("Search..." . rmail-search)) + (define-key map [menu-bar move previous] + '("Previous Nondeleted" . rmail-previous-undeleted-message)) -(define-key rmail-mode-map [menu-bar move previous] - '("Previous Nondeleted" . rmail-previous-undeleted-message)) + (define-key map [menu-bar move next] + '("Next Nondeleted" . rmail-next-undeleted-message)) -(define-key rmail-mode-map [menu-bar move next] - '("Next Nondeleted" . rmail-next-undeleted-message)) + (define-key map [menu-bar move last] + '("Last" . rmail-last-message)) -(define-key rmail-mode-map [menu-bar move last] - '("Last" . rmail-last-message)) + (define-key map [menu-bar move first] + '("First" . rmail-first-message)) -(define-key rmail-mode-map [menu-bar move first] - '("First" . rmail-first-message)) + (define-key map [menu-bar move previous] + '("Previous" . rmail-previous-message)) -(define-key rmail-mode-map [menu-bar move previous] - '("Previous" . rmail-previous-message)) + (define-key map [menu-bar move next] + '("Next" . rmail-next-message)) -(define-key rmail-mode-map [menu-bar move next] - '("Next" . rmail-next-message)) + map)) ;; Rmail toolbar (defvar rmail-tool-bar-map @@ -1271,7 +1270,7 @@ sets the current buffer's `buffer-file-coding-system' to that of buffer-file-coding-system))) (buffer-swap-text rmail-view-buffer) (setq buffer-file-coding-system coding) - (set-buffer-modified-p modp))) + (restore-buffer-modified-p modp))) (defun rmail-buffers-swapped-p () "Return non-nil if the message collection is in `rmail-view-buffer'." @@ -1303,10 +1302,7 @@ If so restore the actual mbox message collection." (make-local-variable 'rmail-buffer) (setq rmail-buffer (current-buffer)) (set-buffer-multibyte nil) - (make-local-variable 'rmail-view-buffer) - (save-excursion - (setq rmail-view-buffer (rmail-generate-viewer-buffer)) - (set-buffer rmail-view-buffer) + (with-current-buffer (setq rmail-view-buffer (rmail-generate-viewer-buffer)) (setq buffer-undo-list t) (set-buffer-multibyte t) ;; Force C-x C-s write Unix EOLs. @@ -1391,7 +1387,8 @@ If so restore the actual mbox message collection." (interactive) (set-buffer rmail-buffer) (rmail-expunge t) - (rmail-swap-buffers-maybe) + ;; No need to swap buffers: rmail-write-region-annotate takes care of it. + ;; (rmail-swap-buffers-maybe) (save-buffer) (if (rmail-summary-exists) (rmail-select-summary (set-buffer-modified-p nil))) @@ -1944,7 +1941,7 @@ new messages. Return the number of new messages." limit) ;; Detect an empty inbox file. (unless (= start (point-max)) - ;; Scan the new messages to establish a count and to insure that + ;; Scan the new messages to establish a count and to ensure that ;; an attribute header is present. (while (looking-at "From ") ;; Determine if a new attribute header needs to be added to @@ -1977,9 +1974,9 @@ If MSGNUM is nil, use the current message." (save-excursion ;; ... so it is ok to go to a different buffer. (if (rmail-buffers-swapped-p) (set-buffer rmail-view-buffer)) + (save-excursion (save-restriction (widen) - (save-excursion (goto-char msgbeg) (setq end (search-forward "\n\n" nil t)) (if end @@ -2001,9 +1998,9 @@ If MSGNUM is nil, use the current message." (save-excursion ;; ... so it is ok to go to a different buffer. (if (rmail-buffers-swapped-p) (set-buffer rmail-view-buffer)) + (save-excursion (save-restriction (widen) - (save-excursion (goto-char msgbeg) (setq end (search-forward "\n\n" nil t)) (if end (setq end (1- end))) @@ -2117,9 +2114,9 @@ change; nil means current message." (save-excursion ;; ... so it is ok to go to a different buffer. (if (rmail-buffers-swapped-p) (set-buffer rmail-view-buffer)) + (save-excursion (save-restriction (widen) - (save-excursion ;; Determine if the current state is the desired state. (goto-char msgbeg) (save-excursion @@ -2204,13 +2201,12 @@ If MSGNUM is nil, use the current message." (save-excursion ;; ... so it is ok to go to a different buffer. (if (rmail-buffers-swapped-p) (set-buffer rmail-view-buffer)) + (save-excursion (save-restriction (widen) - (save-excursion (goto-char msgbeg) - (save-restriction (narrow-to-region msgbeg msgend) - (apply function args))))))))) + (apply function args)))))))) (defun rmail-widen-to-current-msgbeg (function) "Call FUNCTION with point at start of internal data of current message. @@ -2462,6 +2458,7 @@ N defaults to the current message." (interactive "p") (or (eq major-mode 'rmail-mode) (switch-to-buffer rmail-buffer)) + ;; FIXME: Why do we swap the raw data back in? (rmail-swap-buffers-maybe) (rmail-maybe-set-message-counters) (widen) @@ -2675,8 +2672,7 @@ to be used to fix messages encoded with 8-bit encodings, such as iso-8859, koi8-r, etc." (interactive "zCoding system for re-decoding this message: ") (when (not rmail-enable-mime) - (save-excursion - (set-buffer rmail-buffer) + (with-current-buffer rmail-buffer (rmail-swap-buffers-maybe) (save-restriction (widen) @@ -3109,8 +3105,7 @@ If N is negative, go forwards instead." (rmail-show-message-maybe msg)) (rmail-set-attribute rmail-deleted-attr-index nil) (if (rmail-summary-exists) - (save-excursion - (set-buffer rmail-summary-buffer) + (with-current-buffer rmail-summary-buffer (rmail-summary-mark-undeleted msg))) (rmail-maybe-display-summary)))) @@ -3407,8 +3402,7 @@ use \\[mail-yank-original] to yank the original message into it." This is use in the send-actions for message buffers. MSGNUM-LIST is a list of the form (MSGNUM) which is an element of rmail-msgref-vector." - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (if (car msgnum-list) (rmail-set-attribute attribute t (car msgnum-list))))) @@ -3816,7 +3810,8 @@ This has an effect only if a summary buffer exists." (remove-hook 'rmail-show-message-hook 'rmail-fontify-message t) (remove-text-properties (point-min) (point-max) '(rmail-fontified nil)) (font-lock-default-unfontify-buffer) - (and (not modified) (buffer-modified-p) (set-buffer-modified-p nil))))) + (and (not modified) (buffer-modified-p) + (restore-buffer-modified-p nil))))) (defun rmail-fontify-message () ;; Fontify the current message if it is not already fontified. @@ -3829,7 +3824,8 @@ This has an effect only if a summary buffer exists." (save-match-data (add-text-properties (point-min) (point-max) '(rmail-fontified t)) (font-lock-fontify-region (point-min) (point-max)) - (and (not modified) (buffer-modified-p) (set-buffer-modified-p nil))))))) + (and (not modified) (buffer-modified-p) + (restore-buffer-modified-p nil))))))) ;;; Speedbar support for RMAIL files. (eval-when-compile (require 'speedbar)) @@ -3875,8 +3871,7 @@ Click on the address under Reply to: to reply to this person. Under Folders: Click a name to read it, or on the to move the current message into that RMAIL folder." (let ((from nil)) - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (goto-char (point-min)) (if (not (re-search-forward "^Reply-To: " nil t)) (if (not (re-search-forward "^From:? " nil t)) @@ -3896,8 +3891,8 @@ current message into that RMAIL folder." 'rmail-speedbar-button 'rmail-reply)) (insert "Folders:\n") (let* ((case-fold-search nil) - (df (directory-files (save-excursion (set-buffer buffer) - default-directory) + (df (directory-files (with-current-buffer buffer + default-directory) nil rmail-speedbar-match-folder-regexp))) (while df (speedbar-insert-button "" 'speedbar-button-face 'highlight -- 2.39.2