diff lisp/mail/feedmail.el @ 105829:328150f0cf76

* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 03 Nov 2009 02:04:29 +0000
parents 21469025a673
children c22556bde650
line wrap: on
line diff
--- a/lisp/mail/feedmail.el	Tue Nov 03 00:39:10 2009 +0000
+++ b/lisp/mail/feedmail.el	Tue Nov 03 02:04:29 2009 +0000
@@ -1628,8 +1628,7 @@
 		      (if (and already-buffer (not (file-exists-p maybe-file)))
 			  ;; we have gotten rid of the file associated with the
 			  ;; buffer, so update the buffer's notion of that
-			  (save-excursion
-			    (set-buffer already-buffer)
+			  (with-current-buffer already-buffer
 			    (setq buffer-file-name nil)))))
 		(error (setq messages-skipped (1+ messages-skipped))))
 	      (kill-buffer blobby-buffer)
@@ -1801,7 +1800,8 @@
 ")
     (and (stringp feedmail-prompt-before-queue-help-supplement)
 	 (princ feedmail-prompt-before-queue-help-supplement))
-    (save-excursion (set-buffer standard-output) (if (fboundp 'help-mode) (help-mode)))))
+    (with-current-buffer standard-output
+      (if (fboundp 'help-mode) (help-mode)))))
 
 (defun feedmail-look-at-queue-directory (queue-directory)
   "Find out some things about a queue directory.
@@ -1970,7 +1970,7 @@
 	 (mail-header-separator mail-header-separator)
 	 )
     (unwind-protect
-	(save-excursion
+	(save-current-buffer
 	  (set-buffer feedmail-error-buffer) (erase-buffer)
 	  (set-buffer feedmail-prepped-text-buffer) (erase-buffer)
 
@@ -2075,18 +2075,17 @@
 		  (if (and (not feedmail-queue-runner-is-active) (setq also-file (buffer-file-name feedmail-raw-text-buffer)))
 		      (progn		; if a file but not running the queue, offer to delete it
 			(setq also-file (expand-file-name also-file))
-			(if (or feedmail-queue-auto-file-nuke
-				(y-or-n-p (format "FQM: Delete message file %s? " also-file)))
-			    (save-excursion
-			      ;; if we delete the affiliated file, get rid
-			      ;; of the file name association and make sure we
-			      ;; don't annoy people with a prompt on exit
-			      (delete-file also-file)
-			      (set-buffer feedmail-raw-text-buffer)
-			      (setq buffer-offer-save nil)
-			      (setq buffer-file-name nil)
-			      )
-			  )))
+			(when (or feedmail-queue-auto-file-nuke
+                                  (y-or-n-p
+                                   (format "FQM: Delete message file %s? "
+                                           also-file)))
+                          ;; if we delete the affiliated file, get rid
+                          ;; of the file name association and make sure we
+                          ;; don't annoy people with a prompt on exit
+                          (delete-file also-file)
+                          (with-current-buffer feedmail-raw-text-buffer
+                            (setq buffer-offer-save nil)
+                            (setq buffer-file-name nil)))))
 		  (goto-char (point-min))
 		  ;; re-insert and handle any Fcc fields (and, optionally, any Bcc).
 		  (if fcc (letf (((default-value 'buffer-file-type)
@@ -2197,18 +2196,19 @@
 	(mapcar
 	 '(lambda (feedmail-spray-this-address)
 	    (let ((spray-buffer (get-buffer-create " *FQM Outgoing Email Spray*")))
-	      (save-excursion
-		(set-buffer spray-buffer)
+	      (with-current-buffer spray-buffer
 		(erase-buffer)
 		;; not life's most efficient methodology, but spraying isn't
 		;; an every-5-minutes event either
 		(insert-buffer-substring feedmail-prepped-text-buffer)
-		;; There's a good case to me made that each separate transmission of
-		;; a message in the spray should have a distinct Message-Id:.  There
-		;; is also a less compelling argument in the other direction.  I think
-		;; they technically should have distinct Message-Id:s, but I doubt that
-		;; anyone cares, practically.  If someone complains about it, I'll add
-		;; it.
+		;; There's a good case to me made that each separate
+		;; transmission of a message in the spray should
+		;; have a distinct Message-Id:.  There is also a less
+		;; compelling argument in the other direction.
+		;; I think they technically should have distinct
+		;; Message-Id:s, but I doubt that anyone cares,
+		;; practically.  If someone complains about it, I'll
+		;; add it.
 		(feedmail-fiddle-list-of-spray-fiddle-plexes feedmail-spray-address-fiddle-plex-list)
 		;; this (let ) is just in case some buffer eater
 		;; is cheating and using the global variable name instead
@@ -2593,8 +2593,8 @@
 	(this-line)
 	(this-line-end))
     (unwind-protect
-	(save-excursion
-	  (set-buffer (get-buffer-create " *FQM scratch*")) (erase-buffer)
+	(with-current-buffer (get-buffer-create " *FQM scratch*")
+          (erase-buffer)
 	  (insert-buffer-substring message-buffer header-start header-end)
 	  (goto-char (point-min))
 	  (let ((case-fold-search t))