diff options
| author | Stefan Monnier | 2009-11-03 02:04:29 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-11-03 02:04:29 +0000 |
| commit | 937e6a5612df742722aadd1e2d190f3ef7165952 (patch) | |
| tree | 73d0557ae4f7cf3370b39413fa723cf3570b2db5 | |
| parent | 5b95556284173d0cebc3b1378166c207afb3c495 (diff) | |
| download | emacs-937e6a5612df742722aadd1e2d190f3ef7165952.tar.gz emacs-937e6a5612df742722aadd1e2d190f3ef7165952.zip | |
* 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.
39 files changed, 324 insertions, 364 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c635f6fc395..057fefd52a7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,58 @@ | |||
| 1 | 2009-11-03 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): | ||
| 4 | * play/mpuz.el (mpuz-create-buffer): | ||
| 5 | * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) | ||
| 6 | (lm-print-y,s,noise, lm-print-w0, lm-init): | ||
| 7 | * play/gomoku.el (gomoku-prompt-for-move): | ||
| 8 | * play/fortune.el (fortune-in-buffer): | ||
| 9 | * play/dissociate.el (dissociated-press): | ||
| 10 | * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) | ||
| 11 | (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): | ||
| 12 | * mail/supercite.el (sc-eref-show): | ||
| 13 | * mail/smtpmail.el (smtpmail-send-it): | ||
| 14 | * mail/rmailsum.el (rmail-summary-next-labeled-message) | ||
| 15 | (rmail-summary-previous-labeled-message, rmail-summary-wipe) | ||
| 16 | (rmail-summary-undelete-many, rmail-summary-rmail-update) | ||
| 17 | (rmail-summary-goto-msg, rmail-summary-expunge) | ||
| 18 | (rmail-summary-get-new-mail, rmail-summary-search-backward) | ||
| 19 | (rmail-summary-add-label, rmail-summary-output-menu) | ||
| 20 | (rmail-summary-output-body): | ||
| 21 | * mail/rfc822.el (rfc822-addresses): | ||
| 22 | * mail/reporter.el (reporter-dump-variable, reporter-dump-state): | ||
| 23 | * mail/mailpost.el (post-mail-send-it): | ||
| 24 | * mail/hashcash.el (hashcash-generate-payment): | ||
| 25 | * mail/feedmail.el (feedmail-run-the-queue) | ||
| 26 | (feedmail-queue-send-edit-prompt-help-first) | ||
| 27 | (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) | ||
| 28 | (feedmail-deduce-address-list): | ||
| 29 | * eshell/esh-ext.el (eshell-remote-command): | ||
| 30 | * eshell/em-unix.el (eshell-occur-mode-mouse-goto): | ||
| 31 | * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) | ||
| 32 | (viper-wildcard-to-regexp, viper-glob-mswindows-files) | ||
| 33 | (viper-save-string-in-file, viper-valid-marker): | ||
| 34 | * emulation/viper-keym.el (viper-toggle-key): | ||
| 35 | * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) | ||
| 36 | (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) | ||
| 37 | (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): | ||
| 38 | * emulation/viper-cmd.el (viper-exec-form-in-vi) | ||
| 39 | (viper-exec-form-in-emacs, viper-brac-function): | ||
| 40 | * emulation/viper.el (viper-delocalize-var): | ||
| 41 | * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) | ||
| 42 | (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) | ||
| 43 | (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) | ||
| 44 | (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): | ||
| 45 | * emulation/vi.el (vi-switch-mode, vi-ex-cmd): | ||
| 46 | * emulation/edt.el (edt-electric-helpify): | ||
| 47 | * emulation/cua-rect.el (cua--rectangle-aux-replace): | ||
| 48 | * emulation/cua-gmrk.el (cua--insert-at-global-mark) | ||
| 49 | (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) | ||
| 50 | (cua-indent-to-global-mark-column): | ||
| 51 | * calendar/diary-lib.el (calendar-mark-1): | ||
| 52 | * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): | ||
| 53 | Use with-current-buffer. | ||
| 54 | * emulation/viper.el (viper-delocalize-var): Use dolist. | ||
| 55 | |||
| 1 | 2009-11-03 Chong Yidong <cyd@stupidchicken.com> | 56 | 2009-11-03 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 57 | ||
| 3 | * comint.el (comint-replace-by-expanded-history-before-point): | 58 | * comint.el (comint-replace-by-expanded-history-before-point): |
| @@ -27,8 +82,8 @@ | |||
| 27 | * textmodes/sgml-mode.el (sgml-mode-facemenu-add-face-function): | 82 | * textmodes/sgml-mode.el (sgml-mode-facemenu-add-face-function): |
| 28 | Support face colors. | 83 | Support face colors. |
| 29 | 84 | ||
| 30 | * textmodes/tex-mode.el (tex-facemenu-add-face-function): New | 85 | * textmodes/tex-mode.el (tex-facemenu-add-face-function): |
| 31 | function. Support face colors (Bug#1168). | 86 | New function. Support face colors (Bug#1168). |
| 32 | (tex-common-initialization): Use it. | 87 | (tex-common-initialization): Use it. |
| 33 | 88 | ||
| 34 | * facemenu.el (facemenu-enable-faces-p): Enable facemenu if the | 89 | * facemenu.el (facemenu-enable-faces-p): Enable facemenu if the |
diff --git a/lisp/calendar/cal-hebrew.el b/lisp/calendar/cal-hebrew.el index 55eafd6df90..3334b7a64f1 100644 --- a/lisp/calendar/cal-hebrew.el +++ b/lisp/calendar/cal-hebrew.el | |||
| @@ -646,8 +646,7 @@ A value of 0 in any position is a wildcard. Optional argument COLOR is | |||
| 646 | passed to `calendar-mark-visible-date' as MARK." | 646 | passed to `calendar-mark-visible-date' as MARK." |
| 647 | ;; FIXME not the same as the Bahai and Islamic cases, so can't use | 647 | ;; FIXME not the same as the Bahai and Islamic cases, so can't use |
| 648 | ;; calendar-mark-1. | 648 | ;; calendar-mark-1. |
| 649 | (save-excursion | 649 | (with-current-buffer calendar-buffer |
| 650 | (set-buffer calendar-buffer) | ||
| 651 | (if (and (not (zerop month)) (not (zerop day))) | 650 | (if (and (not (zerop month)) (not (zerop day))) |
| 652 | (if (not (zerop year)) | 651 | (if (not (zerop year)) |
| 653 | ;; Fully specified Hebrew date. | 652 | ;; Fully specified Hebrew date. |
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 1da6e85de82..797f330e408 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -1506,8 +1506,7 @@ Optional argument COLOR is passed to `calendar-mark-visible-date' as MARK." | |||
| 1506 | The function FROMABS converts absolute dates to the appropriate date system. | 1506 | The function FROMABS converts absolute dates to the appropriate date system. |
| 1507 | The function TOABS carries out the inverse operation. Optional argument | 1507 | The function TOABS carries out the inverse operation. Optional argument |
| 1508 | COLOR is passed to `calendar-mark-visible-date' as MARK." | 1508 | COLOR is passed to `calendar-mark-visible-date' as MARK." |
| 1509 | (save-excursion | 1509 | (with-current-buffer calendar-buffer |
| 1510 | (set-buffer calendar-buffer) | ||
| 1511 | (if (and (not (zerop month)) (not (zerop day))) | 1510 | (if (and (not (zerop month)) (not (zerop day))) |
| 1512 | (if (not (zerop year)) | 1511 | (if (not (zerop year)) |
| 1513 | ;; Fully specified date. | 1512 | ;; Fully specified date. |
diff --git a/lisp/emulation/cua-gmrk.el b/lisp/emulation/cua-gmrk.el index 4f0f480673b..03ce53d7af7 100644 --- a/lisp/emulation/cua-gmrk.el +++ b/lisp/emulation/cua-gmrk.el | |||
| @@ -110,8 +110,7 @@ With prefix argument, don't jump to global mark when cancelling it." | |||
| 110 | 110 | ||
| 111 | (defun cua--insert-at-global-mark (str &optional msg) | 111 | (defun cua--insert-at-global-mark (str &optional msg) |
| 112 | ;; Insert string at global marker and move marker | 112 | ;; Insert string at global marker and move marker |
| 113 | (save-excursion | 113 | (with-current-buffer (marker-buffer cua--global-mark-marker) |
| 114 | (set-buffer (marker-buffer cua--global-mark-marker)) | ||
| 115 | (goto-char (marker-position cua--global-mark-marker)) | 114 | (goto-char (marker-position cua--global-mark-marker)) |
| 116 | (insert-for-yank str) | 115 | (insert-for-yank str) |
| 117 | (cua--activate-global-mark)) | 116 | (cua--activate-global-mark)) |
| @@ -123,8 +122,7 @@ With prefix argument, don't jump to global mark when cancelling it." | |||
| 123 | 122 | ||
| 124 | (defun cua--delete-at-global-mark (arg &optional msg) | 123 | (defun cua--delete-at-global-mark (arg &optional msg) |
| 125 | ;; Delete chars at global marker | 124 | ;; Delete chars at global marker |
| 126 | (save-excursion | 125 | (with-current-buffer (marker-buffer cua--global-mark-marker) |
| 127 | (set-buffer (marker-buffer cua--global-mark-marker)) | ||
| 128 | (goto-char (marker-position cua--global-mark-marker)) | 126 | (goto-char (marker-position cua--global-mark-marker)) |
| 129 | (delete-char arg)) | 127 | (delete-char arg)) |
| 130 | (if msg | 128 | (if msg |
| @@ -190,8 +188,7 @@ With prefix argument, don't jump to global mark when cancelling it." | |||
| 190 | (if (cua--global-mark-active) | 188 | (if (cua--global-mark-active) |
| 191 | (let ((src-buf (current-buffer)) | 189 | (let ((src-buf (current-buffer)) |
| 192 | (text (cua--extract-rectangle))) | 190 | (text (cua--extract-rectangle))) |
| 193 | (save-excursion | 191 | (with-current-buffer (marker-buffer cua--global-mark-marker) |
| 194 | (set-buffer (marker-buffer cua--global-mark-marker)) | ||
| 195 | (goto-char (marker-position cua--global-mark-marker)) | 192 | (goto-char (marker-position cua--global-mark-marker)) |
| 196 | (if as-text | 193 | (if as-text |
| 197 | (while text | 194 | (while text |
| @@ -309,8 +306,7 @@ With prefix argument, don't jump to global mark when cancelling it." | |||
| 309 | (interactive "*") | 306 | (interactive "*") |
| 310 | (if (cua--global-mark-active) | 307 | (if (cua--global-mark-active) |
| 311 | (let (col) | 308 | (let (col) |
| 312 | (save-excursion | 309 | (with-current-buffer (marker-buffer cua--global-mark-marker) |
| 313 | (set-buffer (marker-buffer cua--global-mark-marker)) | ||
| 314 | (goto-char (marker-position cua--global-mark-marker)) | 310 | (goto-char (marker-position cua--global-mark-marker)) |
| 315 | (setq col (current-column))) | 311 | (setq col (current-column))) |
| 316 | (if cua--rectangle | 312 | (if cua--rectangle |
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el index f809aa9f57c..df9f7469707 100644 --- a/lisp/emulation/cua-rect.el +++ b/lisp/emulation/cua-rect.el | |||
| @@ -1198,8 +1198,7 @@ The numbers are formatted according to the FORMAT string." | |||
| 1198 | (- (cua--rectangle-right) (cua--rectangle-left) -1))) | 1198 | (- (cua--rectangle-right) (cua--rectangle-left) -1))) |
| 1199 | (r (or setup-fct (cua--extract-rectangle))) | 1199 | (r (or setup-fct (cua--extract-rectangle))) |
| 1200 | y z (tr 0)) | 1200 | y z (tr 0)) |
| 1201 | (save-excursion | 1201 | (with-current-buffer auxbuf |
| 1202 | (set-buffer auxbuf) | ||
| 1203 | (erase-buffer) | 1202 | (erase-buffer) |
| 1204 | (if setup-fct | 1203 | (if setup-fct |
| 1205 | (funcall setup-fct) | 1204 | (funcall setup-fct) |
diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el index a11e06130a5..6457925efa6 100644 --- a/lisp/emulation/edt.el +++ b/lisp/emulation/edt.el | |||
| @@ -2657,8 +2657,7 @@ G-C-\\: Split Window | FNDNXT | Yank | CUT | | |||
| 2657 | (progn | 2657 | (progn |
| 2658 | (message "%s..." (capitalize (symbol-name fun))) | 2658 | (message "%s..." (capitalize (symbol-name fun))) |
| 2659 | (and b | 2659 | (and b |
| 2660 | (save-excursion | 2660 | (with-current-buffer b |
| 2661 | (set-buffer b) | ||
| 2662 | (set-buffer-modified-p t))) | 2661 | (set-buffer-modified-p t))) |
| 2663 | (fset 'help-print-return-message 'ignore) | 2662 | (fset 'help-print-return-message 'ignore) |
| 2664 | (call-interactively fun) | 2663 | (call-interactively fun) |
| @@ -2669,8 +2668,7 @@ G-C-\\: Split Window | FNDNXT | Yank | CUT | | |||
| 2669 | (not (buffer-modified-p b))))) | 2668 | (not (buffer-modified-p b))))) |
| 2670 | (fset 'help-print-return-message p) | 2669 | (fset 'help-print-return-message p) |
| 2671 | (and b (buffer-name b) | 2670 | (and b (buffer-name b) |
| 2672 | (save-excursion | 2671 | (with-current-buffer b |
| 2673 | (set-buffer b) | ||
| 2674 | (set-buffer-modified-p m)))))) | 2672 | (set-buffer-modified-p m)))))) |
| 2675 | (with-electric-help 'delete-other-windows name t)))) | 2673 | (with-electric-help 'delete-other-windows name t)))) |
| 2676 | 2674 | ||
diff --git a/lisp/emulation/vi.el b/lisp/emulation/vi.el index 64f610f4a13..a65dd44e39e 100644 --- a/lisp/emulation/vi.el +++ b/lisp/emulation/vi.el | |||
| @@ -79,8 +79,7 @@ | |||
| 79 | (if (null mode-cmd) | 79 | (if (null mode-cmd) |
| 80 | (with-output-to-temp-buffer "*Help*" | 80 | (with-output-to-temp-buffer "*Help*" |
| 81 | (princ (substitute-command-keys "Possible major modes to switch to: \\{vi-tilde-map}")) | 81 | (princ (substitute-command-keys "Possible major modes to switch to: \\{vi-tilde-map}")) |
| 82 | (save-excursion | 82 | (with-current-buffer standard-output |
| 83 | (set-buffer standard-output) | ||
| 84 | (help-mode))) | 83 | (help-mode))) |
| 85 | (setq prefix-arg arg) ; prefix arg will be passed down | 84 | (setq prefix-arg arg) ; prefix arg will be passed down |
| 86 | (command-execute mode-cmd nil) ; may need to save mode-line-format etc | 85 | (command-execute mode-cmd nil) ; may need to save mode-line-format etc |
| @@ -499,8 +498,7 @@ set sw=n M-x set-variable vi-shift-width n " | |||
| 499 | ;; (cond ((string-match "s")))) | 498 | ;; (cond ((string-match "s")))) |
| 500 | (with-output-to-temp-buffer "*Help*" | 499 | (with-output-to-temp-buffer "*Help*" |
| 501 | (princ (documentation 'vi-ex-cmd)) | 500 | (princ (documentation 'vi-ex-cmd)) |
| 502 | (save-excursion | 501 | (with-current-buffer standard-output |
| 503 | (set-buffer standard-output) | ||
| 504 | (help-mode)))) | 502 | (help-mode)))) |
| 505 | 503 | ||
| 506 | (defun vi-undefined () | 504 | (defun vi-undefined () |
diff --git a/lisp/emulation/vip.el b/lisp/emulation/vip.el index 560a7e6e849..96bbf38f066 100644 --- a/lisp/emulation/vip.el +++ b/lisp/emulation/vip.el | |||
| @@ -419,10 +419,9 @@ Type `n' to quit this window for now.\n") | |||
| 419 | (goto-char (point-min)) | 419 | (goto-char (point-min)) |
| 420 | (if (y-or-n-p "Inhibit VIP startup message? ") | 420 | (if (y-or-n-p "Inhibit VIP startup message? ") |
| 421 | (progn | 421 | (progn |
| 422 | (save-excursion | 422 | (with-current-buffer |
| 423 | (set-buffer | 423 | (find-file-noselect |
| 424 | (find-file-noselect | 424 | (substitute-in-file-name vip-startup-file)) |
| 425 | (substitute-in-file-name vip-startup-file))) | ||
| 426 | (goto-char (point-max)) | 425 | (goto-char (point-max)) |
| 427 | (insert "\n(setq vip-inhibit-startup-message t)\n") | 426 | (insert "\n(setq vip-inhibit-startup-message t)\n") |
| 428 | (save-buffer) | 427 | (save-buffer) |
| @@ -2158,8 +2157,7 @@ is a command.") | |||
| 2158 | (defun vip-get-ex-token () | 2157 | (defun vip-get-ex-token () |
| 2159 | "get an ex-token which is either an address or a command. | 2158 | "get an ex-token which is either an address or a command. |
| 2160 | a token has type \(command, address, end-mark\) and value." | 2159 | a token has type \(command, address, end-mark\) and value." |
| 2161 | (save-window-excursion | 2160 | (with-current-buffer " *ex-working-space*" |
| 2162 | (set-buffer " *ex-working-space*") | ||
| 2163 | (skip-chars-forward " \t") | 2161 | (skip-chars-forward " \t") |
| 2164 | (cond ((looking-at "[k#]") | 2162 | (cond ((looking-at "[k#]") |
| 2165 | (setq ex-token-type "command") | 2163 | (setq ex-token-type "command") |
| @@ -2262,8 +2260,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2262 | ex-g-variant nil)) | 2260 | ex-g-variant nil)) |
| 2263 | (let ((com-str (or string (vip-read-string ":"))) | 2261 | (let ((com-str (or string (vip-read-string ":"))) |
| 2264 | (address nil) (cont t) (dot (point))) | 2262 | (address nil) (cont t) (dot (point))) |
| 2265 | (save-window-excursion | 2263 | (with-current-buffer (get-buffer-create " *ex-working-space*") |
| 2266 | (set-buffer (get-buffer-create " *ex-working-space*")) | ||
| 2267 | (delete-region (point-min) (point-max)) | 2264 | (delete-region (point-min) (point-max)) |
| 2268 | (insert com-str "\n") | 2265 | (insert com-str "\n") |
| 2269 | (goto-char (point-min))) | 2266 | (goto-char (point-min))) |
| @@ -2282,8 +2279,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2282 | (setq cont nil)) | 2279 | (setq cont nil)) |
| 2283 | (t | 2280 | (t |
| 2284 | (vip-execute-ex-command) | 2281 | (vip-execute-ex-command) |
| 2285 | (save-window-excursion | 2282 | (with-current-buffer " *ex-working-space*" |
| 2286 | (set-buffer " *ex-working-space*") | ||
| 2287 | (skip-chars-forward " \t") | 2283 | (skip-chars-forward " \t") |
| 2288 | (cond ((looking-at "|") | 2284 | (cond ((looking-at "|") |
| 2289 | (forward-char 1)) | 2285 | (forward-char 1)) |
| @@ -2307,8 +2303,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2307 | 2303 | ||
| 2308 | (defun vip-get-ex-pat () | 2304 | (defun vip-get-ex-pat () |
| 2309 | "get a regular expression and set ex-variant if found" | 2305 | "get a regular expression and set ex-variant if found" |
| 2310 | (save-window-excursion | 2306 | (with-current-buffer " *ex-working-space*" |
| 2311 | (set-buffer " *ex-working-space*") | ||
| 2312 | (skip-chars-forward " \t") | 2307 | (skip-chars-forward " \t") |
| 2313 | (if (looking-at "!") | 2308 | (if (looking-at "!") |
| 2314 | (progn | 2309 | (progn |
| @@ -2334,8 +2329,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2334 | 2329 | ||
| 2335 | (defun vip-get-ex-command () | 2330 | (defun vip-get-ex-command () |
| 2336 | "get an ex command" | 2331 | "get an ex command" |
| 2337 | (save-window-excursion | 2332 | (with-current-buffer " *ex-working-space*" |
| 2338 | (set-buffer " *ex-working-space*") | ||
| 2339 | (if (looking-at "/") (forward-char 1)) | 2333 | (if (looking-at "/") (forward-char 1)) |
| 2340 | (skip-chars-forward " \t") | 2334 | (skip-chars-forward " \t") |
| 2341 | (cond ((looking-at "[a-z]") | 2335 | (cond ((looking-at "[a-z]") |
| @@ -2349,8 +2343,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2349 | 2343 | ||
| 2350 | (defun vip-get-ex-opt-gc () | 2344 | (defun vip-get-ex-opt-gc () |
| 2351 | "get an ex option g or c" | 2345 | "get an ex option g or c" |
| 2352 | (save-window-excursion | 2346 | (with-current-buffer " *ex-working-space*" |
| 2353 | (set-buffer " *ex-working-space*") | ||
| 2354 | (if (looking-at "/") (forward-char 1)) | 2347 | (if (looking-at "/") (forward-char 1)) |
| 2355 | (skip-chars-forward " \t") | 2348 | (skip-chars-forward " \t") |
| 2356 | (cond ((looking-at "g") | 2349 | (cond ((looking-at "g") |
| @@ -2458,8 +2451,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2458 | (setq ex-buffer nil) | 2451 | (setq ex-buffer nil) |
| 2459 | (setq ex-count nil) | 2452 | (setq ex-count nil) |
| 2460 | (setq ex-flag nil) | 2453 | (setq ex-flag nil) |
| 2461 | (save-window-excursion | 2454 | (with-current-buffer " *ex-working-space*" |
| 2462 | (set-buffer " *ex-working-space*") | ||
| 2463 | (skip-chars-forward " \t") | 2455 | (skip-chars-forward " \t") |
| 2464 | (if (looking-at "[a-zA-Z]") | 2456 | (if (looking-at "[a-zA-Z]") |
| 2465 | (progn | 2457 | (progn |
| @@ -2483,8 +2475,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2483 | (setq ex-variant nil | 2475 | (setq ex-variant nil |
| 2484 | ex-count nil | 2476 | ex-count nil |
| 2485 | ex-flag nil) | 2477 | ex-flag nil) |
| 2486 | (save-window-excursion | 2478 | (with-current-buffer " *ex-working-space*" |
| 2487 | (set-buffer " *ex-working-space*") | ||
| 2488 | (skip-chars-forward " \t") | 2479 | (skip-chars-forward " \t") |
| 2489 | (if (looking-at "!") | 2480 | (if (looking-at "!") |
| 2490 | (progn | 2481 | (progn |
| @@ -2510,8 +2501,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2510 | ex-variant nil | 2501 | ex-variant nil |
| 2511 | ex-append nil | 2502 | ex-append nil |
| 2512 | ex-offset nil) | 2503 | ex-offset nil) |
| 2513 | (save-window-excursion | 2504 | (with-current-buffer " *ex-working-space*" |
| 2514 | (set-buffer " *ex-working-space*") | ||
| 2515 | (skip-chars-forward " \t") | 2505 | (skip-chars-forward " \t") |
| 2516 | (if (looking-at "!") | 2506 | (if (looking-at "!") |
| 2517 | (progn | 2507 | (progn |
| @@ -2680,8 +2670,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2680 | (goto-char (point-min)) | 2670 | (goto-char (point-min)) |
| 2681 | (if ex-offset | 2671 | (if ex-offset |
| 2682 | (progn | 2672 | (progn |
| 2683 | (save-window-excursion | 2673 | (with-current-buffer " *ex-working-space*" |
| 2684 | (set-buffer " *ex-working-space*") | ||
| 2685 | (delete-region (point-min) (point-max)) | 2674 | (delete-region (point-min) (point-max)) |
| 2686 | (insert ex-offset "\n") | 2675 | (insert ex-offset "\n") |
| 2687 | (goto-char (point-min))) | 2676 | (goto-char (point-min))) |
| @@ -2733,19 +2722,18 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2733 | (if (bobp) (setq cont nil) | 2722 | (if (bobp) (setq cont nil) |
| 2734 | (forward-line -1) | 2723 | (forward-line -1) |
| 2735 | (end-of-line))))) | 2724 | (end-of-line))))) |
| 2736 | (save-window-excursion | 2725 | (with-current-buffer " *ex-working-space*" |
| 2737 | (set-buffer " *ex-working-space*") | 2726 | (setq com-str (buffer-substring (1+ (point)) (1- (point-max))))) |
| 2738 | (setq com-str (buffer-substring (1+ (point)) (1- (point-max))))) | 2727 | (while marks |
| 2739 | (while marks | 2728 | (goto-char (car marks)) |
| 2740 | (goto-char (car marks)) | 2729 | ;; report progress of execution on a slow machine. |
| 2741 | ; report progress of execution on a slow machine. | 2730 | ;;(message "Executing global command...") |
| 2742 | ;(message "Executing global command...") | 2731 | ;;(if (zerop (% mark-count 10)) |
| 2743 | ;(if (zerop (% mark-count 10)) | 2732 | ;; (message "Executing global command...%d" mark-count)) |
| 2744 | ;(message "Executing global command...%d" mark-count)) | 2733 | (vip-ex com-str) |
| 2745 | (vip-ex com-str) | 2734 | (setq mark-count (1- mark-count)) |
| 2746 | (setq mark-count (1- mark-count)) | 2735 | (setq marks (cdr marks))))) |
| 2747 | (setq marks (cdr marks))))) | 2736 | ;;(message "Executing global command...done"))) |
| 2748 | ;(message "Executing global command...done"))) | ||
| 2749 | 2737 | ||
| 2750 | (defun ex-line (com) | 2738 | (defun ex-line (com) |
| 2751 | "ex line commands. COM is join, shift-right or shift-left." | 2739 | "ex line commands. COM is join, shift-right or shift-left." |
| @@ -2801,8 +2789,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2801 | (if (null ex-addresses) | 2789 | (if (null ex-addresses) |
| 2802 | (setq ex-addresses | 2790 | (setq ex-addresses |
| 2803 | (cons (point) nil))) | 2791 | (cons (point) nil))) |
| 2804 | (save-window-excursion | 2792 | (with-current-buffer " *ex-working-space*" |
| 2805 | (set-buffer " *ex-working-space*") | ||
| 2806 | (skip-chars-forward " \t") | 2793 | (skip-chars-forward " \t") |
| 2807 | (if (looking-at "[a-z]") | 2794 | (if (looking-at "[a-z]") |
| 2808 | (progn | 2795 | (progn |
| @@ -2821,8 +2808,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2821 | (defun ex-map () | 2808 | (defun ex-map () |
| 2822 | "ex map" | 2809 | "ex map" |
| 2823 | (let (char string) | 2810 | (let (char string) |
| 2824 | (save-window-excursion | 2811 | (with-current-buffer " *ex-working-space*" |
| 2825 | (set-buffer " *ex-working-space*") | ||
| 2826 | (skip-chars-forward " \t") | 2812 | (skip-chars-forward " \t") |
| 2827 | (setq char (char-to-string (following-char))) | 2813 | (setq char (char-to-string (following-char))) |
| 2828 | (forward-char 1) | 2814 | (forward-char 1) |
| @@ -2847,8 +2833,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2847 | (defun ex-unmap () | 2833 | (defun ex-unmap () |
| 2848 | "ex unmap" | 2834 | "ex unmap" |
| 2849 | (let (char) | 2835 | (let (char) |
| 2850 | (save-window-excursion | 2836 | (with-current-buffer " *ex-working-space*" |
| 2851 | (set-buffer " *ex-working-space*") | ||
| 2852 | (skip-chars-forward " \t") | 2837 | (skip-chars-forward " \t") |
| 2853 | (setq char (char-to-string (following-char))) | 2838 | (setq char (char-to-string (following-char))) |
| 2854 | (forward-char 1) | 2839 | (forward-char 1) |
| @@ -2870,8 +2855,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2870 | (defun ex-quit () | 2855 | (defun ex-quit () |
| 2871 | "ex quit" | 2856 | "ex quit" |
| 2872 | (let (char) | 2857 | (let (char) |
| 2873 | (save-window-excursion | 2858 | (with-current-buffer " *ex-working-space*" |
| 2874 | (set-buffer " *ex-working-space*") | ||
| 2875 | (skip-chars-forward " \t") | 2859 | (skip-chars-forward " \t") |
| 2876 | (setq char (following-char))) | 2860 | (setq char (following-char))) |
| 2877 | (if (= char ?!) (kill-emacs t) (save-buffers-kill-emacs)))) | 2861 | (if (= char ?!) (kill-emacs t) (save-buffers-kill-emacs)))) |
| @@ -2883,8 +2867,7 @@ a token has type \(command, address, end-mark\) and value." | |||
| 2883 | (goto-char point) | 2867 | (goto-char point) |
| 2884 | (if (not (= point 0)) (with-no-warnings (next-line 1))) | 2868 | (if (not (= point 0)) (with-no-warnings (next-line 1))) |
| 2885 | (beginning-of-line) | 2869 | (beginning-of-line) |
| 2886 | (save-window-excursion | 2870 | (with-current-buffer " *ex-working-space*" |
| 2887 | (set-buffer " *ex-working-space*") | ||
| 2888 | (skip-chars-forward " \t") | 2871 | (skip-chars-forward " \t") |
| 2889 | (if (looking-at "!") | 2872 | (if (looking-at "!") |
| 2890 | (progn | 2873 | (progn |
| @@ -2981,8 +2964,7 @@ vip-s-string" | |||
| 2981 | (defun ex-tag () | 2964 | (defun ex-tag () |
| 2982 | "ex tag" | 2965 | "ex tag" |
| 2983 | (let (tag) | 2966 | (let (tag) |
| 2984 | (save-window-excursion | 2967 | (with-current-buffer " *ex-working-space*" |
| 2985 | (set-buffer " *ex-working-space*") | ||
| 2986 | (skip-chars-forward " \t") | 2968 | (skip-chars-forward " \t") |
| 2987 | (set-mark (point)) | 2969 | (set-mark (point)) |
| 2988 | (skip-chars-forward "^ |\t\n") | 2970 | (skip-chars-forward "^ |\t\n") |
| @@ -3045,8 +3027,7 @@ vip-s-string" | |||
| 3045 | (defun ex-command () | 3027 | (defun ex-command () |
| 3046 | "execute shell command" | 3028 | "execute shell command" |
| 3047 | (let (command) | 3029 | (let (command) |
| 3048 | (save-window-excursion | 3030 | (with-current-buffer " *ex-working-space*" |
| 3049 | (set-buffer " *ex-working-space*") | ||
| 3050 | (skip-chars-forward " \t") | 3031 | (skip-chars-forward " \t") |
| 3051 | (set-mark (point)) | 3032 | (set-mark (point)) |
| 3052 | (end-of-line) | 3033 | (end-of-line) |
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 53a4517b476..fdaeb13f3e2 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el | |||
| @@ -903,8 +903,7 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to | |||
| 903 | (signal 'quit nil))) | 903 | (signal 'quit nil))) |
| 904 | 904 | ||
| 905 | (if (not (equal buff (current-buffer))) ; cmd switched buffer | 905 | (if (not (equal buff (current-buffer))) ; cmd switched buffer |
| 906 | (save-excursion | 906 | (with-current-buffer buff |
| 907 | (set-buffer buff) | ||
| 908 | (viper-set-mode-vars-for viper-current-state))) | 907 | (viper-set-mode-vars-for viper-current-state))) |
| 909 | (viper-set-mode-vars-for viper-current-state) | 908 | (viper-set-mode-vars-for viper-current-state) |
| 910 | result)) | 909 | result)) |
| @@ -917,8 +916,7 @@ Similar to viper-escape-to-emacs, but accepts forms rather than keystrokes." | |||
| 917 | (viper-set-mode-vars-for 'emacs-state) | 916 | (viper-set-mode-vars-for 'emacs-state) |
| 918 | (setq result (eval form)) | 917 | (setq result (eval form)) |
| 919 | (if (not (equal buff (current-buffer))) ; cmd switched buffer | 918 | (if (not (equal buff (current-buffer))) ; cmd switched buffer |
| 920 | (save-excursion | 919 | (with-current-buffer buff |
| 921 | (set-buffer buff) | ||
| 922 | (viper-set-mode-vars-for viper-current-state))) | 920 | (viper-set-mode-vars-for viper-current-state))) |
| 923 | (viper-set-mode-vars-for viper-current-state) | 921 | (viper-set-mode-vars-for viper-current-state) |
| 924 | result)) | 922 | result)) |
| @@ -4697,8 +4695,7 @@ One can use `` and '' to temporarily jump 1 step back." | |||
| 4697 | (with-output-to-temp-buffer " *viper-info*" | 4695 | (with-output-to-temp-buffer " *viper-info*" |
| 4698 | (if (and buf pos) | 4696 | (if (and buf pos) |
| 4699 | (progn | 4697 | (progn |
| 4700 | (save-excursion | 4698 | (with-current-buffer buf |
| 4701 | (set-buffer buf) | ||
| 4702 | (setq line-no (1+ (count-lines (point-min) val))) | 4699 | (setq line-no (1+ (count-lines (point-min) val))) |
| 4703 | (goto-char pos) | 4700 | (goto-char pos) |
| 4704 | (beginning-of-line) | 4701 | (beginning-of-line) |
diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el index fcc98db3204..f156b677f5d 100644 --- a/lisp/emulation/viper-ex.el +++ b/lisp/emulation/viper-ex.el | |||
| @@ -946,16 +946,14 @@ reversed." | |||
| 946 | ;; Expand \% and \# in ex command | 946 | ;; Expand \% and \# in ex command |
| 947 | (defun ex-expand-filsyms (cmd buf) | 947 | (defun ex-expand-filsyms (cmd buf) |
| 948 | (let (cf pf ret) | 948 | (let (cf pf ret) |
| 949 | (save-excursion | 949 | (with-current-buffer buf |
| 950 | (set-buffer buf) | ||
| 951 | (setq cf buffer-file-name) | 950 | (setq cf buffer-file-name) |
| 952 | (setq pf (ex-next nil t))) ; this finds alternative file name | 951 | (setq pf (ex-next nil t))) ; this finds alternative file name |
| 953 | (if (and (null cf) (string-match "[^\\]%\\|\\`%" cmd)) | 952 | (if (and (null cf) (string-match "[^\\]%\\|\\`%" cmd)) |
| 954 | (error "No current file to substitute for `%%'")) | 953 | (error "No current file to substitute for `%%'")) |
| 955 | (if (and (null pf) (string-match "[^\\]#\\|\\`#" cmd)) | 954 | (if (and (null pf) (string-match "[^\\]#\\|\\`#" cmd)) |
| 956 | (error "No alternate file to substitute for `#'")) | 955 | (error "No alternate file to substitute for `#'")) |
| 957 | (save-excursion | 956 | (with-current-buffer (get-buffer-create viper-ex-tmp-buf-name) |
| 958 | (set-buffer (get-buffer-create viper-ex-tmp-buf-name)) | ||
| 959 | (erase-buffer) | 957 | (erase-buffer) |
| 960 | (insert cmd) | 958 | (insert cmd) |
| 961 | (goto-char (point-min)) | 959 | (goto-char (point-min)) |
| @@ -984,9 +982,8 @@ reversed." | |||
| 984 | ex-cmdfile nil | 982 | ex-cmdfile nil |
| 985 | ex-cmdfile-args "") | 983 | ex-cmdfile-args "") |
| 986 | (save-excursion | 984 | (save-excursion |
| 987 | (save-window-excursion | 985 | (with-current-buffer (setq viper-ex-work-buf |
| 988 | (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) | 986 | (get-buffer-create viper-ex-work-buf-name)) |
| 989 | (set-buffer viper-ex-work-buf) | ||
| 990 | (skip-chars-forward " \t") | 987 | (skip-chars-forward " \t") |
| 991 | (if (looking-at "!") | 988 | (if (looking-at "!") |
| 992 | (if (and (not (viper-looking-back "[ \t]")) | 989 | (if (and (not (viper-looking-back "[ \t]")) |
| @@ -1289,9 +1286,8 @@ reversed." | |||
| 1289 | (switch-to-buffer file)) | 1286 | (switch-to-buffer file)) |
| 1290 | (if ex-offset | 1287 | (if ex-offset |
| 1291 | (progn | 1288 | (progn |
| 1292 | (save-window-excursion | 1289 | (with-current-buffer (setq viper-ex-work-buf |
| 1293 | (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) | 1290 | (get-buffer-create viper-ex-work-buf-name)) |
| 1294 | (set-buffer viper-ex-work-buf) | ||
| 1295 | (delete-region (point-min) (point-max)) | 1291 | (delete-region (point-min) (point-max)) |
| 1296 | (insert ex-offset "\n") | 1292 | (insert ex-offset "\n") |
| 1297 | (goto-char (point-min))) | 1293 | (goto-char (point-min))) |
| @@ -1372,9 +1368,8 @@ reversed." | |||
| 1372 | (if (bobp) (setq cont nil) | 1368 | (if (bobp) (setq cont nil) |
| 1373 | (forward-line -1) | 1369 | (forward-line -1) |
| 1374 | (end-of-line))))) | 1370 | (end-of-line))))) |
| 1375 | (save-window-excursion | 1371 | (with-current-buffer (setq viper-ex-work-buf |
| 1376 | (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) | 1372 | (get-buffer-create viper-ex-work-buf-name)) |
| 1377 | (set-buffer viper-ex-work-buf) | ||
| 1378 | ;; com-str is the command string, i.e., g/pattern/ or v/pattern' | 1373 | ;; com-str is the command string, i.e., g/pattern/ or v/pattern' |
| 1379 | (setq com-str (buffer-substring (1+ (point)) (1- (point-max))))) | 1374 | (setq com-str (buffer-substring (1+ (point)) (1- (point-max))))) |
| 1380 | (while ex-g-marks | 1375 | (while ex-g-marks |
| @@ -1453,18 +1448,17 @@ reversed." | |||
| 1453 | (setq char (string-to-char name)) | 1448 | (setq char (string-to-char name)) |
| 1454 | (error "`%s': Spurious text \"%s\" after mark name" | 1449 | (error "`%s': Spurious text \"%s\" after mark name" |
| 1455 | name (substring name 1))) | 1450 | name (substring name 1))) |
| 1456 | (save-window-excursion | 1451 | (with-current-buffer (setq viper-ex-work-buf |
| 1457 | (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) | 1452 | (get-buffer-create viper-ex-work-buf-name)) |
| 1458 | (set-buffer viper-ex-work-buf) | 1453 | (skip-chars-forward " \t") |
| 1459 | (skip-chars-forward " \t") | 1454 | (if (looking-at "[a-z]") |
| 1460 | (if (looking-at "[a-z]") | 1455 | (progn |
| 1461 | (progn | 1456 | (setq char (following-char)) |
| 1462 | (setq char (following-char)) | 1457 | (forward-char 1) |
| 1463 | (forward-char 1) | 1458 | (skip-chars-forward " \t") |
| 1464 | (skip-chars-forward " \t") | 1459 | (if (not (looking-at "[\n|]")) |
| 1465 | (if (not (looking-at "[\n|]")) | 1460 | (error "`%s': %s" ex-token viper-SpuriousText))) |
| 1466 | (error "`%s': %s" ex-token viper-SpuriousText))) | 1461 | (error "`%s' requires a following letter" ex-token)))) |
| 1467 | (error "`%s' requires a following letter" ex-token)))) | ||
| 1468 | (save-excursion | 1462 | (save-excursion |
| 1469 | (goto-char (car ex-addresses)) | 1463 | (goto-char (car ex-addresses)) |
| 1470 | (point-to-register (viper-int-to-char (1+ (- char ?a))))))) | 1464 | (point-to-register (viper-int-to-char (1+ (- char ?a))))))) |
| @@ -1560,8 +1554,7 @@ reversed." | |||
| 1560 | (select-window wind))) | 1554 | (select-window wind))) |
| 1561 | (save-window-excursion (select-window wind) (sit-for 1))) | 1555 | (save-window-excursion (select-window wind) (sit-for 1))) |
| 1562 | 1556 | ||
| 1563 | (save-excursion | 1557 | (with-current-buffer buf |
| 1564 | (set-buffer buf) | ||
| 1565 | (setq viper-related-files-and-buffers-ring old-ring)) | 1558 | (setq viper-related-files-and-buffers-ring old-ring)) |
| 1566 | 1559 | ||
| 1567 | (setq viper-local-search-start-marker (point-marker)) | 1560 | (setq viper-local-search-start-marker (point-marker)) |
| @@ -1588,9 +1581,8 @@ reversed." | |||
| 1588 | ;; Ex quit command | 1581 | ;; Ex quit command |
| 1589 | (defun ex-quit () | 1582 | (defun ex-quit () |
| 1590 | ;; skip "!", if it is q!. In Viper q!, w!, etc., behave as q, w, etc. | 1583 | ;; skip "!", if it is q!. In Viper q!, w!, etc., behave as q, w, etc. |
| 1591 | (save-excursion | 1584 | (with-current-buffer (setq viper-ex-work-buf |
| 1592 | (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) | 1585 | (get-buffer-create viper-ex-work-buf-name)) |
| 1593 | (set-buffer viper-ex-work-buf) | ||
| 1594 | (if (looking-at "!") (forward-char 1))) | 1586 | (if (looking-at "!") (forward-char 1))) |
| 1595 | (if (< viper-expert-level 3) | 1587 | (if (< viper-expert-level 3) |
| 1596 | (save-buffers-kill-emacs) | 1588 | (save-buffers-kill-emacs) |
| @@ -1837,9 +1829,8 @@ reversed." | |||
| 1837 | ;; Optional 3d arg is a string that should replace ' ' to prevent its | 1829 | ;; Optional 3d arg is a string that should replace ' ' to prevent its |
| 1838 | ;; special meaning | 1830 | ;; special meaning |
| 1839 | (defun ex-get-inline-cmd-args (regex-forw &optional chars-back replace-str) | 1831 | (defun ex-get-inline-cmd-args (regex-forw &optional chars-back replace-str) |
| 1840 | (save-excursion | 1832 | (with-current-buffer (setq viper-ex-work-buf |
| 1841 | (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) | 1833 | (get-buffer-create viper-ex-work-buf-name)) |
| 1842 | (set-buffer viper-ex-work-buf) | ||
| 1843 | (goto-char (point-min)) | 1834 | (goto-char (point-min)) |
| 1844 | (re-search-forward regex-forw nil t) | 1835 | (re-search-forward regex-forw nil t) |
| 1845 | (let ((beg (point)) | 1836 | (let ((beg (point)) |
| @@ -1987,9 +1978,8 @@ Please contact your system administrator. " | |||
| 1987 | ;; Ex tag command | 1978 | ;; Ex tag command |
| 1988 | (defun ex-tag () | 1979 | (defun ex-tag () |
| 1989 | (let (tag) | 1980 | (let (tag) |
| 1990 | (save-window-excursion | 1981 | (with-current-buffer (setq viper-ex-work-buf |
| 1991 | (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) | 1982 | (get-buffer-create viper-ex-work-buf-name)) |
| 1992 | (set-buffer viper-ex-work-buf) | ||
| 1993 | (skip-chars-forward " \t") | 1983 | (skip-chars-forward " \t") |
| 1994 | (set-mark (point)) | 1984 | (set-mark (point)) |
| 1995 | (skip-chars-forward "^ |\t\n") | 1985 | (skip-chars-forward "^ |\t\n") |
| @@ -2148,9 +2138,8 @@ Please contact your system administrator. " | |||
| 2148 | ;; Execute shell command | 2138 | ;; Execute shell command |
| 2149 | (defun ex-command () | 2139 | (defun ex-command () |
| 2150 | (let (command) | 2140 | (let (command) |
| 2151 | (save-window-excursion | 2141 | (with-current-buffer (setq viper-ex-work-buf |
| 2152 | (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) | 2142 | (get-buffer-create viper-ex-work-buf-name)) |
| 2153 | (set-buffer viper-ex-work-buf) | ||
| 2154 | (skip-chars-forward " \t") | 2143 | (skip-chars-forward " \t") |
| 2155 | (setq command (buffer-substring (point) (point-max))) | 2144 | (setq command (buffer-substring (point) (point-max))) |
| 2156 | (end-of-line)) | 2145 | (end-of-line)) |
| @@ -2178,9 +2167,8 @@ Please contact your system administrator. " | |||
| 2178 | If no args are given, then it runs the last compile command. | 2167 | If no args are given, then it runs the last compile command. |
| 2179 | Type 'mak ' (including the space) to run make with no args." | 2168 | Type 'mak ' (including the space) to run make with no args." |
| 2180 | (let (args) | 2169 | (let (args) |
| 2181 | (save-window-excursion | 2170 | (with-current-buffer (setq viper-ex-work-buf |
| 2182 | (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) | 2171 | (get-buffer-create viper-ex-work-buf-name)) |
| 2183 | (set-buffer viper-ex-work-buf) | ||
| 2184 | (setq args (buffer-substring (point) (point-max))) | 2172 | (setq args (buffer-substring (point) (point-max))) |
| 2185 | (end-of-line)) | 2173 | (end-of-line)) |
| 2186 | ;; Remove the newline that may (will?) be at the end of the args | 2174 | ;; Remove the newline that may (will?) be at the end of the args |
diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el index 31f8deb5d34..453a23329ad 100644 --- a/lisp/emulation/viper-keym.el +++ b/lisp/emulation/viper-keym.el | |||
| @@ -165,8 +165,7 @@ Enter as a sexp. Examples: \"\\C-z\", [(control ?z)]." | |||
| 165 | [(control ?z)]))) | 165 | [(control ?z)]))) |
| 166 | (mapc | 166 | (mapc |
| 167 | (lambda (buf) | 167 | (lambda (buf) |
| 168 | (save-excursion | 168 | (with-current-buffer buf |
| 169 | (set-buffer buf) | ||
| 170 | (when (and (boundp 'viper-insert-basic-map) | 169 | (when (and (boundp 'viper-insert-basic-map) |
| 171 | (keymapp viper-insert-basic-map)) | 170 | (keymapp viper-insert-basic-map)) |
| 172 | (when old-value | 171 | (when old-value |
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index 1ee1acaee98..503265c8b85 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el | |||
| @@ -409,8 +409,7 @@ Otherwise return the normal value." | |||
| 409 | (command (cond (viper-ms-style-os-p (format "\"ls -1 -d %s\"" filespec)) | 409 | (command (cond (viper-ms-style-os-p (format "\"ls -1 -d %s\"" filespec)) |
| 410 | (t (format "ls -1 -d %s" filespec)))) | 410 | (t (format "ls -1 -d %s" filespec)))) |
| 411 | status) | 411 | status) |
| 412 | (save-excursion | 412 | (with-current-buffer (get-buffer-create viper-ex-tmp-buf-name) |
| 413 | (set-buffer (get-buffer-create viper-ex-tmp-buf-name)) | ||
| 414 | (erase-buffer) | 413 | (erase-buffer) |
| 415 | (setq status | 414 | (setq status |
| 416 | (if gshell-options | 415 | (if gshell-options |
| @@ -467,8 +466,7 @@ Otherwise return the normal value." | |||
| 467 | 466 | ||
| 468 | ;; convert MS-DOS wildcards to regexp | 467 | ;; convert MS-DOS wildcards to regexp |
| 469 | (defun viper-wildcard-to-regexp (wcard) | 468 | (defun viper-wildcard-to-regexp (wcard) |
| 470 | (save-excursion | 469 | (with-current-buffer (get-buffer-create viper-ex-tmp-buf-name) |
| 471 | (set-buffer (get-buffer-create viper-ex-tmp-buf-name)) | ||
| 472 | (erase-buffer) | 470 | (erase-buffer) |
| 473 | (insert wcard) | 471 | (insert wcard) |
| 474 | (goto-char (point-min)) | 472 | (goto-char (point-min)) |
| @@ -488,8 +486,7 @@ Otherwise return the normal value." | |||
| 488 | (defun viper-glob-mswindows-files (filespec) | 486 | (defun viper-glob-mswindows-files (filespec) |
| 489 | (let ((case-fold-search t) | 487 | (let ((case-fold-search t) |
| 490 | tmp tmp2) | 488 | tmp tmp2) |
| 491 | (save-excursion | 489 | (with-current-buffer (get-buffer-create viper-ex-tmp-buf-name) |
| 492 | (set-buffer (get-buffer-create viper-ex-tmp-buf-name)) | ||
| 493 | (erase-buffer) | 490 | (erase-buffer) |
| 494 | (insert filespec) | 491 | (insert filespec) |
| 495 | (goto-char (point-min)) | 492 | (goto-char (point-min)) |
| @@ -654,8 +651,7 @@ Otherwise return the normal value." | |||
| 654 | (buf (find-file-noselect (substitute-in-file-name custom-file))) | 651 | (buf (find-file-noselect (substitute-in-file-name custom-file))) |
| 655 | ) | 652 | ) |
| 656 | (message "%s" (or message "")) | 653 | (message "%s" (or message "")) |
| 657 | (save-excursion | 654 | (with-current-buffer buf |
| 658 | (set-buffer buf) | ||
| 659 | (goto-char (point-min)) | 655 | (goto-char (point-min)) |
| 660 | (if (re-search-forward regexp nil t) | 656 | (if (re-search-forward regexp nil t) |
| 661 | (let ((reg-end (1- (match-end 0)))) | 657 | (let ((reg-end (1- (match-end 0)))) |
| @@ -678,8 +674,7 @@ Otherwise return the normal value." | |||
| 678 | ;; match this pattern. | 674 | ;; match this pattern. |
| 679 | (defun viper-save-string-in-file (string custom-file &optional pattern) | 675 | (defun viper-save-string-in-file (string custom-file &optional pattern) |
| 680 | (let ((buf (find-file-noselect (substitute-in-file-name custom-file)))) | 676 | (let ((buf (find-file-noselect (substitute-in-file-name custom-file)))) |
| 681 | (save-excursion | 677 | (with-current-buffer buf |
| 682 | (set-buffer buf) | ||
| 683 | (let (buffer-read-only) | 678 | (let (buffer-read-only) |
| 684 | (goto-char (point-min)) | 679 | (goto-char (point-min)) |
| 685 | (if pattern (delete-matching-lines pattern)) | 680 | (if pattern (delete-matching-lines pattern)) |
| @@ -889,8 +884,7 @@ Otherwise return the normal value." | |||
| 889 | (if (and (markerp marker) (marker-buffer marker)) | 884 | (if (and (markerp marker) (marker-buffer marker)) |
| 890 | (let ((buf (marker-buffer marker)) | 885 | (let ((buf (marker-buffer marker)) |
| 891 | (pos (marker-position marker))) | 886 | (pos (marker-position marker))) |
| 892 | (save-excursion | 887 | (with-current-buffer buf |
| 893 | (set-buffer buf) | ||
| 894 | (and (<= pos (point-max)) (<= (point-min) pos)))))) | 888 | (and (<= pos (point-max)) (<= (point-min) pos)))))) |
| 895 | 889 | ||
| 896 | (defsubst viper-mark-marker () | 890 | (defsubst viper-mark-marker () |
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index a179e163933..c6194c65bdc 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el | |||
| @@ -647,10 +647,9 @@ This startup message appears whenever you load Viper, unless you type `y' now." | |||
| 647 | ;; Remove local value in all existing buffers | 647 | ;; Remove local value in all existing buffers |
| 648 | ;; This doesn't delocalize vars (which would have been desirable) | 648 | ;; This doesn't delocalize vars (which would have been desirable) |
| 649 | (defun viper-delocalize-var (symbol) | 649 | (defun viper-delocalize-var (symbol) |
| 650 | (mapcar (lambda (buf) (save-excursion | 650 | (dolist (buf (buffer-list)) |
| 651 | (set-buffer buf) | 651 | (with-current-buffer buf |
| 652 | (kill-local-variable symbol))) | 652 | (kill-local-variable symbol)))) |
| 653 | (buffer-list))) | ||
| 654 | 653 | ||
| 655 | 654 | ||
| 656 | (defun viper-go-away () | 655 | (defun viper-go-away () |
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index 20d5f49e7f5..66df190d7ab 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2009-11-03 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * erc.el (erc-display-line-1, erc-process-away): | ||
| 4 | * erc-truncate.el (erc-truncate-buffer-to-size): | ||
| 5 | Use with-current-buffer. | ||
| 6 | |||
| 1 | 2009-10-24 Glenn Morris <rgm@gnu.org> | 7 | 2009-10-24 Glenn Morris <rgm@gnu.org> |
| 2 | 8 | ||
| 3 | * erc-dcc.el (pcomplete-erc-all-nicks): | 9 | * erc-dcc.el (pcomplete-erc-all-nicks): |
diff --git a/lisp/erc/erc-truncate.el b/lisp/erc/erc-truncate.el index 137152ca99b..1a0e2050561 100644 --- a/lisp/erc/erc-truncate.el +++ b/lisp/erc/erc-truncate.el | |||
| @@ -66,8 +66,7 @@ region is logged if `erc-logging-enabled' returns non-nil." | |||
| 66 | (unless (get-buffer buffer) | 66 | (unless (get-buffer buffer) |
| 67 | (error "erc-truncate-buffer-to-size: %S is not a buffer" buffer))) | 67 | (error "erc-truncate-buffer-to-size: %S is not a buffer" buffer))) |
| 68 | (when (> (buffer-size buffer) (+ size 512)) | 68 | (when (> (buffer-size buffer) (+ size 512)) |
| 69 | (save-excursion | 69 | (with-current-buffer buffer |
| 70 | (set-buffer buffer) | ||
| 71 | ;; Note that when erc-insert-post-hook runs, the buffer is | 70 | ;; Note that when erc-insert-post-hook runs, the buffer is |
| 72 | ;; narrowed to the new message. So do this delicate widening. | 71 | ;; narrowed to the new message. So do this delicate widening. |
| 73 | ;; I am not sure, I think this was not recommended behavior in | 72 | ;; I am not sure, I think this was not recommended behavior in |
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index f2fc892bb65..3224c1fb575 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el | |||
| @@ -2358,8 +2358,7 @@ If `erc-insert-this' is still t, STRING gets inserted into the buffer. | |||
| 2358 | Afterwards, `erc-insert-modify' and `erc-insert-post-hook' get called. | 2358 | Afterwards, `erc-insert-modify' and `erc-insert-post-hook' get called. |
| 2359 | If STRING is nil, the function does nothing." | 2359 | If STRING is nil, the function does nothing." |
| 2360 | (when string | 2360 | (when string |
| 2361 | (save-excursion | 2361 | (with-current-buffer (or buffer (process-buffer erc-server-process)) |
| 2362 | (set-buffer (or buffer (process-buffer erc-server-process))) | ||
| 2363 | (let ((insert-position (or (marker-position erc-insert-marker) | 2362 | (let ((insert-position (or (marker-position erc-insert-marker) |
| 2364 | (point-max)))) | 2363 | (point-max)))) |
| 2365 | (let ((string string) ;; FIXME! Can this be removed? | 2364 | (let ((string string) ;; FIXME! Can this be removed? |
| @@ -4513,8 +4512,7 @@ If non-nil, return from being away." | |||
| 4513 | ;; away must be set to NIL BEFORE sending anything to prevent | 4512 | ;; away must be set to NIL BEFORE sending anything to prevent |
| 4514 | ;; an infinite recursion | 4513 | ;; an infinite recursion |
| 4515 | (setq erc-away nil) | 4514 | (setq erc-away nil) |
| 4516 | (save-excursion | 4515 | (with-current-buffer (erc-active-buffer) |
| 4517 | (set-buffer (erc-active-buffer)) | ||
| 4518 | (when erc-public-away-p | 4516 | (when erc-public-away-p |
| 4519 | (erc-send-action | 4517 | (erc-send-action |
| 4520 | (erc-default-target) | 4518 | (erc-default-target) |
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 38be63275be..dab1ab8f955 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el | |||
| @@ -667,8 +667,7 @@ Concatenate FILE(s), or standard input, to standard output.") | |||
| 667 | "In Occur mode, go to the occurrence whose line you click on." | 667 | "In Occur mode, go to the occurrence whose line you click on." |
| 668 | (interactive "e") | 668 | (interactive "e") |
| 669 | (let (pos) | 669 | (let (pos) |
| 670 | (save-excursion | 670 | (with-current-buffer (window-buffer (posn-window (event-end event))) |
| 671 | (set-buffer (window-buffer (posn-window (event-end event)))) | ||
| 672 | (save-excursion | 671 | (save-excursion |
| 673 | (goto-char (posn-point (event-end event))) | 672 | (goto-char (posn-point (event-end event))) |
| 674 | (setq pos (occur-mode-find-occurrence)))) | 673 | (setq pos (occur-mode-find-occurrence)))) |
diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el index 719bb308a6c..9fc7d86b328 100644 --- a/lisp/eshell/esh-ext.el +++ b/lisp/eshell/esh-ext.el | |||
| @@ -194,10 +194,8 @@ causing the user to wonder if anything's really going on..." | |||
| 194 | (mapconcat 'shell-quote-argument | 194 | (mapconcat 'shell-quote-argument |
| 195 | (append (list command) args) " ") | 195 | (append (list command) args) " ") |
| 196 | outbuf errbuf)) | 196 | outbuf errbuf)) |
| 197 | (eshell-print (save-excursion (set-buffer outbuf) | 197 | (eshell-print (with-current-buffer outbuf (buffer-string))) |
| 198 | (buffer-string))) | 198 | (eshell-error (with-current-buffer errbuf (buffer-string)))) |
| 199 | (eshell-error (save-excursion (set-buffer errbuf) | ||
| 200 | (buffer-string)))) | ||
| 201 | (eshell-close-handles exitcode 'nil) | 199 | (eshell-close-handles exitcode 'nil) |
| 202 | (kill-buffer outbuf) | 200 | (kill-buffer outbuf) |
| 203 | (kill-buffer errbuf)))) | 201 | (kill-buffer errbuf)))) |
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el index 2449adb5ee7..5fc8b1bc5ef 100644 --- a/lisp/mail/feedmail.el +++ b/lisp/mail/feedmail.el | |||
| @@ -1628,8 +1628,7 @@ backup file names and the like)." | |||
| 1628 | (if (and already-buffer (not (file-exists-p maybe-file))) | 1628 | (if (and already-buffer (not (file-exists-p maybe-file))) |
| 1629 | ;; we have gotten rid of the file associated with the | 1629 | ;; we have gotten rid of the file associated with the |
| 1630 | ;; buffer, so update the buffer's notion of that | 1630 | ;; buffer, so update the buffer's notion of that |
| 1631 | (save-excursion | 1631 | (with-current-buffer already-buffer |
| 1632 | (set-buffer already-buffer) | ||
| 1633 | (setq buffer-file-name nil))))) | 1632 | (setq buffer-file-name nil))))) |
| 1634 | (error (setq messages-skipped (1+ messages-skipped)))) | 1633 | (error (setq messages-skipped (1+ messages-skipped)))) |
| 1635 | (kill-buffer blobby-buffer) | 1634 | (kill-buffer blobby-buffer) |
| @@ -1801,7 +1800,8 @@ see the variable feedmail-prompt-before-queue-user-alist. | |||
| 1801 | ") | 1800 | ") |
| 1802 | (and (stringp feedmail-prompt-before-queue-help-supplement) | 1801 | (and (stringp feedmail-prompt-before-queue-help-supplement) |
| 1803 | (princ feedmail-prompt-before-queue-help-supplement)) | 1802 | (princ feedmail-prompt-before-queue-help-supplement)) |
| 1804 | (save-excursion (set-buffer standard-output) (if (fboundp 'help-mode) (help-mode))))) | 1803 | (with-current-buffer standard-output |
| 1804 | (if (fboundp 'help-mode) (help-mode))))) | ||
| 1805 | 1805 | ||
| 1806 | (defun feedmail-look-at-queue-directory (queue-directory) | 1806 | (defun feedmail-look-at-queue-directory (queue-directory) |
| 1807 | "Find out some things about a queue directory. | 1807 | "Find out some things about a queue directory. |
| @@ -1970,7 +1970,7 @@ mapped to mostly alphanumerics for safety." | |||
| 1970 | (mail-header-separator mail-header-separator) | 1970 | (mail-header-separator mail-header-separator) |
| 1971 | ) | 1971 | ) |
| 1972 | (unwind-protect | 1972 | (unwind-protect |
| 1973 | (save-excursion | 1973 | (save-current-buffer |
| 1974 | (set-buffer feedmail-error-buffer) (erase-buffer) | 1974 | (set-buffer feedmail-error-buffer) (erase-buffer) |
| 1975 | (set-buffer feedmail-prepped-text-buffer) (erase-buffer) | 1975 | (set-buffer feedmail-prepped-text-buffer) (erase-buffer) |
| 1976 | 1976 | ||
| @@ -2075,18 +2075,17 @@ mapped to mostly alphanumerics for safety." | |||
| 2075 | (if (and (not feedmail-queue-runner-is-active) (setq also-file (buffer-file-name feedmail-raw-text-buffer))) | 2075 | (if (and (not feedmail-queue-runner-is-active) (setq also-file (buffer-file-name feedmail-raw-text-buffer))) |
| 2076 | (progn ; if a file but not running the queue, offer to delete it | 2076 | (progn ; if a file but not running the queue, offer to delete it |
| 2077 | (setq also-file (expand-file-name also-file)) | 2077 | (setq also-file (expand-file-name also-file)) |
| 2078 | (if (or feedmail-queue-auto-file-nuke | 2078 | (when (or feedmail-queue-auto-file-nuke |
| 2079 | (y-or-n-p (format "FQM: Delete message file %s? " also-file))) | 2079 | (y-or-n-p |
| 2080 | (save-excursion | 2080 | (format "FQM: Delete message file %s? " |
| 2081 | ;; if we delete the affiliated file, get rid | 2081 | also-file))) |
| 2082 | ;; of the file name association and make sure we | 2082 | ;; if we delete the affiliated file, get rid |
| 2083 | ;; don't annoy people with a prompt on exit | 2083 | ;; of the file name association and make sure we |
| 2084 | (delete-file also-file) | 2084 | ;; don't annoy people with a prompt on exit |
| 2085 | (set-buffer feedmail-raw-text-buffer) | 2085 | (delete-file also-file) |
| 2086 | (setq buffer-offer-save nil) | 2086 | (with-current-buffer feedmail-raw-text-buffer |
| 2087 | (setq buffer-file-name nil) | 2087 | (setq buffer-offer-save nil) |
| 2088 | ) | 2088 | (setq buffer-file-name nil))))) |
| 2089 | ))) | ||
| 2090 | (goto-char (point-min)) | 2089 | (goto-char (point-min)) |
| 2091 | ;; re-insert and handle any Fcc fields (and, optionally, any Bcc). | 2090 | ;; re-insert and handle any Fcc fields (and, optionally, any Bcc). |
| 2092 | (if fcc (letf (((default-value 'buffer-file-type) | 2091 | (if fcc (letf (((default-value 'buffer-file-type) |
| @@ -2197,18 +2196,19 @@ fiddle-plex, as described in the documentation for the variable | |||
| 2197 | (mapcar | 2196 | (mapcar |
| 2198 | '(lambda (feedmail-spray-this-address) | 2197 | '(lambda (feedmail-spray-this-address) |
| 2199 | (let ((spray-buffer (get-buffer-create " *FQM Outgoing Email Spray*"))) | 2198 | (let ((spray-buffer (get-buffer-create " *FQM Outgoing Email Spray*"))) |
| 2200 | (save-excursion | 2199 | (with-current-buffer spray-buffer |
| 2201 | (set-buffer spray-buffer) | ||
| 2202 | (erase-buffer) | 2200 | (erase-buffer) |
| 2203 | ;; not life's most efficient methodology, but spraying isn't | 2201 | ;; not life's most efficient methodology, but spraying isn't |
| 2204 | ;; an every-5-minutes event either | 2202 | ;; an every-5-minutes event either |
| 2205 | (insert-buffer-substring feedmail-prepped-text-buffer) | 2203 | (insert-buffer-substring feedmail-prepped-text-buffer) |
| 2206 | ;; There's a good case to me made that each separate transmission of | 2204 | ;; There's a good case to me made that each separate |
| 2207 | ;; a message in the spray should have a distinct Message-Id:. There | 2205 | ;; transmission of a message in the spray should |
| 2208 | ;; is also a less compelling argument in the other direction. I think | 2206 | ;; have a distinct Message-Id:. There is also a less |
| 2209 | ;; they technically should have distinct Message-Id:s, but I doubt that | 2207 | ;; compelling argument in the other direction. |
| 2210 | ;; anyone cares, practically. If someone complains about it, I'll add | 2208 | ;; I think they technically should have distinct |
| 2211 | ;; it. | 2209 | ;; Message-Id:s, but I doubt that anyone cares, |
| 2210 | ;; practically. If someone complains about it, I'll | ||
| 2211 | ;; add it. | ||
| 2212 | (feedmail-fiddle-list-of-spray-fiddle-plexes feedmail-spray-address-fiddle-plex-list) | 2212 | (feedmail-fiddle-list-of-spray-fiddle-plexes feedmail-spray-address-fiddle-plex-list) |
| 2213 | ;; this (let ) is just in case some buffer eater | 2213 | ;; this (let ) is just in case some buffer eater |
| 2214 | ;; is cheating and using the global variable name instead | 2214 | ;; is cheating and using the global variable name instead |
| @@ -2593,8 +2593,8 @@ been weeded out." | |||
| 2593 | (this-line) | 2593 | (this-line) |
| 2594 | (this-line-end)) | 2594 | (this-line-end)) |
| 2595 | (unwind-protect | 2595 | (unwind-protect |
| 2596 | (save-excursion | 2596 | (with-current-buffer (get-buffer-create " *FQM scratch*") |
| 2597 | (set-buffer (get-buffer-create " *FQM scratch*")) (erase-buffer) | 2597 | (erase-buffer) |
| 2598 | (insert-buffer-substring message-buffer header-start header-end) | 2598 | (insert-buffer-substring message-buffer header-start header-end) |
| 2599 | (goto-char (point-min)) | 2599 | (goto-char (point-min)) |
| 2600 | (let ((case-fold-search t)) | 2600 | (let ((case-fold-search t)) |
diff --git a/lisp/mail/hashcash.el b/lisp/mail/hashcash.el index 9bcf449da91..07a7355bd76 100644 --- a/lisp/mail/hashcash.el +++ b/lisp/mail/hashcash.el | |||
| @@ -161,8 +161,7 @@ For example, you may want to set this to '(\"-Z2\") to reduce header length." | |||
| 161 | "Generate a hashcash payment by finding a VAL-bit collison on STR." | 161 | "Generate a hashcash payment by finding a VAL-bit collison on STR." |
| 162 | (if (and (> val 0) | 162 | (if (and (> val 0) |
| 163 | hashcash-path) | 163 | hashcash-path) |
| 164 | (save-excursion | 164 | (with-current-buffer (get-buffer-create " *hashcash*") |
| 165 | (set-buffer (get-buffer-create " *hashcash*")) | ||
| 166 | (erase-buffer) | 165 | (erase-buffer) |
| 167 | (apply 'call-process hashcash-path nil t nil | 166 | (apply 'call-process hashcash-path nil t nil |
| 168 | "-m" "-q" "-b" (number-to-string val) str | 167 | "-m" "-q" "-b" (number-to-string val) str |
diff --git a/lisp/mail/mailpost.el b/lisp/mail/mailpost.el index 6423cd02b72..58e76743858 100644 --- a/lisp/mail/mailpost.el +++ b/lisp/mail/mailpost.el | |||
| @@ -36,8 +36,7 @@ site-init." | |||
| 36 | delimline | 36 | delimline |
| 37 | (mailbuf (current-buffer))) | 37 | (mailbuf (current-buffer))) |
| 38 | (unwind-protect | 38 | (unwind-protect |
| 39 | (save-excursion | 39 | (with-current-buffer tembuf |
| 40 | (set-buffer tembuf) | ||
| 41 | (erase-buffer) | 40 | (erase-buffer) |
| 42 | (insert-buffer-substring mailbuf) | 41 | (insert-buffer-substring mailbuf) |
| 43 | (goto-char (point-max)) | 42 | (goto-char (point-max)) |
| @@ -73,8 +72,7 @@ site-init." | |||
| 73 | (if (re-search-forward "^Subject:[ \t]*\n" delimline t) | 72 | (if (re-search-forward "^Subject:[ \t]*\n" delimline t) |
| 74 | (replace-match "")) | 73 | (replace-match "")) |
| 75 | (if mail-interactive | 74 | (if mail-interactive |
| 76 | (save-excursion | 75 | (with-current-buffer errbuf |
| 77 | (set-buffer errbuf) | ||
| 78 | (erase-buffer)))) | 76 | (erase-buffer)))) |
| 79 | (let ((m (default-file-modes))) | 77 | (let ((m (default-file-modes))) |
| 80 | (unwind-protect | 78 | (unwind-protect |
| @@ -91,8 +89,7 @@ site-init." | |||
| 91 | (if mail-interactive '("-watch") '("-nowatch")) | 89 | (if mail-interactive '("-watch") '("-nowatch")) |
| 92 | (list temfile))) | 90 | (list temfile))) |
| 93 | (if mail-interactive | 91 | (if mail-interactive |
| 94 | (save-excursion | 92 | (with-current-buffer errbuf |
| 95 | (set-buffer errbuf) | ||
| 96 | (goto-char (point-min)) | 93 | (goto-char (point-min)) |
| 97 | (while (re-search-forward "\n\n* *" nil t) | 94 | (while (re-search-forward "\n\n* *" nil t) |
| 98 | (replace-match "; ")) | 95 | (replace-match "; ")) |
diff --git a/lisp/mail/reporter.el b/lisp/mail/reporter.el index cf186c3e008..0fa87969e9e 100644 --- a/lisp/mail/reporter.el +++ b/lisp/mail/reporter.el | |||
| @@ -174,8 +174,7 @@ composed.") | |||
| 174 | MAILBUF is the mail buffer being composed." | 174 | MAILBUF is the mail buffer being composed." |
| 175 | (reporter-update-status) | 175 | (reporter-update-status) |
| 176 | (condition-case nil | 176 | (condition-case nil |
| 177 | (let ((val (save-excursion | 177 | (let ((val (with-current-buffer reporter-eval-buffer |
| 178 | (set-buffer reporter-eval-buffer) | ||
| 179 | (symbol-value varsym))) | 178 | (symbol-value varsym))) |
| 180 | (sym (symbol-name varsym)) | 179 | (sym (symbol-name varsym)) |
| 181 | (print-escape-newlines t) | 180 | (print-escape-newlines t) |
| @@ -201,8 +200,7 @@ MAILBUF is the mail buffer being composed." | |||
| 201 | (reporter-beautify-list maxwidth compact-p)))) | 200 | (reporter-beautify-list maxwidth compact-p)))) |
| 202 | (insert "\n")) | 201 | (insert "\n")) |
| 203 | (void-variable | 202 | (void-variable |
| 204 | (save-excursion | 203 | (with-current-buffer mailbuf |
| 205 | (set-buffer mailbuf) | ||
| 206 | (mail-position-on-field "X-Reporter-Void-Vars-Found") | 204 | (mail-position-on-field "X-Reporter-Void-Vars-Found") |
| 207 | (end-of-line) | 205 | (end-of-line) |
| 208 | (insert (symbol-name varsym) " "))) | 206 | (insert (symbol-name varsym) " "))) |
| @@ -247,8 +245,7 @@ dumped." | |||
| 247 | (condition-case fault | 245 | (condition-case fault |
| 248 | (let ((mailbuf (current-buffer)) | 246 | (let ((mailbuf (current-buffer)) |
| 249 | (elbuf (get-buffer-create " *tmp-reporter-buffer*"))) | 247 | (elbuf (get-buffer-create " *tmp-reporter-buffer*"))) |
| 250 | (save-excursion | 248 | (with-current-buffer elbuf |
| 251 | (set-buffer elbuf) | ||
| 252 | (emacs-lisp-mode) | 249 | (emacs-lisp-mode) |
| 253 | (erase-buffer) | 250 | (erase-buffer) |
| 254 | (insert "(setq\n") | 251 | (insert "(setq\n") |
diff --git a/lisp/mail/rfc822.el b/lisp/mail/rfc822.el index 3daf7d6fd60..1edd959269d 100644 --- a/lisp/mail/rfc822.el +++ b/lisp/mail/rfc822.el | |||
| @@ -278,44 +278,44 @@ | |||
| 278 | (list (substring header-text (match-beginning 1) (match-end 1))) | 278 | (list (substring header-text (match-beginning 1) (match-end 1))) |
| 279 | (let ((buf (generate-new-buffer " rfc822"))) | 279 | (let ((buf (generate-new-buffer " rfc822"))) |
| 280 | (unwind-protect | 280 | (unwind-protect |
| 281 | (save-excursion | 281 | (with-current-buffer buf |
| 282 | (set-buffer buf) | 282 | (make-local-variable 'case-fold-search) |
| 283 | (make-local-variable 'case-fold-search) | 283 | (setq case-fold-search nil) ;For speed(?) |
| 284 | (setq case-fold-search nil) ;For speed(?) | 284 | (insert header-text) |
| 285 | (insert header-text) | 285 | ;; unfold continuation lines |
| 286 | ;; unfold continuation lines | 286 | (goto-char (point-min)) |
| 287 | (goto-char (point-min)) | ||
| 288 | 287 | ||
| 289 | (while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ \t]" nil t) | 288 | (while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ \t]" |
| 290 | (replace-match "\\1 " t)) | 289 | nil t) |
| 290 | (replace-match "\\1 " t)) | ||
| 291 | 291 | ||
| 292 | (goto-char (point-min)) | 292 | (goto-char (point-min)) |
| 293 | (let ((list ()) | 293 | (let ((list ()) |
| 294 | tem | 294 | tem |
| 295 | ;; This is for rfc822-bad-address. Give it a non-nil | 295 | ;; This is for rfc822-bad-address. Give it a non-nil |
| 296 | ;; initial value to prevent rfc822-bad-address from | 296 | ;; initial value to prevent rfc822-bad-address from |
| 297 | ;; raising a wrong-type-argument error | 297 | ;; raising a wrong-type-argument error |
| 298 | (rfc822-address-start (point))) | 298 | (rfc822-address-start (point))) |
| 299 | (catch 'address ; this is for rfc822-bad-address | 299 | (catch 'address ; this is for rfc822-bad-address |
| 300 | (rfc822-nuke-whitespace) | 300 | (rfc822-nuke-whitespace) |
| 301 | (while (not (eobp)) | 301 | (while (not (eobp)) |
| 302 | (setq rfc822-address-start (point)) | 302 | (setq rfc822-address-start (point)) |
| 303 | (setq tem | 303 | (setq tem |
| 304 | (cond ((rfc822-looking-at ?\,) | 304 | (cond ((rfc822-looking-at ?\,) |
| 305 | nil) | 305 | nil) |
| 306 | ((looking-at "[][\000-\037@;:\\.>)]") | 306 | ((looking-at "[][\000-\037@;:\\.>)]") |
| 307 | (forward-char) | 307 | (forward-char) |
| 308 | (rfc822-bad-address | 308 | (rfc822-bad-address |
| 309 | (format "Strange character \\%c found" | 309 | (format "Strange character \\%c found" |
| 310 | (preceding-char)))) | 310 | (preceding-char)))) |
| 311 | (t | 311 | (t |
| 312 | (rfc822-addresses-1 t)))) | 312 | (rfc822-addresses-1 t)))) |
| 313 | (cond ((null tem)) | 313 | (cond ((null tem)) |
| 314 | ((stringp tem) | 314 | ((stringp tem) |
| 315 | (setq list (cons tem list))) | 315 | (setq list (cons tem list))) |
| 316 | (t | 316 | (t |
| 317 | (setq list (nconc (nreverse tem) list))))) | 317 | (setq list (nconc (nreverse tem) list))))) |
| 318 | (nreverse list)))) | 318 | (nreverse list)))) |
| 319 | (and buf (kill-buffer buf)))))) | 319 | (and buf (kill-buffer buf)))))) |
| 320 | 320 | ||
| 321 | (provide 'rfc822) | 321 | (provide 'rfc822) |
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index 03185a279f9..09e6329a230 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el | |||
| @@ -643,8 +643,7 @@ non-deleted messages." | |||
| 643 | With prefix argument N moves forward N messages with these labels." | 643 | With prefix argument N moves forward N messages with these labels." |
| 644 | (interactive "p\nsMove to next msg with labels: ") | 644 | (interactive "p\nsMove to next msg with labels: ") |
| 645 | (let (msg) | 645 | (let (msg) |
| 646 | (save-excursion | 646 | (with-current-buffer rmail-buffer |
| 647 | (set-buffer rmail-buffer) | ||
| 648 | (rmail-next-labeled-message n labels) | 647 | (rmail-next-labeled-message n labels) |
| 649 | (setq msg rmail-current-message)) | 648 | (setq msg rmail-current-message)) |
| 650 | (rmail-summary-goto-msg msg))) | 649 | (rmail-summary-goto-msg msg))) |
| @@ -654,8 +653,7 @@ With prefix argument N moves forward N messages with these labels." | |||
| 654 | With prefix argument N moves backward N messages with these labels." | 653 | With prefix argument N moves backward N messages with these labels." |
| 655 | (interactive "p\nsMove to previous msg with labels: ") | 654 | (interactive "p\nsMove to previous msg with labels: ") |
| 656 | (let (msg) | 655 | (let (msg) |
| 657 | (save-excursion | 656 | (with-current-buffer rmail-buffer |
| 658 | (set-buffer rmail-buffer) | ||
| 659 | (rmail-previous-labeled-message n labels) | 657 | (rmail-previous-labeled-message n labels) |
| 660 | (setq msg rmail-current-message)) | 658 | (setq msg rmail-current-message)) |
| 661 | (rmail-summary-goto-msg msg))) | 659 | (rmail-summary-goto-msg msg))) |
| @@ -809,8 +807,7 @@ Optional prefix ARG means undelete ARG previous messages." | |||
| 809 | (defun rmail-summary-undelete-many (&optional n) | 807 | (defun rmail-summary-undelete-many (&optional n) |
| 810 | "Undelete all deleted msgs, optional prefix arg N means undelete N prev msgs." | 808 | "Undelete all deleted msgs, optional prefix arg N means undelete N prev msgs." |
| 811 | (interactive "P") | 809 | (interactive "P") |
| 812 | (save-excursion | 810 | (with-current-buffer rmail-buffer |
| 813 | (set-buffer rmail-buffer) | ||
| 814 | (let* ((init-msg (if n rmail-current-message rmail-total-messages)) | 811 | (let* ((init-msg (if n rmail-current-message rmail-total-messages)) |
| 815 | (rmail-current-message init-msg) | 812 | (rmail-current-message init-msg) |
| 816 | (n (or n rmail-total-messages)) | 813 | (n (or n rmail-total-messages)) |
| @@ -967,8 +964,7 @@ Search, the `unseen' attribute is restored.") | |||
| 967 | (rmail-show-message msg-num t)) | 964 | (rmail-show-message msg-num t)) |
| 968 | (select-window owin)) | 965 | (select-window owin)) |
| 969 | (if (buffer-name rmail-buffer) | 966 | (if (buffer-name rmail-buffer) |
| 970 | (save-excursion | 967 | (with-current-buffer rmail-buffer |
| 971 | (set-buffer rmail-buffer) | ||
| 972 | (rmail-show-message msg-num t)))))) | 968 | (rmail-show-message msg-num t)))))) |
| 973 | (rmail-summary-update-highlight nil))))) | 969 | (rmail-summary-update-highlight nil))))) |
| 974 | 970 | ||
| @@ -1206,7 +1202,7 @@ Returns non-nil if message N was found." | |||
| 1206 | (curmsg (string-to-number | 1202 | (curmsg (string-to-number |
| 1207 | (buffer-substring (point) | 1203 | (buffer-substring (point) |
| 1208 | (min (point-max) (+ 6 (point)))))) | 1204 | (min (point-max) (+ 6 (point)))))) |
| 1209 | (total (save-excursion (set-buffer buf) rmail-total-messages))) | 1205 | (total (with-current-buffer buf rmail-total-messages))) |
| 1210 | ;; If message number N was specified, find that message's line | 1206 | ;; If message number N was specified, find that message's line |
| 1211 | ;; or set message-not-found. | 1207 | ;; or set message-not-found. |
| 1212 | ;; If N wasn't specified or that message can't be found. | 1208 | ;; If N wasn't specified or that message can't be found. |
| @@ -1368,7 +1364,7 @@ Position it according to WHERE which can be BEG or END" | |||
| 1368 | (defun rmail-summary-wipe () | 1364 | (defun rmail-summary-wipe () |
| 1369 | "Kill and wipe away Rmail summary, remaining within Rmail." | 1365 | "Kill and wipe away Rmail summary, remaining within Rmail." |
| 1370 | (interactive) | 1366 | (interactive) |
| 1371 | (save-excursion (set-buffer rmail-buffer) (setq rmail-summary-buffer nil)) | 1367 | (with-current-buffer rmail-buffer (setq rmail-summary-buffer nil)) |
| 1372 | (let ((local-rmail-buffer rmail-buffer)) | 1368 | (let ((local-rmail-buffer rmail-buffer)) |
| 1373 | (kill-buffer (current-buffer)) | 1369 | (kill-buffer (current-buffer)) |
| 1374 | ;; Delete window if not only one. | 1370 | ;; Delete window if not only one. |
| @@ -1380,8 +1376,7 @@ Position it according to WHERE which can be BEG or END" | |||
| 1380 | (defun rmail-summary-expunge () | 1376 | (defun rmail-summary-expunge () |
| 1381 | "Actually erase all deleted messages and recompute summary headers." | 1377 | "Actually erase all deleted messages and recompute summary headers." |
| 1382 | (interactive) | 1378 | (interactive) |
| 1383 | (save-excursion | 1379 | (with-current-buffer rmail-buffer |
| 1384 | (set-buffer rmail-buffer) | ||
| 1385 | (when (rmail-expunge-confirmed) | 1380 | (when (rmail-expunge-confirmed) |
| 1386 | (rmail-only-expunge))) | 1381 | (rmail-only-expunge))) |
| 1387 | (rmail-update-summary)) | 1382 | (rmail-update-summary)) |
| @@ -1405,8 +1400,7 @@ argument says to read a file name and use that file as the inbox." | |||
| 1405 | (list (if current-prefix-arg | 1400 | (list (if current-prefix-arg |
| 1406 | (read-file-name "Get new mail from file: ")))) | 1401 | (read-file-name "Get new mail from file: ")))) |
| 1407 | (let (msg) | 1402 | (let (msg) |
| 1408 | (save-excursion | 1403 | (with-current-buffer rmail-buffer |
| 1409 | (set-buffer rmail-buffer) | ||
| 1410 | (rmail-get-new-mail file-name) | 1404 | (rmail-get-new-mail file-name) |
| 1411 | ;; Get the proper new message number. | 1405 | ;; Get the proper new message number. |
| 1412 | (setq msg rmail-current-message)) | 1406 | (setq msg rmail-current-message)) |
| @@ -1493,12 +1487,8 @@ Interactively, empty argument means use same regexp used last time." | |||
| 1493 | (prefix-numeric-value current-prefix-arg)))) | 1487 | (prefix-numeric-value current-prefix-arg)))) |
| 1494 | ;; Don't use save-excursion because that prevents point from moving | 1488 | ;; Don't use save-excursion because that prevents point from moving |
| 1495 | ;; properly in the summary buffer. | 1489 | ;; properly in the summary buffer. |
| 1496 | (let ((buffer (current-buffer))) | 1490 | (with-current-buffer rmail-buffer |
| 1497 | (unwind-protect | 1491 | (rmail-search regexp (- n)))) |
| 1498 | (progn | ||
| 1499 | (set-buffer rmail-buffer) | ||
| 1500 | (rmail-search regexp (- n))) | ||
| 1501 | (set-buffer buffer)))) | ||
| 1502 | 1492 | ||
| 1503 | (defun rmail-summary-search (regexp &optional n) | 1493 | (defun rmail-summary-search (regexp &optional n) |
| 1504 | "Show message containing next match for REGEXP. | 1494 | "Show message containing next match for REGEXP. |
| @@ -1556,21 +1546,17 @@ Interactively, empty argument means use same regexp used last time." | |||
| 1556 | (defun rmail-summary-add-label (label) | 1546 | (defun rmail-summary-add-label (label) |
| 1557 | "Add LABEL to labels associated with current Rmail message. | 1547 | "Add LABEL to labels associated with current Rmail message. |
| 1558 | Completion is performed over known labels when reading." | 1548 | Completion is performed over known labels when reading." |
| 1559 | (interactive (list (save-excursion | 1549 | (interactive (list (with-current-buffer rmail-buffer |
| 1560 | (set-buffer rmail-buffer) | ||
| 1561 | (rmail-read-label "Add label")))) | 1550 | (rmail-read-label "Add label")))) |
| 1562 | (save-excursion | 1551 | (with-current-buffer rmail-buffer |
| 1563 | (set-buffer rmail-buffer) | ||
| 1564 | (rmail-add-label label))) | 1552 | (rmail-add-label label))) |
| 1565 | 1553 | ||
| 1566 | (defun rmail-summary-kill-label (label) | 1554 | (defun rmail-summary-kill-label (label) |
| 1567 | "Remove LABEL from labels associated with current Rmail message. | 1555 | "Remove LABEL from labels associated with current Rmail message. |
| 1568 | Completion is performed over known labels when reading." | 1556 | Completion is performed over known labels when reading." |
| 1569 | (interactive (list (save-excursion | 1557 | (interactive (list (with-current-buffer rmail-buffer |
| 1570 | (set-buffer rmail-buffer) | ||
| 1571 | (rmail-read-label "Kill label")))) | 1558 | (rmail-read-label "Kill label")))) |
| 1572 | (save-excursion | 1559 | (with-current-buffer rmail-buffer |
| 1573 | (set-buffer rmail-buffer) | ||
| 1574 | (rmail-set-label label nil))) | 1560 | (rmail-set-label label nil))) |
| 1575 | 1561 | ||
| 1576 | ;;;; *** Rmail Summary Mailing Commands *** | 1562 | ;;;; *** Rmail Summary Mailing Commands *** |
| @@ -1737,8 +1723,7 @@ Also set the default for subsequent \\[rmail-output-to-babyl-file] commands. | |||
| 1737 | The variables `rmail-secondary-file-directory' and | 1723 | The variables `rmail-secondary-file-directory' and |
| 1738 | `rmail-secondary-file-regexp' control which files are offered in the menu." | 1724 | `rmail-secondary-file-regexp' control which files are offered in the menu." |
| 1739 | (interactive) | 1725 | (interactive) |
| 1740 | (save-excursion | 1726 | (with-current-buffer rmail-buffer |
| 1741 | (set-buffer rmail-buffer) | ||
| 1742 | (let ((rmail-delete-after-output nil)) | 1727 | (let ((rmail-delete-after-output nil)) |
| 1743 | (call-interactively 'rmail-output-menu))) | 1728 | (call-interactively 'rmail-output-menu))) |
| 1744 | (if rmail-delete-after-output | 1729 | (if rmail-delete-after-output |
| @@ -1767,8 +1752,7 @@ The variables `rmail-secondary-file-directory' and | |||
| 1767 | "Write this message body to the file FILE-NAME. | 1752 | "Write this message body to the file FILE-NAME. |
| 1768 | FILE-NAME defaults, interactively, from the Subject field of the message." | 1753 | FILE-NAME defaults, interactively, from the Subject field of the message." |
| 1769 | (interactive) | 1754 | (interactive) |
| 1770 | (save-excursion | 1755 | (with-current-buffer rmail-buffer |
| 1771 | (set-buffer rmail-buffer) | ||
| 1772 | (let ((rmail-delete-after-output nil)) | 1756 | (let ((rmail-delete-after-output nil)) |
| 1773 | (if file-name | 1757 | (if file-name |
| 1774 | (rmail-output-body-to-file file-name) | 1758 | (rmail-output-body-to-file file-name) |
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index e648a211bf5..7ceadd4cfa1 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el | |||
| @@ -242,8 +242,7 @@ The list is in preference order.") | |||
| 242 | (let ((sendmail-coding-system smtpmail-code-conv-from)) | 242 | (let ((sendmail-coding-system smtpmail-code-conv-from)) |
| 243 | (select-message-coding-system))))) | 243 | (select-message-coding-system))))) |
| 244 | (unwind-protect | 244 | (unwind-protect |
| 245 | (save-excursion | 245 | (with-current-buffer tembuf |
| 246 | (set-buffer tembuf) | ||
| 247 | (erase-buffer) | 246 | (erase-buffer) |
| 248 | ;; Use the same `buffer-file-coding-system' as in the mail | 247 | ;; Use the same `buffer-file-coding-system' as in the mail |
| 249 | ;; buffer, otherwise any `write-region' invocations (e.g., in | 248 | ;; buffer, otherwise any `write-region' invocations (e.g., in |
diff --git a/lisp/mail/supercite.el b/lisp/mail/supercite.el index 0f2ccedadc0..a6cd3469a9a 100644 --- a/lisp/mail/supercite.el +++ b/lisp/mail/supercite.el | |||
| @@ -1669,23 +1669,22 @@ header style to use, unless not supplied or invalid, in which case | |||
| 1669 | (if sc-electric-circular-p | 1669 | (if sc-electric-circular-p |
| 1670 | 0 | 1670 | 0 |
| 1671 | (progn (error msg "follow") (1- last)))))) | 1671 | (progn (error msg "follow") (1- last)))))) |
| 1672 | (save-excursion | 1672 | (with-current-buffer sc-electric-bufname |
| 1673 | (set-buffer sc-electric-bufname) | 1673 | (let ((inhibit-read-only t)) |
| 1674 | (let ((buffer-read-only nil)) | 1674 | (erase-buffer) |
| 1675 | (erase-buffer) | 1675 | (goto-char (point-min)) |
| 1676 | (goto-char (point-min)) | 1676 | (sc-eref-insert-selected) |
| 1677 | (sc-eref-insert-selected) | 1677 | ;; now shrink the window to just contain the electric reference |
| 1678 | ;; now shrink the window to just contain the electric reference | 1678 | ;; header. |
| 1679 | ;; header. | 1679 | (let ((hdrlines (count-lines (point-min) (point-max))) |
| 1680 | (let ((hdrlines (count-lines (point-min) (point-max))) | 1680 | (winlines (1- (window-height)))) |
| 1681 | (winlines (1- (window-height)))) | 1681 | (if (/= hdrlines winlines) |
| 1682 | (if (/= hdrlines winlines) | 1682 | (if (> hdrlines winlines) |
| 1683 | (if (> hdrlines winlines) | 1683 | ;; we have to enlarge the window |
| 1684 | ;; we have to enlarge the window | 1684 | (enlarge-window (- hdrlines winlines)) |
| 1685 | (enlarge-window (- hdrlines winlines)) | 1685 | ;; we have to shrink the window |
| 1686 | ;; we have to shrink the window | 1686 | (shrink-window (- winlines (max hdrlines |
| 1687 | (shrink-window (- winlines (max hdrlines | 1687 | window-min-height)))))))))) |
| 1688 | window-min-height)))))))))) | ||
| 1689 | 1688 | ||
| 1690 | (defun sc-eref-next () | 1689 | (defun sc-eref-next () |
| 1691 | "Display next reference in other buffer." | 1690 | "Display next reference in other buffer." |
diff --git a/lisp/play/decipher.el b/lisp/play/decipher.el index d32e1aad413..588510c8982 100644 --- a/lisp/play/decipher.el +++ b/lisp/play/decipher.el | |||
| @@ -681,8 +681,7 @@ ciphertext." | |||
| 681 | (interactive (list (upcase (following-char)))) | 681 | (interactive (list (upcase (following-char)))) |
| 682 | (decipher-analyze) | 682 | (decipher-analyze) |
| 683 | (let (start end) | 683 | (let (start end) |
| 684 | (save-excursion | 684 | (with-current-buffer (decipher-stats-buffer) |
| 685 | (set-buffer (decipher-stats-buffer)) | ||
| 686 | (goto-char (point-min)) | 685 | (goto-char (point-min)) |
| 687 | (or (re-search-forward (format "^%c: " cipher-char) nil t) | 686 | (or (re-search-forward (format "^%c: " cipher-char) nil t) |
| 688 | (error "Character `%c' is not used in ciphertext" cipher-char)) | 687 | (error "Character `%c' is not used in ciphertext" cipher-char)) |
| @@ -730,8 +729,7 @@ START-REGEXP matches the first line to display. | |||
| 730 | END-REGEXP matches the line after that which ends the display. | 729 | END-REGEXP matches the line after that which ends the display. |
| 731 | The ending line is included in the display unless it is blank." | 730 | The ending line is included in the display unless it is blank." |
| 732 | (let (start end) | 731 | (let (start end) |
| 733 | (save-excursion | 732 | (with-current-buffer (decipher-stats-buffer) |
| 734 | (set-buffer (decipher-stats-buffer)) | ||
| 735 | (goto-char (point-min)) | 733 | (goto-char (point-min)) |
| 736 | (re-search-forward start-regexp) | 734 | (re-search-forward start-regexp) |
| 737 | (beginning-of-line) | 735 | (beginning-of-line) |
| @@ -926,9 +924,8 @@ Creates the statistics buffer if it doesn't exist." | |||
| 926 | (aref decipher--after i))) | 924 | (aref decipher--after i))) |
| 927 | freq-list) | 925 | freq-list) |
| 928 | total-chars (+ total-chars (aref decipher--freqs i))))) | 926 | total-chars (+ total-chars (aref decipher--freqs i))))) |
| 929 | (save-excursion | 927 | ;; Switch to statistics buffer, creating it if necessary: |
| 930 | ;; Switch to statistics buffer, creating it if necessary: | 928 | (with-current-buffer (decipher-stats-buffer t) |
| 931 | (set-buffer (decipher-stats-buffer t)) | ||
| 932 | ;; This can't happen, but it never hurts to double-check: | 929 | ;; This can't happen, but it never hurts to double-check: |
| 933 | (or (eq major-mode 'decipher-stats-mode) | 930 | (or (eq major-mode 'decipher-stats-mode) |
| 934 | (error "Buffer %s is not in Decipher-Stats mode" (buffer-name))) | 931 | (error "Buffer %s is not in Decipher-Stats mode" (buffer-name))) |
| @@ -1024,8 +1021,7 @@ if it can't, it signals an error." | |||
| 1024 | ;; See if decipher-stats-buffer exists: | 1021 | ;; See if decipher-stats-buffer exists: |
| 1025 | ((and (bufferp decipher-stats-buffer) | 1022 | ((and (bufferp decipher-stats-buffer) |
| 1026 | (buffer-name decipher-stats-buffer)) | 1023 | (buffer-name decipher-stats-buffer)) |
| 1027 | (or (save-excursion | 1024 | (or (with-current-buffer decipher-stats-buffer |
| 1028 | (set-buffer decipher-stats-buffer) | ||
| 1029 | (eq major-mode 'decipher-stats-mode)) | 1025 | (eq major-mode 'decipher-stats-mode)) |
| 1030 | (error "Buffer %s is not in Decipher-Stats mode" | 1026 | (error "Buffer %s is not in Decipher-Stats mode" |
| 1031 | (buffer-name decipher-stats-buffer))) | 1027 | (buffer-name decipher-stats-buffer))) |
| @@ -1041,8 +1037,7 @@ if it can't, it signals an error." | |||
| 1041 | ;; We just lost track of the statistics buffer: | 1037 | ;; We just lost track of the statistics buffer: |
| 1042 | (get-buffer stats-name) | 1038 | (get-buffer stats-name) |
| 1043 | (generate-new-buffer stats-name)))) | 1039 | (generate-new-buffer stats-name)))) |
| 1044 | (save-excursion | 1040 | (with-current-buffer decipher-stats-buffer |
| 1045 | (set-buffer decipher-stats-buffer) | ||
| 1046 | (decipher-stats-mode)) | 1041 | (decipher-stats-mode)) |
| 1047 | decipher-stats-buffer) | 1042 | decipher-stats-buffer) |
| 1048 | ;; Give up: | 1043 | ;; Give up: |
| @@ -1052,22 +1047,21 @@ if it can't, it signals an error." | |||
| 1052 | 1047 | ||
| 1053 | (provide 'decipher) | 1048 | (provide 'decipher) |
| 1054 | 1049 | ||
| 1055 | ;;;(defun decipher-show-undo-list () | 1050 | ;;(defun decipher-show-undo-list () |
| 1056 | ;;; "Display the undo list (for debugging purposes)." | 1051 | ;; "Display the undo list (for debugging purposes)." |
| 1057 | ;;; (interactive) | 1052 | ;; (interactive) |
| 1058 | ;;; (with-output-to-temp-buffer "*Decipher Undo*" | 1053 | ;; (with-output-to-temp-buffer "*Decipher Undo*" |
| 1059 | ;;; (let ((undo-list decipher-undo-list) | 1054 | ;; (let ((undo-list decipher-undo-list) |
| 1060 | ;;; undo-rec undo-map) | 1055 | ;; undo-rec undo-map) |
| 1061 | ;;; (save-excursion | 1056 | ;; (with-current-buffer "*Decipher Undo*" |
| 1062 | ;;; (set-buffer "*Decipher Undo*") | 1057 | ;; (while (setq undo-rec (pop undo-list)) |
| 1063 | ;;; (while (setq undo-rec (pop undo-list)) | 1058 | ;; (or (consp (car undo-rec)) |
| 1064 | ;;; (or (consp (car undo-rec)) | 1059 | ;; (setq undo-rec (list undo-rec))) |
| 1065 | ;;; (setq undo-rec (list undo-rec))) | 1060 | ;; (insert ?\() |
| 1066 | ;;; (insert ?\() | 1061 | ;; (while (setq undo-map (pop undo-rec)) |
| 1067 | ;;; (while (setq undo-map (pop undo-rec)) | 1062 | ;; (insert (cdr undo-map) (car undo-map) ?\ )) |
| 1068 | ;;; (insert (cdr undo-map) (car undo-map) ?\ )) | 1063 | ;; (delete-backward-char 1) |
| 1069 | ;;; (delete-backward-char 1) | 1064 | ;; (insert ")\n")))))) |
| 1070 | ;;; (insert ")\n")))))) | ||
| 1071 | 1065 | ||
| 1072 | ;; arch-tag: 8f094d88-ffe1-4f99-afe3-a5e81dd939d9 | 1066 | ;; arch-tag: 8f094d88-ffe1-4f99-afe3-a5e81dd939d9 |
| 1073 | ;;; decipher.el ends here | 1067 | ;;; decipher.el ends here |
diff --git a/lisp/play/dissociate.el b/lisp/play/dissociate.el index 0c5557f07c6..b3f9a227530 100644 --- a/lisp/play/dissociate.el +++ b/lisp/play/dissociate.el | |||
| @@ -62,8 +62,7 @@ Default is 2." | |||
| 62 | (setq last-query-point (point-max)) | 62 | (setq last-query-point (point-max)) |
| 63 | t)))) | 63 | t)))) |
| 64 | (let (start end) | 64 | (let (start end) |
| 65 | (save-excursion | 65 | (with-current-buffer inbuf |
| 66 | (set-buffer inbuf) | ||
| 67 | (setq start (point)) | 66 | (setq start (point)) |
| 68 | (if (eq move-function 'forward-char) | 67 | (if (eq move-function 'forward-char) |
| 69 | (progn | 68 | (progn |
| @@ -81,8 +80,7 @@ Default is 2." | |||
| 81 | (end-of-line) | 80 | (end-of-line) |
| 82 | (and (> (current-column) fill-column) | 81 | (and (> (current-column) fill-column) |
| 83 | (do-auto-fill))))) | 82 | (do-auto-fill))))) |
| 84 | (save-excursion | 83 | (with-current-buffer inbuf |
| 85 | (set-buffer inbuf) | ||
| 86 | (if (eobp) | 84 | (if (eobp) |
| 87 | (goto-char (point-min)) | 85 | (goto-char (point-min)) |
| 88 | (let ((overlap | 86 | (let ((overlap |
diff --git a/lisp/play/fortune.el b/lisp/play/fortune.el index 90d759bd174..3b895c79ccd 100644 --- a/lisp/play/fortune.el +++ b/lisp/play/fortune.el | |||
| @@ -293,8 +293,7 @@ when supplied, specifies the file to choose the fortune from." | |||
| 293 | (fort-file (expand-file-name | 293 | (fort-file (expand-file-name |
| 294 | (substitute-in-file-name | 294 | (substitute-in-file-name |
| 295 | (or file fortune-file))))) | 295 | (or file fortune-file))))) |
| 296 | (save-excursion | 296 | (with-current-buffer fortune-buffer |
| 297 | (set-buffer fortune-buffer) | ||
| 298 | (toggle-read-only 0) | 297 | (toggle-read-only 0) |
| 299 | (erase-buffer) | 298 | (erase-buffer) |
| 300 | 299 | ||
diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el index f0cdea13474..bd12f4b4c13 100644 --- a/lisp/play/gomoku.el +++ b/lisp/play/gomoku.el | |||
| @@ -939,6 +939,7 @@ If the game is finished, this command requests for another game." | |||
| 939 | "Your move?")) | 939 | "Your move?")) |
| 940 | ;; This may seem silly, but if one omits the following line (or a similar | 940 | ;; This may seem silly, but if one omits the following line (or a similar |
| 941 | ;; one), the cursor may very well go to some place where POINT is not. | 941 | ;; one), the cursor may very well go to some place where POINT is not. |
| 942 | ;; FIXME: this can't be right!! --Stef | ||
| 942 | (save-excursion (set-buffer (other-buffer)))) | 943 | (save-excursion (set-buffer (other-buffer)))) |
| 943 | 944 | ||
| 944 | (defun gomoku-prompt-for-other-game () | 945 | (defun gomoku-prompt-for-other-game () |
diff --git a/lisp/play/landmark.el b/lisp/play/landmark.el index 5e8df5d4a6b..33e235d3bed 100644 --- a/lisp/play/landmark.el +++ b/lisp/play/landmark.el | |||
| @@ -827,6 +827,7 @@ If the game is finished, this command requests for another game." | |||
| 827 | "Your move?")) | 827 | "Your move?")) |
| 828 | ;; This may seem silly, but if one omits the following line (or a similar | 828 | ;; This may seem silly, but if one omits the following line (or a similar |
| 829 | ;; one), the cursor may very well go to some place where POINT is not. | 829 | ;; one), the cursor may very well go to some place where POINT is not. |
| 830 | ;; FIXME: this can't be right!! --Stef | ||
| 830 | (save-excursion (set-buffer (other-buffer)))) | 831 | (save-excursion (set-buffer (other-buffer)))) |
| 831 | 832 | ||
| 832 | (defun lm-prompt-for-other-game () | 833 | (defun lm-prompt-for-other-game () |
| @@ -1178,15 +1179,13 @@ because it is overwritten by \"One moment please\"." | |||
| 1178 | 1179 | ||
| 1179 | (defun lm-print-wts () | 1180 | (defun lm-print-wts () |
| 1180 | (interactive) | 1181 | (interactive) |
| 1181 | (save-excursion | 1182 | (with-current-buffer "*lm-wts*" |
| 1182 | (set-buffer "*lm-wts*") | ||
| 1183 | (insert "==============================\n") | 1183 | (insert "==============================\n") |
| 1184 | (mapc 'lm-print-wts-int lm-directions))) | 1184 | (mapc 'lm-print-wts-int lm-directions))) |
| 1185 | 1185 | ||
| 1186 | (defun lm-print-moves (moves) | 1186 | (defun lm-print-moves (moves) |
| 1187 | (interactive) | 1187 | (interactive) |
| 1188 | (save-excursion | 1188 | (with-current-buffer "*lm-moves*" |
| 1189 | (set-buffer "*lm-moves*") | ||
| 1190 | (insert (format "%S\n" moves)))) | 1189 | (insert (format "%S\n" moves)))) |
| 1191 | 1190 | ||
| 1192 | 1191 | ||
| @@ -1200,8 +1199,7 @@ because it is overwritten by \"One moment please\"." | |||
| 1200 | 1199 | ||
| 1201 | (defun lm-print-y,s,noise () | 1200 | (defun lm-print-y,s,noise () |
| 1202 | (interactive) | 1201 | (interactive) |
| 1203 | (save-excursion | 1202 | (with-current-buffer "*lm-y,s,noise*" |
| 1204 | (set-buffer "*lm-y,s,noise*") | ||
| 1205 | (insert "==============================\n") | 1203 | (insert "==============================\n") |
| 1206 | (mapc 'lm-print-y,s,noise-int lm-directions))) | 1204 | (mapc 'lm-print-y,s,noise-int lm-directions))) |
| 1207 | 1205 | ||
| @@ -1212,8 +1210,7 @@ because it is overwritten by \"One moment please\"." | |||
| 1212 | 1210 | ||
| 1213 | (defun lm-print-smell () | 1211 | (defun lm-print-smell () |
| 1214 | (interactive) | 1212 | (interactive) |
| 1215 | (save-excursion | 1213 | (with-current-buffer "*lm-smell*" |
| 1216 | (set-buffer "*lm-smell*") | ||
| 1217 | (insert "==============================\n") | 1214 | (insert "==============================\n") |
| 1218 | (insert (format "tree: %S \n" (get 'z 't))) | 1215 | (insert (format "tree: %S \n" (get 'z 't))) |
| 1219 | (mapc 'lm-print-smell-int lm-directions))) | 1216 | (mapc 'lm-print-smell-int lm-directions))) |
| @@ -1225,14 +1222,12 @@ because it is overwritten by \"One moment please\"." | |||
| 1225 | 1222 | ||
| 1226 | (defun lm-print-w0 () | 1223 | (defun lm-print-w0 () |
| 1227 | (interactive) | 1224 | (interactive) |
| 1228 | (save-excursion | 1225 | (with-current-buffer "*lm-w0*" |
| 1229 | (set-buffer "*lm-w0*") | ||
| 1230 | (insert "==============================\n") | 1226 | (insert "==============================\n") |
| 1231 | (mapc 'lm-print-w0-int lm-directions))) | 1227 | (mapc 'lm-print-w0-int lm-directions))) |
| 1232 | 1228 | ||
| 1233 | (defun lm-blackbox () | 1229 | (defun lm-blackbox () |
| 1234 | (save-excursion | 1230 | (with-current-buffer "*lm-blackbox*" |
| 1235 | (set-buffer "*lm-blackbox*") | ||
| 1236 | (insert "==============================\n") | 1231 | (insert "==============================\n") |
| 1237 | (insert "I smell: ") | 1232 | (insert "I smell: ") |
| 1238 | (mapc (lambda (direction) | 1233 | (mapc (lambda (direction) |
| @@ -1556,35 +1551,32 @@ If the game is finished, this command requests for another game." | |||
| 1556 | (lm-plot-landmarks) | 1551 | (lm-plot-landmarks) |
| 1557 | 1552 | ||
| 1558 | (if lm-debug | 1553 | (if lm-debug |
| 1559 | (progn | 1554 | (save-current-buffer |
| 1560 | (save-excursion | 1555 | (set-buffer (get-buffer-create "*lm-w0*")) |
| 1561 | (set-buffer (get-buffer-create "*lm-w0*")) | 1556 | (erase-buffer) |
| 1562 | (erase-buffer) | 1557 | (set-buffer (get-buffer-create "*lm-moves*")) |
| 1563 | (set-buffer (get-buffer-create "*lm-moves*")) | 1558 | (set-buffer (get-buffer-create "*lm-wts*")) |
| 1564 | (set-buffer (get-buffer-create "*lm-wts*")) | 1559 | (erase-buffer) |
| 1565 | (erase-buffer) | 1560 | (set-buffer (get-buffer-create "*lm-y,s,noise*")) |
| 1566 | (set-buffer (get-buffer-create "*lm-y,s,noise*")) | 1561 | (erase-buffer) |
| 1567 | (erase-buffer) | 1562 | (set-buffer (get-buffer-create "*lm-smell*")) |
| 1568 | (set-buffer (get-buffer-create "*lm-smell*")) | 1563 | (erase-buffer) |
| 1569 | (erase-buffer) | 1564 | (set-buffer (get-buffer-create "*lm-blackbox*")) |
| 1570 | (set-buffer (get-buffer-create "*lm-blackbox*")) | 1565 | (erase-buffer) |
| 1571 | (erase-buffer) | 1566 | (set-buffer (get-buffer-create "*lm-distance*")) |
| 1572 | (set-buffer (get-buffer-create "*lm-distance*")) | 1567 | (erase-buffer))) |
| 1573 | (erase-buffer)))) | ||
| 1574 | 1568 | ||
| 1575 | 1569 | ||
| 1576 | (lm-set-landmark-signal-strengths) | 1570 | (lm-set-landmark-signal-strengths) |
| 1577 | 1571 | ||
| 1578 | (mapc (lambda (direction) | 1572 | (dolist (direction lm-directions) |
| 1579 | (put direction 'y_t 0.0)) | 1573 | (put direction 'y_t 0.0)) |
| 1580 | lm-directions) | ||
| 1581 | 1574 | ||
| 1582 | (if (not save-weights) | 1575 | (if (not save-weights) |
| 1583 | (progn | 1576 | (progn |
| 1584 | (mapc 'lm-fix-weights-for lm-directions) | 1577 | (mapc 'lm-fix-weights-for lm-directions) |
| 1585 | (mapc (lambda (direction) | 1578 | (dolist (direction lm-directions) |
| 1586 | (put direction 'w0 lm-initial-w0)) | 1579 | (put direction 'w0 lm-initial-w0))) |
| 1587 | lm-directions)) | ||
| 1588 | (message "Weights preserved for this run.")) | 1580 | (message "Weights preserved for this run.")) |
| 1589 | 1581 | ||
| 1590 | (if auto-start | 1582 | (if auto-start |
diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el index 2b1d1e4d8b5..38daaa32ba2 100644 --- a/lisp/play/mpuz.el +++ b/lisp/play/mpuz.el | |||
| @@ -298,8 +298,7 @@ You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]." | |||
| 298 | (let ((buf (get-buffer-create "*Mult Puzzle*")) | 298 | (let ((buf (get-buffer-create "*Mult Puzzle*")) |
| 299 | (face '(face mpuz-text)) | 299 | (face '(face mpuz-text)) |
| 300 | buffer-read-only) | 300 | buffer-read-only) |
| 301 | (save-excursion | 301 | (with-current-buffer buf |
| 302 | (set-buffer buf) | ||
| 303 | (erase-buffer) | 302 | (erase-buffer) |
| 304 | (insert mpuz-framework) | 303 | (insert mpuz-framework) |
| 305 | (set-text-properties 13 42 face) | 304 | (set-text-properties 13 42 face) |
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index fa3e9404bf8..157b2dd71d0 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el | |||
| @@ -1085,8 +1085,7 @@ On Nextstep, put TEXT in the pasteboard; PUSH is ignored." | |||
| 1085 | (let* ((pos (event-end event)) | 1085 | (let* ((pos (event-end event)) |
| 1086 | (window (nth 0 pos)) | 1086 | (window (nth 0 pos)) |
| 1087 | (scale (nth 2 pos))) | 1087 | (scale (nth 2 pos))) |
| 1088 | (save-excursion | 1088 | (with-current-buffer (window-buffer window) |
| 1089 | (set-buffer (window-buffer window)) | ||
| 1090 | (cond | 1089 | (cond |
| 1091 | ((eq (car scale) (cdr scale)) | 1090 | ((eq (car scale) (cdr scale)) |
| 1092 | (goto-char (point-max))) | 1091 | (goto-char (point-max))) |
| @@ -1169,8 +1168,7 @@ the operating system.") | |||
| 1169 | ((eq window-pos 'vertical-line) | 1168 | ((eq window-pos 'vertical-line) |
| 1170 | 'default) | 1169 | 'default) |
| 1171 | ((consp window-pos) | 1170 | ((consp window-pos) |
| 1172 | (save-excursion | 1171 | (with-current-buffer buffer |
| 1173 | (set-buffer buffer) | ||
| 1174 | (let ((p (car (compute-motion (window-start window) | 1172 | (let ((p (car (compute-motion (window-start window) |
| 1175 | (cons (nth 0 edges) (nth 1 edges)) | 1173 | (cons (nth 0 edges) (nth 1 edges)) |
| 1176 | (window-end window) | 1174 | (window-end window) |
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index e1c5970678d..799fddc886e 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2009-11-03 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * url-util.el (url-insert-entities-in-string): | ||
| 4 | * url-nfs.el (url-nfs-unescape): | ||
| 5 | * url-ldap.el (url-ldap): | ||
| 6 | * url-imap.el (url-imap): | ||
| 7 | * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. | ||
| 8 | |||
| 1 | 2009-10-01 Glenn Morris <rgm@gnu.org> | 9 | 2009-10-01 Glenn Morris <rgm@gnu.org> |
| 2 | 10 | ||
| 3 | * url-http.el (url-dav-file-attributes): Fix declaration. | 11 | * url-http.el (url-dav-file-attributes): Fix declaration. |
diff --git a/lisp/url/url-cid.el b/lisp/url/url-cid.el index f71b0a203e7..6644ed331de 100644 --- a/lisp/url/url-cid.el +++ b/lisp/url/url-cid.el | |||
| @@ -35,8 +35,7 @@ | |||
| 35 | (setq part (mm-get-content-id cid)) | 35 | (setq part (mm-get-content-id cid)) |
| 36 | (if (not part) | 36 | (if (not part) |
| 37 | (message "Unknown CID encountered: %s" cid) | 37 | (message "Unknown CID encountered: %s" cid) |
| 38 | (setq data (save-excursion | 38 | (setq data (with-current-buffer (mm-handle-buffer part) |
| 39 | (set-buffer (mm-handle-buffer part)) | ||
| 40 | (buffer-string)) | 39 | (buffer-string)) |
| 41 | content-type (mm-handle-type part) | 40 | content-type (mm-handle-type part) |
| 42 | encoding (symbol-name (mm-handle-encoding part))) | 41 | encoding (symbol-name (mm-handle-encoding part))) |
| @@ -55,8 +54,7 @@ | |||
| 55 | (cond | 54 | (cond |
| 56 | ((fboundp 'mm-get-content-id) | 55 | ((fboundp 'mm-get-content-id) |
| 57 | ;; Using Pterodactyl Gnus or later | 56 | ;; Using Pterodactyl Gnus or later |
| 58 | (save-excursion | 57 | (with-current-buffer (generate-new-buffer " *url-cid*") |
| 59 | (set-buffer (generate-new-buffer " *url-cid*")) | ||
| 60 | (url-cid-gnus (url-filename url)))) | 58 | (url-cid-gnus (url-filename url)))) |
| 61 | (t | 59 | (t |
| 62 | (message "Unable to handle CID URL: %s" url)))) | 60 | (message "Unable to handle CID URL: %s" url)))) |
diff --git a/lisp/url/url-imap.el b/lisp/url/url-imap.el index 6ab43a88fb6..c61fc6c9753 100644 --- a/lisp/url/url-imap.el +++ b/lisp/url/url-imap.el | |||
| @@ -52,8 +52,7 @@ | |||
| 52 | (defun url-imap (url) | 52 | (defun url-imap (url) |
| 53 | (unless (vectorp url) | 53 | (unless (vectorp url) |
| 54 | (signal 'wrong-type-error (list "Need a pre-parsed URL." url))) | 54 | (signal 'wrong-type-error (list "Need a pre-parsed URL." url))) |
| 55 | (save-excursion | 55 | (with-current-buffer (generate-new-buffer " *url-imap*") |
| 56 | (set-buffer (generate-new-buffer " *url-imap*")) | ||
| 57 | (mm-disable-multibyte) | 56 | (mm-disable-multibyte) |
| 58 | (let* ((host (url-host url)) | 57 | (let* ((host (url-host url)) |
| 59 | (port (url-port url)) | 58 | (port (url-port url)) |
diff --git a/lisp/url/url-ldap.el b/lisp/url/url-ldap.el index 8a5d7539919..b6c9f639725 100644 --- a/lisp/url/url-ldap.el +++ b/lisp/url/url-ldap.el | |||
| @@ -121,8 +121,7 @@ URL can be a URL string, or a URL vector of the type returned by | |||
| 121 | (setq url (url-generic-parse-url (url-unhex-string url))) | 121 | (setq url (url-generic-parse-url (url-unhex-string url))) |
| 122 | (if (not (vectorp url)) | 122 | (if (not (vectorp url)) |
| 123 | (error "Argument is not a valid URL"))) | 123 | (error "Argument is not a valid URL"))) |
| 124 | (save-excursion | 124 | (with-current-buffer (generate-new-buffer " *url-ldap*") |
| 125 | (set-buffer (generate-new-buffer " *url-ldap*")) | ||
| 126 | (setq url-current-object url) | 125 | (setq url-current-object url) |
| 127 | (insert "Content-type: text/html\r\n\r\n") | 126 | (insert "Content-type: text/html\r\n\r\n") |
| 128 | (if (not (fboundp 'ldap-search-internal)) | 127 | (if (not (fboundp 'ldap-search-internal)) |
diff --git a/lisp/url/url-nfs.el b/lisp/url/url-nfs.el index efc4bccbeba..dee54c7ad9c 100644 --- a/lisp/url/url-nfs.el +++ b/lisp/url/url-nfs.el | |||
| @@ -42,8 +42,7 @@ | |||
| 42 | Each can be used any number of times.") | 42 | Each can be used any number of times.") |
| 43 | 43 | ||
| 44 | (defun url-nfs-unescape (format host port user pass file) | 44 | (defun url-nfs-unescape (format host port user pass file) |
| 45 | (save-excursion | 45 | (with-current-buffer (get-buffer-create " *nfs-parse*") |
| 46 | (set-buffer (get-buffer-create " *nfs-parse*")) | ||
| 47 | (erase-buffer) | 46 | (erase-buffer) |
| 48 | (insert format) | 47 | (insert format) |
| 49 | (goto-char (point-min)) | 48 | (goto-char (point-min)) |
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el index 65ac0fd8db3..b869a1825a4 100644 --- a/lisp/url/url-util.el +++ b/lisp/url/url-util.el | |||
| @@ -140,8 +140,7 @@ Also replaces the \" character, so that the result may be safely used as | |||
| 140 | > ==> > | 140 | > ==> > |
| 141 | \" ==> "" | 141 | \" ==> "" |
| 142 | (if (string-match "[&<>\"]" string) | 142 | (if (string-match "[&<>\"]" string) |
| 143 | (save-excursion | 143 | (with-current-buffer (get-buffer-create " *entity*") |
| 144 | (set-buffer (get-buffer-create " *entity*")) | ||
| 145 | (erase-buffer) | 144 | (erase-buffer) |
| 146 | (buffer-disable-undo (current-buffer)) | 145 | (buffer-disable-undo (current-buffer)) |
| 147 | (insert string) | 146 | (insert string) |