Commit 937e6a56 authored by Stefan Monnier's avatar Stefan Monnier

* 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.
parent 5b955562
2009-11-03 Stefan Monnier <monnier@iro.umontreal.ca>
* 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.
2009-11-03 Chong Yidong <cyd@stupidchicken.com> 2009-11-03 Chong Yidong <cyd@stupidchicken.com>
* comint.el (comint-replace-by-expanded-history-before-point): * comint.el (comint-replace-by-expanded-history-before-point):
...@@ -27,8 +82,8 @@ ...@@ -27,8 +82,8 @@
* textmodes/sgml-mode.el (sgml-mode-facemenu-add-face-function): * textmodes/sgml-mode.el (sgml-mode-facemenu-add-face-function):
Support face colors. Support face colors.
* textmodes/tex-mode.el (tex-facemenu-add-face-function): New * textmodes/tex-mode.el (tex-facemenu-add-face-function):
function. Support face colors (Bug#1168). New function. Support face colors (Bug#1168).
(tex-common-initialization): Use it. (tex-common-initialization): Use it.
* facemenu.el (facemenu-enable-faces-p): Enable facemenu if the * facemenu.el (facemenu-enable-faces-p): Enable facemenu if the
......
...@@ -646,8 +646,7 @@ A value of 0 in any position is a wildcard. Optional argument COLOR is ...@@ -646,8 +646,7 @@ A value of 0 in any position is a wildcard. Optional argument COLOR is
passed to `calendar-mark-visible-date' as MARK." passed to `calendar-mark-visible-date' as MARK."
;; FIXME not the same as the Bahai and Islamic cases, so can't use ;; FIXME not the same as the Bahai and Islamic cases, so can't use
;; calendar-mark-1. ;; calendar-mark-1.
(save-excursion (with-current-buffer calendar-buffer
(set-buffer calendar-buffer)
(if (and (not (zerop month)) (not (zerop day))) (if (and (not (zerop month)) (not (zerop day)))
(if (not (zerop year)) (if (not (zerop year))
;; Fully specified Hebrew date. ;; Fully specified Hebrew date.
......
...@@ -1506,8 +1506,7 @@ Optional argument COLOR is passed to `calendar-mark-visible-date' as MARK." ...@@ -1506,8 +1506,7 @@ Optional argument COLOR is passed to `calendar-mark-visible-date' as MARK."
The function FROMABS converts absolute dates to the appropriate date system. The function FROMABS converts absolute dates to the appropriate date system.
The function TOABS carries out the inverse operation. Optional argument The function TOABS carries out the inverse operation. Optional argument
COLOR is passed to `calendar-mark-visible-date' as MARK." COLOR is passed to `calendar-mark-visible-date' as MARK."
(save-excursion (with-current-buffer calendar-buffer
(set-buffer calendar-buffer)
(if (and (not (zerop month)) (not (zerop day))) (if (and (not (zerop month)) (not (zerop day)))
(if (not (zerop year)) (if (not (zerop year))
;; Fully specified date. ;; Fully specified date.
......
...@@ -110,8 +110,7 @@ With prefix argument, don't jump to global mark when cancelling it." ...@@ -110,8 +110,7 @@ With prefix argument, don't jump to global mark when cancelling it."
(defun cua--insert-at-global-mark (str &optional msg) (defun cua--insert-at-global-mark (str &optional msg)
;; Insert string at global marker and move marker ;; Insert string at global marker and move marker
(save-excursion (with-current-buffer (marker-buffer cua--global-mark-marker)
(set-buffer (marker-buffer cua--global-mark-marker))
(goto-char (marker-position cua--global-mark-marker)) (goto-char (marker-position cua--global-mark-marker))
(insert-for-yank str) (insert-for-yank str)
(cua--activate-global-mark)) (cua--activate-global-mark))
...@@ -123,8 +122,7 @@ With prefix argument, don't jump to global mark when cancelling it." ...@@ -123,8 +122,7 @@ With prefix argument, don't jump to global mark when cancelling it."
(defun cua--delete-at-global-mark (arg &optional msg) (defun cua--delete-at-global-mark (arg &optional msg)
;; Delete chars at global marker ;; Delete chars at global marker
(save-excursion (with-current-buffer (marker-buffer cua--global-mark-marker)
(set-buffer (marker-buffer cua--global-mark-marker))
(goto-char (marker-position cua--global-mark-marker)) (goto-char (marker-position cua--global-mark-marker))
(delete-char arg)) (delete-char arg))
(if msg (if msg
...@@ -190,8 +188,7 @@ With prefix argument, don't jump to global mark when cancelling it." ...@@ -190,8 +188,7 @@ With prefix argument, don't jump to global mark when cancelling it."
(if (cua--global-mark-active) (if (cua--global-mark-active)
(let ((src-buf (current-buffer)) (let ((src-buf (current-buffer))
(text (cua--extract-rectangle))) (text (cua--extract-rectangle)))
(save-excursion (with-current-buffer (marker-buffer cua--global-mark-marker)
(set-buffer (marker-buffer cua--global-mark-marker))
(goto-char (marker-position cua--global-mark-marker)) (goto-char (marker-position cua--global-mark-marker))
(if as-text (if as-text
(while text (while text
...@@ -309,8 +306,7 @@ With prefix argument, don't jump to global mark when cancelling it." ...@@ -309,8 +306,7 @@ With prefix argument, don't jump to global mark when cancelling it."
(interactive "*") (interactive "*")
(if (cua--global-mark-active) (if (cua--global-mark-active)
(let (col) (let (col)
(save-excursion (with-current-buffer (marker-buffer cua--global-mark-marker)
(set-buffer (marker-buffer cua--global-mark-marker))
(goto-char (marker-position cua--global-mark-marker)) (goto-char (marker-position cua--global-mark-marker))
(setq col (current-column))) (setq col (current-column)))
(if cua--rectangle (if cua--rectangle
......
...@@ -1198,8 +1198,7 @@ The numbers are formatted according to the FORMAT string." ...@@ -1198,8 +1198,7 @@ The numbers are formatted according to the FORMAT string."
(- (cua--rectangle-right) (cua--rectangle-left) -1))) (- (cua--rectangle-right) (cua--rectangle-left) -1)))
(r (or setup-fct (cua--extract-rectangle))) (r (or setup-fct (cua--extract-rectangle)))
y z (tr 0)) y z (tr 0))
(save-excursion (with-current-buffer auxbuf
(set-buffer auxbuf)
(erase-buffer) (erase-buffer)
(if setup-fct (if setup-fct
(funcall setup-fct) (funcall setup-fct)
......
...@@ -2657,8 +2657,7 @@ G-C-\\: Split Window | FNDNXT | Yank | CUT | ...@@ -2657,8 +2657,7 @@ G-C-\\: Split Window | FNDNXT | Yank | CUT |
(progn (progn
(message "%s..." (capitalize (symbol-name fun))) (message "%s..." (capitalize (symbol-name fun)))
(and b (and b
(save-excursion (with-current-buffer b
(set-buffer b)
(set-buffer-modified-p t))) (set-buffer-modified-p t)))
(fset 'help-print-return-message 'ignore) (fset 'help-print-return-message 'ignore)
(call-interactively fun) (call-interactively fun)
...@@ -2669,8 +2668,7 @@ G-C-\\: Split Window | FNDNXT | Yank | CUT | ...@@ -2669,8 +2668,7 @@ G-C-\\: Split Window | FNDNXT | Yank | CUT |
(not (buffer-modified-p b))))) (not (buffer-modified-p b)))))
(fset 'help-print-return-message p) (fset 'help-print-return-message p)
(and b (buffer-name b) (and b (buffer-name b)
(save-excursion (with-current-buffer b
(set-buffer b)
(set-buffer-modified-p m)))))) (set-buffer-modified-p m))))))
(with-electric-help 'delete-other-windows name t)))) (with-electric-help 'delete-other-windows name t))))
......
...@@ -79,8 +79,7 @@ ...@@ -79,8 +79,7 @@
(if (null mode-cmd) (if (null mode-cmd)
(with-output-to-temp-buffer "*Help*" (with-output-to-temp-buffer "*Help*"
(princ (substitute-command-keys "Possible major modes to switch to: \\{vi-tilde-map}")) (princ (substitute-command-keys "Possible major modes to switch to: \\{vi-tilde-map}"))
(save-excursion (with-current-buffer standard-output
(set-buffer standard-output)
(help-mode))) (help-mode)))
(setq prefix-arg arg) ; prefix arg will be passed down (setq prefix-arg arg) ; prefix arg will be passed down
(command-execute mode-cmd nil) ; may need to save mode-line-format etc (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,8 +498,7 @@ set sw=n M-x set-variable vi-shift-width n "
;; (cond ((string-match "s")))) ;; (cond ((string-match "s"))))
(with-output-to-temp-buffer "*Help*" (with-output-to-temp-buffer "*Help*"
(princ (documentation 'vi-ex-cmd)) (princ (documentation 'vi-ex-cmd))
(save-excursion (with-current-buffer standard-output
(set-buffer standard-output)
(help-mode)))) (help-mode))))
(defun vi-undefined () (defun vi-undefined ()
......
...@@ -419,10 +419,9 @@ Type `n' to quit this window for now.\n") ...@@ -419,10 +419,9 @@ Type `n' to quit this window for now.\n")
(goto-char (point-min)) (goto-char (point-min))
(if (y-or-n-p "Inhibit VIP startup message? ") (if (y-or-n-p "Inhibit VIP startup message? ")
(progn (progn
(save-excursion (with-current-buffer
(set-buffer (find-file-noselect
(find-file-noselect (substitute-in-file-name vip-startup-file))
(substitute-in-file-name vip-startup-file)))
(goto-char (point-max)) (goto-char (point-max))
(insert "\n(setq vip-inhibit-startup-message t)\n") (insert "\n(setq vip-inhibit-startup-message t)\n")
(save-buffer) (save-buffer)
...@@ -2158,8 +2157,7 @@ is a command.") ...@@ -2158,8 +2157,7 @@ is a command.")
(defun vip-get-ex-token () (defun vip-get-ex-token ()
"get an ex-token which is either an address or a command. "get an ex-token which is either an address or a command.
a token has type \(command, address, end-mark\) and value." a token has type \(command, address, end-mark\) and value."
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(skip-chars-forward " \t") (skip-chars-forward " \t")
(cond ((looking-at "[k#]") (cond ((looking-at "[k#]")
(setq ex-token-type "command") (setq ex-token-type "command")
...@@ -2262,8 +2260,7 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2262,8 +2260,7 @@ a token has type \(command, address, end-mark\) and value."
ex-g-variant nil)) ex-g-variant nil))
(let ((com-str (or string (vip-read-string ":"))) (let ((com-str (or string (vip-read-string ":")))
(address nil) (cont t) (dot (point))) (address nil) (cont t) (dot (point)))
(save-window-excursion (with-current-buffer (get-buffer-create " *ex-working-space*")
(set-buffer (get-buffer-create " *ex-working-space*"))
(delete-region (point-min) (point-max)) (delete-region (point-min) (point-max))
(insert com-str "\n") (insert com-str "\n")
(goto-char (point-min))) (goto-char (point-min)))
...@@ -2282,8 +2279,7 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2282,8 +2279,7 @@ a token has type \(command, address, end-mark\) and value."
(setq cont nil)) (setq cont nil))
(t (t
(vip-execute-ex-command) (vip-execute-ex-command)
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(skip-chars-forward " \t") (skip-chars-forward " \t")
(cond ((looking-at "|") (cond ((looking-at "|")
(forward-char 1)) (forward-char 1))
...@@ -2307,8 +2303,7 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2307,8 +2303,7 @@ a token has type \(command, address, end-mark\) and value."
(defun vip-get-ex-pat () (defun vip-get-ex-pat ()
"get a regular expression and set ex-variant if found" "get a regular expression and set ex-variant if found"
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(skip-chars-forward " \t") (skip-chars-forward " \t")
(if (looking-at "!") (if (looking-at "!")
(progn (progn
...@@ -2334,8 +2329,7 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2334,8 +2329,7 @@ a token has type \(command, address, end-mark\) and value."
(defun vip-get-ex-command () (defun vip-get-ex-command ()
"get an ex command" "get an ex command"
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(if (looking-at "/") (forward-char 1)) (if (looking-at "/") (forward-char 1))
(skip-chars-forward " \t") (skip-chars-forward " \t")
(cond ((looking-at "[a-z]") (cond ((looking-at "[a-z]")
...@@ -2349,8 +2343,7 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2349,8 +2343,7 @@ a token has type \(command, address, end-mark\) and value."
(defun vip-get-ex-opt-gc () (defun vip-get-ex-opt-gc ()
"get an ex option g or c" "get an ex option g or c"
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(if (looking-at "/") (forward-char 1)) (if (looking-at "/") (forward-char 1))
(skip-chars-forward " \t") (skip-chars-forward " \t")
(cond ((looking-at "g") (cond ((looking-at "g")
...@@ -2458,8 +2451,7 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2458,8 +2451,7 @@ a token has type \(command, address, end-mark\) and value."
(setq ex-buffer nil) (setq ex-buffer nil)
(setq ex-count nil) (setq ex-count nil)
(setq ex-flag nil) (setq ex-flag nil)
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(skip-chars-forward " \t") (skip-chars-forward " \t")
(if (looking-at "[a-zA-Z]") (if (looking-at "[a-zA-Z]")
(progn (progn
...@@ -2483,8 +2475,7 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2483,8 +2475,7 @@ a token has type \(command, address, end-mark\) and value."
(setq ex-variant nil (setq ex-variant nil
ex-count nil ex-count nil
ex-flag nil) ex-flag nil)
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(skip-chars-forward " \t") (skip-chars-forward " \t")
(if (looking-at "!") (if (looking-at "!")
(progn (progn
...@@ -2510,8 +2501,7 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2510,8 +2501,7 @@ a token has type \(command, address, end-mark\) and value."
ex-variant nil ex-variant nil
ex-append nil ex-append nil
ex-offset nil) ex-offset nil)
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(skip-chars-forward " \t") (skip-chars-forward " \t")
(if (looking-at "!") (if (looking-at "!")
(progn (progn
...@@ -2680,8 +2670,7 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2680,8 +2670,7 @@ a token has type \(command, address, end-mark\) and value."
(goto-char (point-min)) (goto-char (point-min))
(if ex-offset (if ex-offset
(progn (progn
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(delete-region (point-min) (point-max)) (delete-region (point-min) (point-max))
(insert ex-offset "\n") (insert ex-offset "\n")
(goto-char (point-min))) (goto-char (point-min)))
...@@ -2733,19 +2722,18 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2733,19 +2722,18 @@ a token has type \(command, address, end-mark\) and value."
(if (bobp) (setq cont nil) (if (bobp) (setq cont nil)
(forward-line -1) (forward-line -1)
(end-of-line))))) (end-of-line)))))
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*") (setq com-str (buffer-substring (1+ (point)) (1- (point-max)))))
(setq com-str (buffer-substring (1+ (point)) (1- (point-max))))) (while marks
(while marks (goto-char (car marks))
(goto-char (car marks)) ;; report progress of execution on a slow machine.
; report progress of execution on a slow machine. ;;(message "Executing global command...")
;(message "Executing global command...") ;;(if (zerop (% mark-count 10))
;(if (zerop (% mark-count 10)) ;; (message "Executing global command...%d" mark-count))
;(message "Executing global command...%d" mark-count)) (vip-ex com-str)
(vip-ex com-str) (setq mark-count (1- mark-count))
(setq mark-count (1- mark-count)) (setq marks (cdr marks)))))
(setq marks (cdr marks))))) ;;(message "Executing global command...done")))
;(message "Executing global command...done")))
(defun ex-line (com) (defun ex-line (com)
"ex line commands. COM is join, shift-right or shift-left." "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,8 +2789,7 @@ a token has type \(command, address, end-mark\) and value."
(if (null ex-addresses) (if (null ex-addresses)
(setq ex-addresses (setq ex-addresses
(cons (point) nil))) (cons (point) nil)))
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(skip-chars-forward " \t") (skip-chars-forward " \t")
(if (looking-at "[a-z]") (if (looking-at "[a-z]")
(progn (progn
...@@ -2821,8 +2808,7 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2821,8 +2808,7 @@ a token has type \(command, address, end-mark\) and value."
(defun ex-map () (defun ex-map ()
"ex map" "ex map"
(let (char string) (let (char string)
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(skip-chars-forward " \t") (skip-chars-forward " \t")
(setq char (char-to-string (following-char))) (setq char (char-to-string (following-char)))
(forward-char 1) (forward-char 1)
...@@ -2847,8 +2833,7 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2847,8 +2833,7 @@ a token has type \(command, address, end-mark\) and value."
(defun ex-unmap () (defun ex-unmap ()
"ex unmap" "ex unmap"
(let (char) (let (char)
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(skip-chars-forward " \t") (skip-chars-forward " \t")
(setq char (char-to-string (following-char))) (setq char (char-to-string (following-char)))
(forward-char 1) (forward-char 1)
...@@ -2870,8 +2855,7 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2870,8 +2855,7 @@ a token has type \(command, address, end-mark\) and value."
(defun ex-quit () (defun ex-quit ()
"ex quit" "ex quit"
(let (char) (let (char)
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(skip-chars-forward " \t") (skip-chars-forward " \t")
(setq char (following-char))) (setq char (following-char)))
(if (= char ?!) (kill-emacs t) (save-buffers-kill-emacs)))) (if (= char ?!) (kill-emacs t) (save-buffers-kill-emacs))))
...@@ -2883,8 +2867,7 @@ a token has type \(command, address, end-mark\) and value." ...@@ -2883,8 +2867,7 @@ a token has type \(command, address, end-mark\) and value."
(goto-char point) (goto-char point)
(if (not (= point 0)) (with-no-warnings (next-line 1))) (if (not (= point 0)) (with-no-warnings (next-line 1)))
(beginning-of-line) (beginning-of-line)
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(skip-chars-forward " \t") (skip-chars-forward " \t")
(if (looking-at "!") (if (looking-at "!")
(progn (progn
...@@ -2981,8 +2964,7 @@ vip-s-string" ...@@ -2981,8 +2964,7 @@ vip-s-string"
(defun ex-tag () (defun ex-tag ()
"ex tag" "ex tag"
(let (tag) (let (tag)
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(skip-chars-forward " \t") (skip-chars-forward " \t")
(set-mark (point)) (set-mark (point))
(skip-chars-forward "^ |\t\n") (skip-chars-forward "^ |\t\n")
...@@ -3045,8 +3027,7 @@ vip-s-string" ...@@ -3045,8 +3027,7 @@ vip-s-string"
(defun ex-command () (defun ex-command ()
"execute shell command" "execute shell command"
(let (command) (let (command)
(save-window-excursion (with-current-buffer " *ex-working-space*"
(set-buffer " *ex-working-space*")
(skip-chars-forward " \t") (skip-chars-forward " \t")
(set-mark (point)) (set-mark (point))
(end-of-line) (end-of-line)
......
...@@ -903,8 +903,7 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to ...@@ -903,8 +903,7 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
(signal 'quit nil))) (signal 'quit nil)))
(if (not (equal buff (current-buffer))) ; cmd switched buffer (if (not (equal buff (current-buffer))) ; cmd switched buffer
(save-excursion (with-current-buffer buff
(set-buffer buff)
(viper-set-mode-vars-for viper-current-state))) (viper-set-mode-vars-for viper-current-state)))
(viper-set-mode-vars-for viper-current-state) (viper-set-mode-vars-for viper-current-state)
result)) result))
...@@ -917,8 +916,7 @@ Similar to viper-escape-to-emacs, but accepts forms rather than keystrokes." ...@@ -917,8 +916,7 @@ Similar to viper-escape-to-emacs, but accepts forms rather than keystrokes."
(viper-set-mode-vars-for 'emacs-state) (viper-set-mode-vars-for 'emacs-state)
(setq result (eval form)) (setq result (eval form))
(if (not (equal buff (current-buffer))) ; cmd switched buffer (if (not (equal buff (current-buffer))) ; cmd switched buffer
(save-excursion (with-current-buffer buff
(set-buffer buff)
(viper-set-mode-vars-for viper-current-state))) (viper-set-mode-vars-for viper-current-state)))
(viper-set-mode-vars-for viper-current-state) (viper-set-mode-vars-for viper-current-state)
result)) result))
...@@ -4697,8 +4695,7 @@ One can use `` and '' to temporarily jump 1 step back." ...@@ -4697,8 +4695,7 @@ One can use `` and '' to temporarily jump 1 step back."
(with-output-to-temp-buffer " *viper-info*" (with-output-to-temp-buffer " *viper-info*"
(if (and buf pos) (if (and buf pos)
(progn (progn
(save-excursion (with-current-buffer buf
(set-buffer buf)
(setq line-no (1+ (count-lines (point-min) val))) (setq line-no (1+ (count-lines (point-min) val)))
(goto-char pos) (goto-char pos)
(beginning-of-line) (beginning-of-line)
......
...@@ -946,16 +946,14 @@ reversed." ...@@ -946,16 +946,14 @@ reversed."
;; Expand \% and \# in ex command ;; Expand \% and \# in ex command
(defun ex-expand-filsyms (cmd buf) (defun ex-expand-filsyms (cmd buf)
(let (cf pf ret) (let (cf pf ret)
(save-excursion (with-current-buffer buf
(set-buffer buf)
(setq cf buffer-file-name) (setq cf buffer-file-name)
(setq pf (ex-next nil t))) ; this finds alternative file name (setq pf (ex-next nil t))) ; this finds alternative file name
(if (and (null cf) (string-match "[^\\]%\\|\\`%" cmd)) (if (and (null cf) (string-match "[^\\]%\\|\\`%" cmd))
(error "No current file to substitute for `%%'")) (error "No current file to substitute for `%%'"))
(if (and (null pf) (string-match "[^\\]#\\|\\`#" cmd)) (if (and (null pf) (string-match "[^\\]#\\|\\`#" cmd))
(error "No alternate file to substitute for `#'")) (error "No alternate file to substitute for `#'"))
(save-excursion (with-current-buffer (get-buffer-create viper-ex-tmp-buf-name)
(set-buffer (get-buffer-create viper-ex-tmp-buf-name))
(erase-buffer) (erase-buffer)
(insert cmd) (insert cmd)