1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

* x-dnd.el (x-dnd-maybe-call-test-function):

* window.el (split-window-vertically):
* whitespace.el (whitespace-help-on):
* vc-rcs.el (vc-rcs-consult-headers):
* userlock.el (ask-user-about-lock-help)
(ask-user-about-supersession-help):
* type-break.el (type-break-force-mode-line-update):
* time-stamp.el (time-stamp-conv-warn):
* terminal.el (te-set-output-log, te-more-break, te-filter)
(te-sentinel,terminal-emulator):
* term.el (make-term, term-exec, term-sentinel, term-read-input-ring)
(term-write-input-ring, term-check-source, term-start-output-log):
(term-display-buffer-line, term-dynamic-list-completions):
(term-ansi-make-term, serial-term):
* subr.el (selective-display):
* strokes.el (strokes-xpm-to-compressed-string, strokes-decode-buffer)
(strokes-encode-buffer, strokes-xpm-for-compressed-string):
* speedbar.el (speedbar-buffers-tail-notes, speedbar-buffers-item-info)
(speedbar-reconfigure-keymaps, speedbar-add-localized-speedbar-support)
(speedbar-remove-localized-speedbar-support)
(speedbar-set-mode-line-format, speedbar-create-tag-hierarchy)
(speedbar-update-special-contents, speedbar-buffer-buttons-engine)
(speedbar-buffers-line-directory):
* simple.el (shell-command-on-region, append-to-buffer)
(prepend-to-buffer):
* shadowfile.el (shadow-save-todo-file):
* scroll-bar.el (scroll-bar-set-window-start, scroll-bar-drag-1)
(scroll-bar-maybe-set-window-start):
* sb-image.el (speedbar-image-dump):
* saveplace.el (save-place-alist-to-file, save-places-to-alist)
(load-save-place-alist-from-file):
* ps-samp.el (ps-print-message-from-summary):
* ps-print.el (ps-flush-output, ps-insert-file, ps-get-boundingbox)
(ps-background-image, ps-begin-job, ps-do-despool):
* ps-bdf.el (bdf-find-file, bdf-read-font-info):
* printing.el (pr-interface, pr-ps-file-print, pr-find-buffer-visiting)
(pr-ps-message-from-summary, pr-lpr-message-from-summary):
(pr-call-process, pr-file-list, pr-interface-save):
* novice.el (disabled-command-function)
(enable-command, disable-command):
* mouse.el (mouse-buffer-menu-alist):
* mouse-copy.el (mouse-kill-preserving-secondary):
* macros.el (kbd-macro-query):
* ledit.el (ledit-go-to-lisp, ledit-go-to-liszt):
* informat.el (batch-info-validate):
* ido.el (ido-copy-current-word, ido-initiate-auto-merge):
* hippie-exp.el (try-expand-dabbrev-visible):
* help-mode.el (help-make-xrefs):
* help-fns.el (describe-variable):
* generic-x.el (bat-generic-mode-run-as-comint):
* finder.el (finder-mouse-select):
* find-dired.el (find-dired-sentinel):
* filesets.el (filesets-file-close):
* files.el (list-directory):
* faces.el (list-faces-display, describe-face):
* facemenu.el (list-colors-display):
* ezimage.el (ezimage-image-association-dump, ezimage-image-dump):
* epg.el (epg--process-filter, epg-cancel):
* epa.el (epa--marked-keys, epa--select-keys, epa-display-info)
(epa--read-signature-type):
* emerge.el (emerge-copy-as-kill-A, emerge-copy-as-kill-B)
(emerge-file-names):
* ehelp.el (electric-helpify):
* ediff.el (ediff-regions-wordwise, ediff-regions-linewise):
* ediff-vers.el (rcs-ediff-view-revision):
* ediff-util.el (ediff-setup):
* ediff-mult.el (ediff-append-custom-diff):
* ediff-diff.el (ediff-exec-process, ediff-process-sentinel)
(ediff-wordify):
* echistory.el (Electric-command-history-redo-expression):
* dos-w32.el (find-file-not-found-set-buffer-file-coding-system):
* disp-table.el (describe-display-table):
* dired.el (dired-find-buffer-nocreate):
* dired-aux.el (dired-rename-subdir, dired-dwim-target-directory):
* dabbrev.el (dabbrev--same-major-mode-p):
* chistory.el (list-command-history):
* apropos.el (apropos-documentation):
* allout.el (allout-obtain-passphrase):
(allout-copy-exposed-to-buffer):
(allout-verify-passphrase): Use with-current-buffer.
This commit is contained in:
Stefan Monnier 2009-11-13 22:19:45 +00:00
parent 2ccbc060d2
commit 7fdbcd8387
58 changed files with 348 additions and 401 deletions

View File

@ -1,12 +1,94 @@
2009-11-13 Stefan Monnier <monnier@iro.umontreal.ca>
* x-dnd.el (x-dnd-maybe-call-test-function):
* window.el (split-window-vertically):
* whitespace.el (whitespace-help-on):
* vc-rcs.el (vc-rcs-consult-headers):
* userlock.el (ask-user-about-lock-help)
(ask-user-about-supersession-help):
* type-break.el (type-break-force-mode-line-update):
* time-stamp.el (time-stamp-conv-warn):
* terminal.el (te-set-output-log, te-more-break, te-filter)
(te-sentinel,terminal-emulator):
* term.el (make-term, term-exec, term-sentinel, term-read-input-ring)
(term-write-input-ring, term-check-source, term-start-output-log):
(term-display-buffer-line, term-dynamic-list-completions):
(term-ansi-make-term, serial-term):
* subr.el (selective-display):
* strokes.el (strokes-xpm-to-compressed-string, strokes-decode-buffer)
(strokes-encode-buffer, strokes-xpm-for-compressed-string):
* speedbar.el (speedbar-buffers-tail-notes, speedbar-buffers-item-info)
(speedbar-reconfigure-keymaps, speedbar-add-localized-speedbar-support)
(speedbar-remove-localized-speedbar-support)
(speedbar-set-mode-line-format, speedbar-create-tag-hierarchy)
(speedbar-update-special-contents, speedbar-buffer-buttons-engine)
(speedbar-buffers-line-directory):
* simple.el (shell-command-on-region, append-to-buffer)
(prepend-to-buffer):
* shadowfile.el (shadow-save-todo-file):
* scroll-bar.el (scroll-bar-set-window-start, scroll-bar-drag-1)
(scroll-bar-maybe-set-window-start):
* sb-image.el (speedbar-image-dump):
* saveplace.el (save-place-alist-to-file, save-places-to-alist)
(load-save-place-alist-from-file):
* ps-samp.el (ps-print-message-from-summary):
* ps-print.el (ps-flush-output, ps-insert-file, ps-get-boundingbox)
(ps-background-image, ps-begin-job, ps-do-despool):
* ps-bdf.el (bdf-find-file, bdf-read-font-info):
* printing.el (pr-interface, pr-ps-file-print, pr-find-buffer-visiting)
(pr-ps-message-from-summary, pr-lpr-message-from-summary):
(pr-call-process, pr-file-list, pr-interface-save):
* novice.el (disabled-command-function)
(enable-command, disable-command):
* mouse.el (mouse-buffer-menu-alist):
* mouse-copy.el (mouse-kill-preserving-secondary):
* macros.el (kbd-macro-query):
* ledit.el (ledit-go-to-lisp, ledit-go-to-liszt):
* informat.el (batch-info-validate):
* ido.el (ido-copy-current-word, ido-initiate-auto-merge):
* hippie-exp.el (try-expand-dabbrev-visible):
* help-mode.el (help-make-xrefs):
* help-fns.el (describe-variable):
* generic-x.el (bat-generic-mode-run-as-comint):
* finder.el (finder-mouse-select):
* find-dired.el (find-dired-sentinel):
* filesets.el (filesets-file-close):
* files.el (list-directory):
* faces.el (list-faces-display, describe-face):
* facemenu.el (list-colors-display):
* ezimage.el (ezimage-image-association-dump, ezimage-image-dump):
* epg.el (epg--process-filter, epg-cancel):
* epa.el (epa--marked-keys, epa--select-keys, epa-display-info)
(epa--read-signature-type):
* emerge.el (emerge-copy-as-kill-A, emerge-copy-as-kill-B)
(emerge-file-names):
* ehelp.el (electric-helpify):
* ediff.el (ediff-regions-wordwise, ediff-regions-linewise):
* ediff-vers.el (rcs-ediff-view-revision):
* ediff-util.el (ediff-setup):
* ediff-mult.el (ediff-append-custom-diff):
* ediff-diff.el (ediff-exec-process, ediff-process-sentinel)
(ediff-wordify):
* echistory.el (Electric-command-history-redo-expression):
* dos-w32.el (find-file-not-found-set-buffer-file-coding-system):
* disp-table.el (describe-display-table):
* dired.el (dired-find-buffer-nocreate):
* dired-aux.el (dired-rename-subdir, dired-dwim-target-directory):
* dabbrev.el (dabbrev--same-major-mode-p):
* chistory.el (list-command-history):
* apropos.el (apropos-documentation):
* allout.el (allout-obtain-passphrase):
(allout-copy-exposed-to-buffer):
(allout-verify-passphrase): Use with-current-buffer.
2009-11-13 Glenn Morris <rgm@gnu.org>
* Makefile.in (ELCFILES): Regenerate.
2009-11-13 Michael Albinus <michael.albinus@gmx.de>
* net/dbus.el (dbus-registered-objects-table): Renamed from
`dbus-registered-functions-table', because it contains also
properties.
* net/dbus.el (dbus-registered-objects-table): Rename from
`dbus-registered-functions-table', because it contains also properties.
(dbus-unregister-object): Unregister also properties.
(dbus-get-property, dbus-set-property, dbus-get-all-properties):
Use a timeout of 500 msec, in order to not block.
@ -448,8 +530,8 @@
* custom.el (custom-declare-group): Purecopy standard-value.
(custom-declare-group): Purecopy custom-prefix.
* international/mule.el (load-with-code-conversion): Call
do-after-load-evaluation unconditionally.
* international/mule.el (load-with-code-conversion):
Call do-after-load-evaluation unconditionally.
* emacs-lisp/bytecomp.el (byte-compile-output-file-form): Handle defvaralias.

View File

@ -5605,7 +5605,7 @@ alternate presentation format for the outline:
(goto-char beg)
(allout-topic-flat-index))
'(1))))
(save-excursion (set-buffer tobuf)(erase-buffer))
(with-current-buffer tobuf (erase-buffer))
(allout-process-exposed 'allout-insert-listified
beg
end
@ -6283,8 +6283,7 @@ of the availability of a cached copy."
;; Symmetric hereon:
(save-excursion
(set-buffer allout-buffer)
(with-current-buffer allout-buffer
(let* ((hint (if (and (not (string= allout-passphrase-hint-string ""))
(or (equal allout-passphrase-hint-handling 'always)
(and (equal allout-passphrase-hint-handling
@ -6481,8 +6480,7 @@ Derived from value of `allout-passphrase-verifier-string'."
"True if passphrase successfully decrypts verifier, nil otherwise.
\"Otherwise\" includes absence of passphrase verifier."
(save-excursion
(set-buffer allout-buffer)
(with-current-buffer allout-buffer
(and (boundp 'allout-passphrase-verifier-string)
allout-passphrase-verifier-string
(allout-encrypt-string (allout-get-encryption-passphrase-verifier)

View File

@ -736,8 +736,7 @@ Returns list of symbols and documentation found."
(apropos-sort-by-scores apropos-documentation-sort-by-scores)
f v sf sv)
(unwind-protect
(save-excursion
(set-buffer standard-input)
(with-current-buffer standard-input
(apropos-documentation-check-doc-file)
(if do-all
(mapatoms

View File

@ -116,8 +116,7 @@ The buffer is left in Command History mode."
(prin1 (car history))
(terpri))
(setq history (cdr history))))
(save-excursion
(set-buffer "*Command History*")
(with-current-buffer "*Command History*"
(goto-char (point-min))
(if (eobp)
(error "No command history")

View File

@ -62,8 +62,7 @@
;; the article for expansion):
;; (set (make-local-variable 'dabbrev-friend-buffer-function)
;; (lambda (buffer)
;; (save-excursion
;; (set-buffer buffer)
;; (with-current-buffer buffer
;; (memq major-mode '(news-reply-mode gnus-article-mode)))))
@ -594,8 +593,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
;;; Checks if OTHER-BUFFER has the same major mode as current buffer.
(defun dabbrev--same-major-mode-p (other-buffer)
(eq major-mode
(save-excursion
(set-buffer other-buffer)
(with-current-buffer other-buffer
major-mode)))
;;; Back over all abbrev type characters and then moves forward over

View File

@ -1251,8 +1251,7 @@ Special value `always' suppresses confirmation."
(let ((expanded-from-dir (expand-file-name from-dir))
(blist (buffer-list)))
(while blist
(save-excursion
(set-buffer (car blist))
(with-current-buffer (car blist)
(if (and buffer-file-name
(dired-in-this-tree buffer-file-name expanded-from-dir))
(let ((modflag (buffer-modified-p))
@ -1530,8 +1529,7 @@ Optional arg HOW-TO determiness how to treat the target.
;; non-dired buffer may want to profit from this function, e.g. vm-uudecode
(if dired-dwim-target
(let* ((other-buf (window-buffer (next-window)))
(other-dir (save-excursion
(set-buffer other-buf)
(other-dir (with-current-buffer other-buf
(and (eq major-mode 'dired-mode)
(dired-current-directory)))))
(or other-dir this-dir))

View File

@ -819,8 +819,7 @@ for a remote directory. This feature is used by Auto Revert Mode."
(while blist
(if (null (buffer-name (cdr (car blist))))
(setq blist (cdr blist))
(save-excursion
(set-buffer (cdr (car blist)))
(with-current-buffer (cdr (car blist))
(if (and (eq major-mode mode)
dired-directory ;; nil during find-alternate-file
(equal dirname

View File

@ -87,8 +87,7 @@ Valid symbols are `truncation', `wrap', `escape', `control',
(princ "\nVertical window border glyph: ")
(prin1 (display-table-slot dt 'vertical-border))
(princ "\nCharacter display glyph sequences:\n")
(save-excursion
(set-buffer standard-output)
(with-current-buffer standard-output
(let ((vector (make-vector 256 nil))
(i 0))
(while (< i 256)

View File

@ -197,8 +197,7 @@ set to the appropriate coding system, and the value of
(find-file filename)))
(defun find-file-not-found-set-buffer-file-coding-system ()
(save-excursion
(set-buffer (current-buffer))
(with-current-buffer (current-buffer)
(let ((coding buffer-file-coding-system))
;; buffer-file-coding-system is already set by
;; find-operation-coding-system, which was called from

View File

@ -34,8 +34,7 @@
With prefix arg NOCONFIRM, execute current line as-is without editing."
(interactive "P")
(let (todo)
(save-excursion
(set-buffer "*Command History*")
(with-current-buffer "*Command History*"
(beginning-of-line)
(setq todo (read (current-buffer)))
(if (boundp 'electric-history-in-progress)

View File

@ -1225,8 +1225,7 @@ delimiter regions"))
(unwind-protect
(let ((directory default-directory)
proc)
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(erase-buffer)
(setq default-directory directory)
(if (or (memq system-type '(emx ms-dos windows-nt windows-95))
@ -1283,8 +1282,7 @@ delimiter regions"))
(if (and (memq (process-status process) '(exit signal))
(buffer-name (process-buffer process)))
(progn
(save-excursion
(set-buffer (process-buffer process))
(with-current-buffer (process-buffer process)
(setq mode-line-process nil))
(delete-process process))))
@ -1354,8 +1352,7 @@ arguments to `skip-chars-forward'."
ediff-forward-word-function)
ediff-forward-word-function))
inbuf-syntax-tbl sv-point diff-string)
(save-excursion
(set-buffer in-buffer)
(with-current-buffer in-buffer
(setq inbuf-syntax-tbl
(if control-buf
(ediff-with-current-buffer control-buf

View File

@ -1639,8 +1639,7 @@ Useful commands:
(cond ((ediff-buffer-live-p custom-diff-buf)
;; for live session buffers we do them first because the user may
;; have changed them with respect to the underlying files
(save-excursion
(set-buffer meta-diff-buff)
(with-current-buffer meta-diff-buff
(goto-char (point-max))
(insert-buffer-substring custom-diff-buf)
(insert "\n")))
@ -1649,8 +1648,8 @@ Useful commands:
ediff-merge-directories
ediff-merge-directories-with-ancestor))
;; get diffs by calling shell command on ediff-custom-diff-program
(save-excursion
(set-buffer (setq tmp-buf (get-buffer-create ediff-tmp-buffer)))
(with-current-buffer
(setq tmp-buf (get-buffer-create ediff-tmp-buffer))
(erase-buffer)
(shell-command
(format
@ -1662,8 +1661,7 @@ Useful commands:
)
t)
)
(save-excursion
(set-buffer meta-diff-buff)
(with-current-buffer meta-diff-buff
(goto-char (point-max))
(insert-buffer-substring tmp-buf)
(insert "\n")))

View File

@ -343,8 +343,7 @@ to invocation.")
(setq buffer-C
(get-buffer-create
(ediff-unique-buffer-name "*ediff-merge" "*")))
(save-excursion
(set-buffer buffer-C)
(with-current-buffer buffer-C
(insert-buffer-substring buf)
(goto-char (point-min))
(funcall (ediff-with-current-buffer buf major-mode))

View File

@ -123,8 +123,7 @@ comparison or merge operations are being performed."
(fundamental-mode))
(let ((output-buffer (ediff-rcs-get-output-buffer filename buff)))
(delete-windows-on output-buffer)
(save-excursion
(set-buffer output-buffer)
(with-current-buffer output-buffer
(apply 'call-process "co" nil t nil
;; -q: quiet (no diagnostics)
(append switches rcs-default-co-switches

View File

@ -977,8 +977,7 @@ lines. For large regions, use `ediff-regions-linewise'."
(buffer-B
(ediff-clone-buffer-for-region-comparison buffer-B "-Region.B-"))
reg-A-beg reg-A-end reg-B-beg reg-B-end)
(save-excursion
(set-buffer buffer-A)
(with-current-buffer buffer-A
(setq reg-A-beg (region-beginning)
reg-A-end (region-end))
(set-buffer buffer-B)
@ -1018,8 +1017,7 @@ lines. For small regions, use `ediff-regions-wordwise'."
(buffer-B
(ediff-clone-buffer-for-region-comparison buffer-B "-Region.B-"))
reg-A-beg reg-A-end reg-B-beg reg-B-end)
(save-excursion
(set-buffer buffer-A)
(with-current-buffer buffer-A
(setq reg-A-beg (region-beginning)
reg-A-end (region-end))
;; enlarge the region to hold full lines

View File

@ -321,8 +321,7 @@ will select it.)"
;;>> suspend updating of the tick in order to allow
;;>> things like momentary-string-display)
(and b
(save-excursion
(set-buffer b)
(with-current-buffer b
(set-buffer-modified-p t)))
(fset 'help-print-return-message 'ignore)
(call-interactively fun)
@ -333,8 +332,7 @@ will select it.)"
(not (buffer-modified-p b)))))
(fset 'help-print-return-message p)
(and b (buffer-name b)
(save-excursion
(set-buffer b)
(with-current-buffer b
(set-buffer-modified-p m))))))
(with-electric-help 'ignore name t))))

View File

@ -2060,8 +2060,7 @@ With a negative argument, turn off Skip-Prefers mode."
(A-end (1- (aref diff-vector 1)))
;; so further kills don't append
this-command)
(save-excursion
(set-buffer emerge-A-buffer)
(with-current-buffer emerge-A-buffer
(copy-region-as-kill A-begin A-end))))
(defun emerge-copy-as-kill-B ()
@ -2074,8 +2073,7 @@ With a negative argument, turn off Skip-Prefers mode."
(B-end (1- (aref diff-vector 3)))
;; so further kills don't append
this-command)
(save-excursion
(set-buffer emerge-B-buffer)
(with-current-buffer emerge-B-buffer
(copy-region-as-kill B-begin B-end))))
(defun emerge-insert-A (arg)
@ -2170,8 +2168,7 @@ Use C-u l to reset the windows afterward."
(princ (buffer-name))))
(princ "\n")))
(princ emerge-output-description)
(save-excursion
(set-buffer standard-output)
(with-current-buffer standard-output
(help-mode)))))
(defun emerge-join-differences (arg)
@ -3020,8 +3017,7 @@ If some prefix of KEY has a non-prefix definition, it is redefined."
;; minor-mode indicator))
;; (princ (documentation minor-mode)))))
;; (setq minor-modes (cdr minor-modes))))
;; (save-excursion
;; (set-buffer standard-output)
;; (with-current-buffer standard-output
;; (help-mode))
;; (help-print-return-message)))

View File

@ -463,8 +463,7 @@ If ARG is non-nil, mark the key."
(apply #'epa--list-keys epa-list-keys-arguments))
(defun epa--marked-keys ()
(or (save-excursion
(set-buffer epa-keys-buffer)
(or (with-current-buffer epa-keys-buffer
(goto-char (point-min))
(let (keys key)
(while (re-search-forward "^\\*" nil t)
@ -479,11 +478,10 @@ If ARG is non-nil, mark the key."
(list key))))))
(defun epa--select-keys (prompt keys)
(save-excursion
(unless (and epa-keys-buffer
(buffer-live-p epa-keys-buffer))
(setq epa-keys-buffer (generate-new-buffer "*Keys*")))
(set-buffer epa-keys-buffer)
(unless (and epa-keys-buffer
(buffer-live-p epa-keys-buffer))
(setq epa-keys-buffer (generate-new-buffer "*Keys*")))
(with-current-buffer epa-keys-buffer
(epa-key-list-mode)
(let ((inhibit-read-only t)
buffer-read-only)
@ -615,8 +613,7 @@ If SECRET is non-nil, list secret keys instead of public keys."
(setq epa-info-buffer (generate-new-buffer "*Info*")))
(if (get-buffer-window epa-info-buffer)
(delete-window (get-buffer-window epa-info-buffer)))
(save-excursion
(set-buffer epa-info-buffer)
(with-current-buffer epa-info-buffer
(let ((inhibit-read-only t)
buffer-read-only)
(erase-buffer)
@ -716,8 +713,7 @@ If SECRET is non-nil, list secret keys instead of public keys."
(setq type 'detached))
((eq c ??)
(with-output-to-temp-buffer "*Help*"
(save-excursion
(set-buffer standard-output)
(with-current-buffer standard-output
(insert "\
n - Create a normal signature
c - Create a cleartext signature

View File

@ -1143,8 +1143,7 @@ This function is for internal use only."
(goto-char (point-max))
(insert input)))
(if (buffer-live-p (process-buffer process))
(save-excursion
(set-buffer (process-buffer process))
(with-current-buffer (process-buffer process)
(goto-char (point-max))
(insert input)
(unless epg-process-filter-running
@ -1927,8 +1926,7 @@ You can then use `write-region' to write new data into the file."
(defun epg-cancel (context)
(if (buffer-live-p (process-buffer (epg-context-process context)))
(save-excursion
(set-buffer (process-buffer (epg-context-process context)))
(with-current-buffer (process-buffer (epg-context-process context))
(epg-context-set-result-for
epg-context 'error
(cons '(quit)

View File

@ -300,8 +300,7 @@ Optional argument STRING is a string upon which to add text properties."
See `ezimage-expand-image-button-alist' for details."
(interactive)
(with-output-to-temp-buffer "*Ezimage Images*"
(save-excursion
(set-buffer "*Ezimage Images*")
(with-current-buffer "*Ezimage Images*"
(goto-char (point-max))
(insert "Ezimage image cache.\n\n")
(let ((start (point)) (end nil))
@ -324,8 +323,7 @@ See `ezimage-expand-image-button-alist' for details."
See `ezimage-expand-image-button-alist' for details."
(interactive)
(with-output-to-temp-buffer "*Ezimage Images*"
(save-excursion
(set-buffer "*Ezimage Images*")
(with-current-buffer "*Ezimage Images*"
(goto-char (point-max))
(insert "Ezimage image cache.\n\n")
(let ((start (point)) (end nil))

View File

@ -494,8 +494,7 @@ argument BUFFER-NAME is nil, it defaults to *Colors*."
(if lc
(setcdr lc nil)))))
(with-help-window (or buffer-name "*Colors*")
(save-excursion
(set-buffer standard-output)
(with-current-buffer standard-output
(setq truncate-lines t)
(if temp-buffer-show-function
(list-colors-print list)

View File

@ -1273,8 +1273,7 @@ arg, prompt for a regular expression."
(setq max-length (1+ max-length)
line-format (format "%%-%ds" max-length))
(with-help-window "*Faces*"
(save-excursion
(set-buffer standard-output)
(with-current-buffer standard-output
(setq truncate-lines t)
(insert
(substitute-command-keys
@ -1362,8 +1361,7 @@ If FRAME is omitted or nil, use the selected frame."
(if (not (listp face))
(setq face (list face)))
(with-help-window (help-buffer)
(save-excursion
(set-buffer standard-output)
(with-current-buffer standard-output
(dolist (f face)
(if (stringp f) (setq f (intern f)))
;; We may get called for anonymous faces (i.e., faces

View File

@ -5411,8 +5411,7 @@ and `list-directory-verbose-switches'."
(princ "Directory ")
(princ dirname)
(terpri)
(save-excursion
(set-buffer "*Directory*")
(with-current-buffer "*Directory*"
(let ((wildcard (not (file-directory-p dirname))))
(insert-directory dirname switches wildcard (not wildcard)))))
;; Finishing with-output-to-temp-buffer seems to clobber default-directory.

View File

@ -1552,8 +1552,7 @@ First, save the buffer's contents using SAVE-FUNCTION. Then, kill buffer
if `buffer-modified-p' returns nil.
SAVE-FUNCTION takes no argument, but works on the current buffer."
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(if (buffer-modified-p)
(funcall save-function))
(if (not (buffer-modified-p))

View File

@ -291,8 +291,7 @@ Thus ARG can also contain additional grep options."
(let ((buf (process-buffer proc))
(inhibit-read-only t))
(if (buffer-name buf)
(save-excursion
(set-buffer buf)
(with-current-buffer buf
(let ((buffer-read-only nil))
(save-excursion
(goto-char (point-max))

View File

@ -332,8 +332,7 @@ FILE should be in a form suitable for passing to `locate-library'."
(defun finder-mouse-select (event)
"Select item in a finder buffer with the mouse."
(interactive "e")
(save-excursion
(set-buffer (window-buffer (posn-window (event-start event))))
(with-current-buffer (window-buffer (posn-window (event-start event)))
(goto-char (posn-point (event-start event)))
(finder-select)))

View File

@ -546,9 +546,7 @@ like an INI file. You can add this hook to `find-file-hook'."
(require 'comint)
(let* ((file (buffer-file-name))
(buf-name (concat "*" file "*")))
(save-excursion
(set-buffer
(get-buffer-create buf-name))
(with-current-buffer (get-buffer-create buf-name)
(erase-buffer)
(comint-mode)
(comint-exec

View File

@ -789,8 +789,7 @@ file local variable.\n")
(terpri)
(princ output))))
(save-excursion
(set-buffer standard-output)
(with-current-buffer standard-output
;; Return the text we displayed.
(buffer-string))))))))

View File

@ -413,8 +413,7 @@ A special reference `back' is made to return back through a stack of
help buffers. Variable `help-back-label' specifies the text for
that."
(interactive "b")
(save-excursion
(set-buffer (or buffer (current-buffer)))
(with-current-buffer (or buffer (current-buffer))
(goto-char (point-min))
;; Skip the header-type info, though it might be useful to parse
;; it at some stage (e.g. "function in `library'").

View File

@ -1000,8 +1000,7 @@ string). It returns t if a new expansion is found, nil otherwise."
(while (and (not (equal he-search-string ""))
(marker-position he-search-loc)
(not expansion))
(save-excursion
(set-buffer (marker-buffer he-search-loc))
(with-current-buffer (marker-buffer he-search-loc)
(goto-char he-search-loc)
(setq expansion (he-dabbrev-search he-search-string ()
(window-end he-search-window)))

View File

@ -2975,8 +2975,7 @@ If repeated, insert text from buffer instead."
(defun ido-copy-current-word (all)
"Insert current word (file or directory name) from current buffer."
(interactive "P")
(let ((word (save-excursion
(set-buffer ido-entry-buffer)
(let ((word (with-current-buffer ido-entry-buffer
(let ((p (point)) start-line end-line start-name name)
(if (and mark-active (/= p (mark)))
(setq start-name (mark))
@ -4184,8 +4183,7 @@ For details of keybindings, see `ido-find-file'."
ido-text-init contents
ido-rotate-temp t
ido-exit 'refresh)
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(ido-tidy))
(throw 'ido contents))))

View File

@ -497,8 +497,7 @@ For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
nil ;(message "Checking validity of info file %s... OK" file)
(message "----------------------------------------------------------------------")
(message ">> PROBLEMS IN INFO FILE %s" file)
(save-excursion
(set-buffer loss-name)
(with-current-buffer loss-name
(princ (buffer-substring-no-properties
(point-min) (point-max))))
(message "----------------------------------------------------------------------")

View File

@ -94,11 +94,10 @@
(if ledit-save-files
(save-some-buffers))
(if (get-buffer ledit-buffer)
(save-excursion
(set-buffer ledit-buffer)
(goto-char (point-min))
(write-region (point-min) (point-max) ledit-zap-file)
(erase-buffer)))
(with-current-buffer ledit-buffer
(goto-char (point-min))
(write-region (point-min) (point-max) ledit-zap-file)
(erase-buffer)))
(suspend-emacs ledit-go-to-lisp-string)
(load ledit-read-file t t))
@ -108,12 +107,11 @@
(if ledit-save-files
(save-some-buffers))
(if (get-buffer ledit-buffer)
(save-excursion
(set-buffer ledit-buffer)
(goto-char (point-min))
(insert "(declare (macros t))\n")
(write-region (point-min) (point-max) ledit-compile-file)
(erase-buffer)))
(with-current-buffer ledit-buffer
(goto-char (point-min))
(insert "(declare (macros t))\n")
(write-region (point-min) (point-max) ledit-compile-file)
(erase-buffer)))
(suspend-emacs ledit-go-to-liszt-string)
(load ledit-read-file t t))

View File

@ -209,8 +209,7 @@ Possibilities: \\<query-replace-map>
\\[exit] Stop the macro entirely right now.
\\[recenter] Redisplay the screen, then ask again.
\\[edit] Enter recursive edit; ask again when you exit from that."))
(save-excursion
(set-buffer standard-output)
(with-current-buffer standard-output
(help-mode)))))))))))
;;;###autoload

View File

@ -1857,8 +1857,7 @@ Buffers menu is regenerated."
;;nil means the buffer shouldn't be listed. You can redefine this."
;; (if (string-match "\\` " (buffer-name buffer))
;; nil
;; (save-excursion
;; (set-buffer buffer)
;; (with-current-buffer buffer
;; (let ((size (buffer-size)))
;; (format "%s%s %-19s %6s %-15s %s"
;; (if (buffer-modified-p) "*" " ")

View File

@ -200,8 +200,7 @@ by johnh@ficus.cs.ucla.edu."
(window-buffer (posn-window (event-start click)))
(current-buffer)))
(error "Select or click on the buffer where the secondary selection is")))
(save-excursion
(set-buffer (overlay-buffer mouse-secondary-overlay))
(with-current-buffer (overlay-buffer mouse-secondary-overlay)
(kill-region (overlay-start mouse-secondary-overlay)
(overlay-end mouse-secondary-overlay)))
;; (delete-overlay mouse-secondary-overlay)

View File

@ -1975,12 +1975,10 @@ and selects that window."
(format "%%-%ds %%s%%s %%s" maxlen)
(buffer-name elt)
(if (buffer-modified-p elt) "*" " ")
(save-excursion
(set-buffer elt)
(with-current-buffer elt
(if buffer-read-only "%" " "))
(or (buffer-file-name elt)
(save-excursion
(set-buffer elt)
(with-current-buffer elt
(if list-buffers-directory
(expand-file-name
list-buffers-directory)))

View File

@ -85,8 +85,7 @@ y to try it and enable it (no questions if you use it again).
n to cancel--don't try the command, and it remains disabled.
SPC to try the command just this once, but leave it disabled.
! to try it, and enable all disabled commands for this session only.")
(save-excursion
(set-buffer standard-output)
(with-current-buffer standard-output
(help-mode)))
(fit-window-to-buffer (get-buffer-window "*Disabled Command*"))
(message "Type y, n, ! or SPC (the space bar): ")
@ -135,9 +134,8 @@ to future sessions."
(eq system-type 'windows-nt)
(file-exists-p "~/_emacs"))
(setq init-file "~/_emacs")))
(save-excursion
(set-buffer (find-file-noselect
(substitute-in-file-name init-file)))
(with-current-buffer (find-file-noselect
(substitute-in-file-name init-file))
(goto-char (point-min))
(if (search-forward (concat "(put '" (symbol-name command) " ") nil t)
(delete-region
@ -175,9 +173,8 @@ to future sessions."
(eq system-type 'windows-nt)
(file-exists-p "~/_emacs"))
(setq init-file "~/_emacs")))
(save-excursion
(set-buffer (find-file-noselect
(substitute-in-file-name init-file)))
(with-current-buffer (find-file-noselect
(substitute-in-file-name init-file))
(goto-char (point-min))
(if (search-forward (concat "(put '" (symbol-name command) " ") nil t)
(delete-region

View File

@ -3953,8 +3953,7 @@ If BUFFER is nil, the current buffer is used for printing.
For more information, type \\[pr-interface-help]."
(interactive)
(save-excursion
(set-buffer (or buffer (current-buffer)))
(with-current-buffer (or buffer (current-buffer))
(pr-create-interface)))
@ -4457,8 +4456,7 @@ image in a file with that name."
(if (string= pr-ps-command "")
;; default action
(let ((ps-spool-buffer (get-buffer-create ps-spool-buffer-name)))
(save-excursion
(set-buffer ps-spool-buffer)
(with-current-buffer ps-spool-buffer
(erase-buffer)
(insert-file-contents-literally file))
(pr-despool-print))
@ -5028,8 +5026,7 @@ Return only the dayname, if present, weekday, month, and year."
(symbol-value summary-buffer))
(symbol-value summary-default))))
(and (get-buffer buf)
(save-excursion
(set-buffer buf)
(with-current-buffer buf
(pr-mode-print n-up filename header-list)))))
@ -5039,8 +5036,7 @@ Return only the dayname, if present, weekday, month, and year."
(symbol-value summary-buffer))
(symbol-value summary-default))))
(and (get-buffer buf)
(save-excursion
(set-buffer buf)
(with-current-buffer buf
(pr-mode-lpr header-list)))))
@ -5633,8 +5629,7 @@ If menu binding was not done, calls `pr-menu-bind'."
status)
(setq args (pr-remove-nil-from-list args))
;; *Printing Command Output* == show command & args
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(goto-char (point-max))
(insert (format "%s %S\n" cmd args)))
;; *Printing Command Output* == show any return message from command
@ -5645,8 +5640,7 @@ If menu binding was not done, calls `pr-menu-bind'."
((quit error)
(error-message-string data)))))
;; *Printing Command Output* == show exit status
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(goto-char (point-max))
(insert (format "Exit status: %s\n\n" status)))
;; message if error status
@ -5839,8 +5833,7 @@ If menu binding was not done, calls `pr-menu-bind'."
(blist (buffer-list))
found)
(while (and (not found) blist)
(save-excursion
(set-buffer (car blist))
(with-current-buffer (car blist)
(and (eq major-mode 'dired-mode)
(save-excursion
(goto-char (point-min))
@ -5864,9 +5857,8 @@ If menu binding was not done, calls `pr-menu-bind'."
pop-up-frames)
(and (or buffer
(file-readable-p file))
(save-excursion
(set-buffer (or buffer
(find-file-noselect file)))
(with-current-buffer (or buffer
(find-file-noselect file))
(funcall fun)
(or buffer
(kill-buffer (current-buffer))))))))
@ -6047,8 +6039,7 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
(defmacro pr-interface-save (&rest body)
`(save-excursion
(set-buffer pr-i-buffer)
`(with-current-buffer pr-i-buffer
,@body))

View File

@ -95,8 +95,7 @@ If BDFNAME doesn't exist, return nil."
(and (file-readable-p bdfname)
(let ((buf (generate-new-buffer " *bdf-work*"))
(coding-system-for-read 'no-conversion))
(save-excursion
(set-buffer buf)
(with-current-buffer buf
(insert-file-contents bdfname)
buf))))
@ -225,8 +224,7 @@ CODE, where N and CODE are in the following relation:
(message "Reading %s..." bdfname)
(error "BDF file %s doesn't exist" bdfname))
(unwind-protect
(save-excursion
(set-buffer buf)
(with-current-buffer buf
(goto-char (point-min))
(search-forward "\nFONTBOUNDINGBOX")
(setq font-bounding-box

View File

@ -4734,8 +4734,7 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th
(ps-output 'prologue (if (stringp args) (list args) args)))
(defun ps-flush-output ()
(save-excursion
(set-buffer ps-spool-buffer)
(with-current-buffer ps-spool-buffer
(goto-char (point-max))
(while ps-output-head
(let ((it (car ps-output-head)))
@ -4756,8 +4755,7 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th
(defun ps-insert-file (fname)
(ps-flush-output)
(save-excursion
(set-buffer ps-spool-buffer)
(with-current-buffer ps-spool-buffer
(goto-char (point-max))
(insert-file-contents fname)))
@ -4840,8 +4838,7 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th
(defun ps-get-boundingbox ()
(save-excursion
(set-buffer ps-spool-buffer)
(with-current-buffer ps-spool-buffer
(save-excursion
(if (re-search-forward ps-boundingbox-re nil t)
(vector (string-to-number ; lower x
@ -4909,8 +4906,7 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th
;; coordinate adjustment to center image
;; around x and y position
(let ((box (ps-get-boundingbox)))
(save-excursion
(set-buffer ps-spool-buffer)
(with-current-buffer ps-spool-buffer
(save-excursion
(if (re-search-backward "^--back--" nil t)
(replace-match
@ -5795,8 +5791,7 @@ XSTART YSTART are the relative position for the first page in a sheet.")
ps-line-number-step
ps-zebra-stripe-height))))
;; spooling buffer
(save-excursion
(set-buffer ps-spool-buffer)
(with-current-buffer ps-spool-buffer
(goto-char (point-max))
(and (re-search-backward "^%%Trailer$" nil t)
(delete-region (match-beginning 0) (point-max))))
@ -6573,8 +6568,7 @@ If FACE is not a valid face name, use default face."
(and ps-razzle-dazzle (message "Wrote %s" filename)))
;; Else, spool to the printer
(and ps-razzle-dazzle (message "Printing..."))
(save-excursion
(set-buffer ps-spool-buffer)
(with-current-buffer ps-spool-buffer
(let* ((coding-system-for-write 'raw-text-unix)
(ps-printer-name (or ps-printer-name
(and (boundp 'printer-name)

View File

@ -72,8 +72,7 @@
(symbol-value summary-buffer))
summary-default)))
(and (get-buffer ps-buf)
(save-excursion
(set-buffer ps-buf)
(with-current-buffer ps-buf
(ps-spool-buffer-with-faces)))))
;; Look in an article or mail message for the Subject: line. To be

View File

@ -205,8 +205,7 @@ may have changed\) back to `save-place-alist'."
(defun save-place-alist-to-file ()
(let ((file (expand-file-name save-place-file))
(coding-system-for-write 'utf-8))
(save-excursion
(set-buffer (get-buffer-create " *Saved Places*"))
(with-current-buffer (get-buffer-create " *Saved Places*")
(delete-region (point-min) (point-max))
(when save-place-forget-unreadable-files
(save-place-forget-unreadable-files))
@ -236,10 +235,9 @@ may have changed\) back to `save-place-alist'."
;; make sure that the alist does not get overwritten, and then
;; load it if it exists:
(if (file-readable-p file)
(save-excursion
;; don't want to use find-file because we have been
;; adding hooks to it.
(set-buffer (get-buffer-create " *Saved Places*"))
;; don't want to use find-file because we have been
;; adding hooks to it.
(with-current-buffer (get-buffer-create " *Saved Places*")
(delete-region (point-min) (point-max))
(insert-file-contents file)
(goto-char (point-min))
@ -275,8 +273,7 @@ may have changed\) back to `save-place-alist'."
;; put this into a save-excursion in case someone is counting on
;; another function in kill-emacs-hook to act on the last buffer
;; they were in:
(save-excursion
(set-buffer (car buf-list))
(with-current-buffer (car buf-list)
;; save-place checks buffer-file-name too, but we can avoid
;; overhead of function call by checking here too.
(and buffer-file-name (save-place-to-alist))

View File

@ -85,8 +85,7 @@ If we have an image associated with it, use that image."
See `speedbar-expand-image-button-alist' for details."
(interactive)
(with-output-to-temp-buffer "*Speedbar Images*"
(save-excursion
(set-buffer "*Speedbar Images*")
(with-current-buffer "*Speedbar Images*"
(goto-char (point-max))
(insert "Speedbar image cache.\n\n")
(let ((start (point)) (end nil))

View File

@ -156,7 +156,7 @@ Horizontal scroll bars aren't implemented yet."
;;;; Buffer navigation using the scroll bar.
;;; This was used for up-events on button 2, but no longer.
;; This was used for up-events on button 2, but no longer.
(defun scroll-bar-set-window-start (event)
"Set the window start according to where the scroll bar is dragged.
EVENT should be a scroll bar click or drag event."
@ -164,8 +164,7 @@ EVENT should be a scroll bar click or drag event."
(let* ((end-position (event-end event))
(window (nth 0 end-position))
(portion-whole (nth 2 end-position)))
(save-excursion
(set-buffer (window-buffer window))
(with-current-buffer (window-buffer window)
(save-excursion
(goto-char (+ (point-min)
(scroll-bar-scale portion-whole
@ -195,8 +194,7 @@ EVENT should be a scroll bar click or drag event."
portion-start
next-portion-start
(current-start (window-start window)))
(save-excursion
(set-buffer (window-buffer window))
(with-current-buffer (window-buffer window)
(setq portion-start (scroll-bar-drag-position portion-whole))
(setq next-portion-start (max
(scroll-bar-drag-position next-portion-whole)
@ -212,8 +210,7 @@ EVENT should be a scroll bar click or drag event."
(let* ((start-position (event-start event))
(window (nth 0 start-position))
(portion-whole (nth 2 start-position)))
(save-excursion
(set-buffer (window-buffer window))
(with-current-buffer (window-buffer window)
;; Calculate position relative to the accessible part of the buffer.
(goto-char (+ (point-min)
(scroll-bar-scale portion-whole
@ -339,7 +336,7 @@ EVENT should be a scroll bar click."
;;;; Bindings.
;;; For now, we'll set things up to work like xterm.
;; For now, we'll set things up to work like xterm.
(cond ((and (boundp 'x-toolkit-scroll-bars) x-toolkit-scroll-bars)
(global-set-key [vertical-scroll-bar mouse-1]
'scroll-bar-toolkit-scroll))

View File

@ -707,8 +707,7 @@ With non-nil argument also saves the buffer."
(defun shadow-save-todo-file ()
(if (and shadow-todo-buffer (buffer-modified-p shadow-todo-buffer))
(save-excursion
(set-buffer shadow-todo-buffer)
(with-current-buffer shadow-todo-buffer
(condition-case nil ; have to continue even in case of
(basic-save-buffer) ; error, otherwise kill-emacs might
(error ; not work!

View File

@ -2423,8 +2423,7 @@ specifies the value of ERROR-BUFFER."
;; Clear the output buffer, then run the command with
;; output there.
(let ((directory default-directory))
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(setq buffer-read-only nil)
(if (not output-buffer)
(setq default-directory directory))
@ -3469,11 +3468,10 @@ START and END specify the portion of the current buffer to be copied."
(list (read-buffer "Append to buffer: " (other-buffer (current-buffer) t))
(region-beginning) (region-end)))
(let ((oldbuf (current-buffer)))
(save-excursion
(let* ((append-to (get-buffer-create buffer))
(windows (get-buffer-window-list append-to t t))
point)
(set-buffer append-to)
(let* ((append-to (get-buffer-create buffer))
(windows (get-buffer-window-list append-to t t))
point)
(with-current-buffer append-to
(setq point (point))
(barf-if-buffer-read-only)
(insert-buffer-substring oldbuf start end)
@ -3490,8 +3488,7 @@ BUFFER (or buffer name), START and END.
START and END specify the portion of the current buffer to be copied."
(interactive "BPrepend to buffer: \nr")
(let ((oldbuf (current-buffer)))
(save-excursion
(set-buffer (get-buffer-create buffer))
(with-current-buffer (get-buffer-create buffer)
(barf-if-buffer-read-only)
(save-excursion
(insert-buffer-substring oldbuf start end)))))

View File

@ -1173,8 +1173,7 @@ frame and window to be the currently active frame and window."
(with-no-warnings
(specifier-instance has-modeline-p)))
speedbar-buffer)
(save-excursion
(set-buffer speedbar-buffer)
(with-current-buffer speedbar-buffer
(let* ((w (or (speedbar-frame-width) 20))
(p1 "<<")
(p5 ">>")
@ -1246,8 +1245,7 @@ and the existence of packages."
(current-buffer))
speedbar-special-mode-key-map)
(select-frame cf))))))
(save-excursion
(set-buffer speedbar-buffer)
(with-current-buffer speedbar-buffer
(use-local-map (or localmap
(speedbar-initial-keymap)
;; This creates a small keymap we can glom the
@ -1859,8 +1857,7 @@ of the special mode functions."
(if (stringp buffer) (setq buffer (get-buffer buffer)))
(if (not (buffer-live-p buffer))
nil
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(save-match-data
(let ((ms (symbol-name major-mode)) v)
(if (not (string-match "-mode$" ms))
@ -1893,8 +1890,7 @@ of the special mode functions."
(defun speedbar-remove-localized-speedbar-support (buffer)
"Remove any traces that BUFFER supports speedbar in a specialized way."
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(kill-local-variable 'speedbar-special-mode-expansion-list)
(kill-local-variable 'speedbar-special-mode-key-map)
(kill-local-variable 'speedbar-easymenu-definition-special)))
@ -2383,8 +2379,8 @@ the list."
(or (speedbar-line-file)
(speedbar-line-directory))))
(methods (if (get-file-buffer f)
(save-excursion (set-buffer (get-file-buffer f))
speedbar-tag-hierarchy-method)
(with-current-buffer (get-file-buffer f)
speedbar-tag-hierarchy-method)
speedbar-tag-hierarchy-method))
(lst (if (fboundp 'copy-tree)
(copy-tree lst)
@ -2612,9 +2608,8 @@ name will have the function FIND-FUN and not token."
This should only be used by modes classified as special."
(let ((funclst speedbar-special-mode-expansion-list)
(specialbuff (current-buffer)))
(save-excursion
(setq speedbar-desired-buffer specialbuff)
(set-buffer speedbar-buffer)
(setq speedbar-desired-buffer specialbuff)
(with-current-buffer speedbar-buffer
;; If we are leaving a directory, cache it.
(if (not speedbar-shown-directories)
;; Do nothing
@ -3887,8 +3882,8 @@ If TEMP is non-nil, then clicking on a buffer restores the previous display."
(buffer-name (car bl))))
(expchar (if known ?+ ??))
(fn (if known 'speedbar-tag-file nil))
(fname (save-excursion (set-buffer (car bl))
(buffer-file-name))))
(fname (with-current-buffer (car bl)
(buffer-file-name))))
(speedbar-make-tag-line 'bracket expchar fn
(if fname (file-name-nondirectory fname))
(buffer-name (car bl))
@ -3928,8 +3923,7 @@ If TEMP is non-nil, then clicking on a buffer restores the previous display."
"Add a note to the end of the last tag line.
Argument BUFFER is the buffer being tested."
(let (mod ro)
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(setq mod (buffer-modified-p)
ro buffer-read-only))
(if ro (speedbar-insert-button "%" nil nil nil nil t))))
@ -3943,9 +3937,8 @@ Argument BUFFER is the buffer being tested."
(speedbar-message "%s%s %S %d %s"
(if (buffer-modified-p buffer) "* " "")
item
(save-excursion (set-buffer buffer) major-mode)
(save-excursion (set-buffer buffer)
(buffer-size))
(with-current-buffer buffer major-mode)
(with-current-buffer buffer (buffer-size))
(or (buffer-file-name buffer) "<No file>"))))))
(defun speedbar-buffers-line-directory (&optional depth)
@ -3963,8 +3956,7 @@ Optional argument DEPTH specifies the current depth of the back search."
(if (save-excursion
(end-of-line)
(eq start (point)))
(or (save-excursion (set-buffer buffer)
default-directory)
(or (with-current-buffer buffer default-directory)
"")
(buffer-file-name buffer))))))))

View File

@ -1536,8 +1536,7 @@ Encode/decode your strokes with \\[strokes-encode-buffer],
(defun strokes-xpm-to-compressed-string (&optional xpm-buffer)
"Convert XPM in XPM-BUFFER to compressed string representing the stroke.
XPM-BUFFER defaults to ` *strokes-xpm*'."
(save-excursion
(set-buffer (setq xpm-buffer (or xpm-buffer " *strokes-xpm*")))
(with-current-buffer (setq xpm-buffer (or xpm-buffer " *strokes-xpm*"))
(goto-char (point-min))
(search-forward "/* pixels */") ; skip past header junk
(forward-char 2)
@ -1620,8 +1619,7 @@ Optional BUFFER defaults to the current buffer.
Optional FORCE non-nil will ignore the buffer's read-only status."
(interactive)
;; (interactive "*bStrokify buffer: ")
(save-excursion
(set-buffer (setq buffer (get-buffer (or buffer (current-buffer)))))
(with-current-buffer (setq buffer (get-buffer (or buffer (current-buffer))))
(when (or (not buffer-read-only)
force
inhibit-read-only
@ -1669,8 +1667,7 @@ Optional FORCE non-nil will ignore the buffer's read-only status."
;; buffer is killed?
;; (interactive "*bUnstrokify buffer: ")
(interactive)
(save-excursion
(set-buffer (setq buffer (or buffer (current-buffer))))
(with-current-buffer (setq buffer (or buffer (current-buffer)))
(when (or (not buffer-read-only)
force
inhibit-read-only
@ -1706,9 +1703,8 @@ Optional FORCE non-nil will ignore the buffer's read-only status."
(defun strokes-xpm-for-compressed-string (compressed-string &optional bufname)
"Convert the stroke represented by COMPRESSED-STRING into an XPM.
Store XPM in buffer BUFNAME if supplied \(default is ` *strokes-xpm*'\)"
(save-excursion
(or bufname (setq bufname " *strokes-xpm*"))
(set-buffer (get-buffer-create bufname))
(or bufname (setq bufname " *strokes-xpm*"))
(with-current-buffer (get-buffer-create bufname)
(erase-buffer)
(insert compressed-string)
(goto-char (point-min))

View File

@ -1347,8 +1347,7 @@ the process. Any more args are arguments to PROGRAM."
;; If no process, or nuked process, crank up a new one and put buffer in
;; term mode. Otherwise, leave buffer and existing process alone.
(cond ((not (term-check-proc buffer))
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(term-mode)) ; Install local vars, mode, keymap, ...
(term-exec buffer name program startfile switches)))
buffer))
@ -1375,8 +1374,7 @@ commands to use in that buffer.
Blasts any old process running in the buffer. Doesn't set the buffer mode.
You can use this to cheaply run a series of processes in the same term
buffer. The hook `term-exec-hook' is run after each exec."
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(let ((proc (get-buffer-process buffer))) ; Blast any old process.
(when proc (delete-process proc)))
;; Crank up a new process
@ -1412,24 +1410,16 @@ The main purpose is to get rid of the local keymap."
(if (null (buffer-name buffer))
;; buffer killed
(set-process-buffer proc nil)
(let ((obuf (current-buffer)))
;; save-excursion isn't the right thing if
;; process-buffer is current-buffer
(unwind-protect
(progn
;; Write something in the compilation buffer
;; and hack its mode line.
(set-buffer buffer)
;; Get rid of local keymap.
(use-local-map nil)
(term-handle-exit (process-name proc)
msg)
;; Since the buffer and mode line will show that the
;; process is dead, we can delete it now. Otherwise it
;; will stay around until M-x list-processes.
(delete-process proc))
(set-buffer obuf)))
))))
(with-current-buffer buffer
;; Write something in the compilation buffer
;; and hack its mode line.
;; Get rid of local keymap.
(use-local-map nil)
(term-handle-exit (process-name proc) msg)
;; Since the buffer and mode line will show that the
;; process is dead, we can delete it now. Otherwise it
;; will stay around until M-x list-processes.
(delete-process proc))))))
(defun term-handle-exit (process-name msg)
"Write process exit (or other change) message MSG in the current buffer."
@ -1557,8 +1547,7 @@ See also `term-input-ignoredups' and `term-write-input-ring'."
(count 0)
(ring (make-ring term-input-ring-size)))
(unwind-protect
(save-excursion
(set-buffer history-buf)
(with-current-buffer history-buf
(widen)
(erase-buffer)
(insert-file-contents file)
@ -1601,8 +1590,7 @@ See also `term-read-input-ring'."
(index (ring-length ring)))
;; Write it all out into a buffer first. Much faster, but messier,
;; than writing it one line at a time.
(save-excursion
(set-buffer history-buf)
(with-current-buffer history-buf
(erase-buffer)
(while (> index 0)
(setq index (1- index))
@ -2460,10 +2448,8 @@ See `term-prompt-regexp'."
(y-or-n-p (format "Save buffer %s first? "
(buffer-name buff))))
;; save BUFF.
(let ((old-buffer (current-buffer)))
(set-buffer buff)
(save-buffer)
(set-buffer old-buffer)))))
(with-current-buffer buff
(save-buffer)))))
;; (TERM-GET-SOURCE prompt prev-dir/file source-modes mustmatch-p)
@ -3453,8 +3439,7 @@ The top-most line is line 0."
(defun term-display-buffer-line (buffer line)
(let* ((window (display-buffer buffer t))
(pos))
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(save-restriction
(widen)
(goto-char (point-min))
@ -3896,8 +3881,7 @@ if KIND is 1, erase from home to point; else erase from home to point-max."
(message "Output logging off."))
(if (get-buffer name)
nil
(save-excursion
(set-buffer (get-buffer-create name))
(with-current-buffer (get-buffer-create name)
(fundamental-mode)
(buffer-disable-undo (current-buffer))
(erase-buffer)))
@ -4169,8 +4153,7 @@ Typing SPC flushes the help buffer."
(display-completion-list (sort completions 'string-lessp)))
(message "Hit space to flush")
(let (key first)
(if (save-excursion
(set-buffer (get-buffer "*Completions*"))
(if (with-current-buffer (get-buffer "*Completions*")
(setq key (read-key-sequence nil)
first (aref key 0))
(and (consp first)
@ -4197,8 +4180,7 @@ the process. Any more args are arguments to PROGRAM."
;; If no process, or nuked process, crank up a new one and put buffer in
;; term mode. Otherwise, leave buffer and existing process alone.
(cond ((not (term-check-proc buffer))
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(term-mode)) ; Install local vars, mode, keymap, ...
(term-exec buffer name program startfile switches)))
buffer))
@ -4383,8 +4365,7 @@ use in that buffer.
:coding 'no-conversion
:noquery t))
(buffer (process-buffer process)))
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(term-mode)
(term-char-mode)
(goto-char (point-max))

View File

@ -326,8 +326,7 @@ Very poor man's file transfer protocol."
(message "Output logging off."))
(if (get-buffer name)
nil
(save-excursion
(set-buffer (get-buffer-create name))
(with-current-buffer (get-buffer-create name)
(fundamental-mode)
(buffer-disable-undo (current-buffer))
(erase-buffer)))
@ -610,8 +609,7 @@ together with a command \\<terminal-edit-map>to return to terminal emulation: \\
"%-"))
(set-process-filter te-process
(function (lambda (process string)
(save-excursion
(set-buffer (process-buffer process))
(with-current-buffer (process-buffer process)
(setq te-pending-output (nconc te-pending-output
(list string))))
(te-update-pending-output-display))))
@ -874,27 +872,22 @@ move to start of new line, clear to end of line."
(defun te-filter (process string)
(let* ((obuf (current-buffer)))
;; can't use save-excursion, as that preserves point, which we don't want
(unwind-protect
(progn
(set-buffer (process-buffer process))
(goto-char te-saved-point)
(and (bufferp te-log-buffer)
(if (null (buffer-name te-log-buffer))
;; killed
(setq te-log-buffer nil)
(set-buffer te-log-buffer)
(goto-char (point-max))
(insert-before-markers string)
(set-buffer (process-buffer process))))
(setq te-pending-output (nconc te-pending-output (list string)))
(te-update-pending-output-display)
(te-process-output (eq (current-buffer)
(window-buffer (selected-window))))
(set-buffer (process-buffer process))
(setq te-saved-point (point)))
(set-buffer obuf))))
(with-current-buffer (process-buffer process)
(goto-char te-saved-point)
(and (bufferp te-log-buffer)
(if (null (buffer-name te-log-buffer))
;; killed
(setq te-log-buffer nil)
(set-buffer te-log-buffer)
(goto-char (point-max))
(insert-before-markers string)
(set-buffer (process-buffer process))))
(setq te-pending-output (nconc te-pending-output (list string)))
(te-update-pending-output-display)
(te-process-output (eq (current-buffer)
(window-buffer (selected-window))))
(set-buffer (process-buffer process))
(setq te-saved-point (point))))
;; (A version of the following comment which might be distractingly offensive
;; to some readers has been moved to term-nasty.el.)
@ -1043,8 +1036,7 @@ move to start of new line, clear to end of line."
(cond ((eq (process-status process) 'run))
((null (buffer-name (process-buffer process)))) ;deleted
(t (let ((b (current-buffer)))
(save-excursion
(set-buffer (process-buffer process))
(with-current-buffer (process-buffer process)
(setq buffer-read-only nil)
(fundamental-mode)
(goto-char (point-max))
@ -1097,27 +1089,26 @@ This function calls the value of terminal-mode-hook if that exists
and is non-nil after the terminal buffer has been set up and the
subprocess started."
(interactive
(cons (save-excursion
(set-buffer (get-buffer-create "*terminal*"))
(buffer-name (if (or (not (boundp 'te-process))
(null te-process)
(not (eq (process-status te-process)
'run)))
(current-buffer)
(generate-new-buffer "*terminal*"))))
(append
(let* ((default-s
;; Default shell is same thing M-x shell uses.
(or explicit-shell-file-name
(getenv "ESHELL")
(getenv "SHELL")
"/bin/sh"))
(s (read-string
(format "Run program in emulator (default %s): "
default-s))))
(if (equal s "")
(list default-s '())
(te-parse-program-and-args s))))))
(cons (with-current-buffer (get-buffer-create "*terminal*")
(buffer-name (if (or (not (boundp 'te-process))
(null te-process)
(not (eq (process-status te-process)
'run)))
(current-buffer)
(generate-new-buffer "*terminal*"))))
(append
(let* ((default-s
;; Default shell is same thing M-x shell uses.
(or explicit-shell-file-name
(getenv "ESHELL")
(getenv "SHELL")
"/bin/sh"))
(s (read-string
(format "Run program in emulator (default %s): "
default-s))))
(if (equal s "")
(list default-s '())
(te-parse-program-and-args s))))))
(switch-to-buffer buffer)
(if (null width) (setq width (- (window-width (selected-window)) 1)))
(if (null height) (setq height (- (window-height (selected-window)) 1)))

View File

@ -660,8 +660,7 @@ The new forms being recommended now will continue to work then.")
Suggests replacing OLD-FORM with NEW-FORM."
(cond
(time-stamp-conversion-warn
(save-excursion
(set-buffer (get-buffer-create "*Time-stamp-compatibility*"))
(with-current-buffer (get-buffer-create "*Time-stamp-compatibility*")
(goto-char (point-max))
(if (bobp)
(progn

View File

@ -1094,7 +1094,7 @@ FRAC should be the inverse of the fractional value; for example, a value of
(defun type-break-force-mode-line-update (&optional all)
"Force the mode-line of the current buffer to be redisplayed.
With optional non-nil ALL, force redisplay of all mode-lines."
(and all (save-excursion (set-buffer (other-buffer))))
(and all (with-current-buffer (other-buffer)))
(set-buffer-modified-p (buffer-modified-p)))
;; If an exception occurs in Emacs while running the post command hook, the
@ -1108,9 +1108,9 @@ With optional non-nil ALL, force redisplay of all mode-lines."
;;; Timer wrapper functions
;;;
;;; These shield type-break from variations in the interval timer packages
;;; for different versions of Emacs.
;;
;; These shield type-break from variations in the interval timer packages
;; for different versions of Emacs.
(defun type-break-run-at-time (time repeat function)
(condition-case nil (or (require 'timer) (require 'itimer)) (error nil))

View File

@ -91,8 +91,7 @@ You can <s>teal the file; the other user becomes the
intruder if (s)he ever unmodifies the file and then changes it again.
You can <p>roceed; you edit at your own (and the other user's) risk.
You can <q>uit; don't modify this file.")
(save-excursion
(set-buffer standard-output)
(with-current-buffer standard-output
(help-mode))))
(put
@ -155,8 +154,7 @@ If you say `n', the change you started to make will be aborted.
Usually, you should type `n' and then `M-x revert-buffer',
to get the latest version of the file, then make the change again.")
(save-excursion
(set-buffer standard-output)
(with-current-buffer standard-output
(help-mode))))
;; arch-tag: a61c5b60-e1c8-44fd-894a-c617f4dfc639

View File

@ -1055,65 +1055,64 @@ Returns: nil if no headers were found
(cond
((not (get-file-buffer file)) nil)
((let (status version locking-user)
(save-excursion
(set-buffer (get-file-buffer file))
(goto-char (point-min))
(cond
;; search for $Id or $Header
;; -------------------------
;; The `\ 's below avoid an RCS 5.7 bug when checking in this file.
((or (and (search-forward "$Id\ : " nil t)
(looking-at "[^ ]+ \\([0-9.]+\\) "))
(and (progn (goto-char (point-min))
(search-forward "$Header\ : " nil t))
(looking-at "[^ ]+ \\([0-9.]+\\) ")))
(goto-char (match-end 0))
;; if found, store the revision number ...
(setq version (match-string-no-properties 1))
;; ... and check for the locking state
(cond
((looking-at
(concat "[0-9]+[/-][01][0-9][/-][0-3][0-9] " ; date
"[0-2][0-9]:[0-5][0-9]+:[0-6][0-9]+\\([+-][0-9:]+\\)? " ; time
"[^ ]+ [^ ]+ ")) ; author & state
(goto-char (match-end 0)) ; [0-6] in regexp handles leap seconds
(cond
;; unlocked revision
((looking-at "\\$")
(setq locking-user 'none)
(setq status 'rev-and-lock))
;; revision is locked by some user
((looking-at "\\([^ ]+\\) \\$")
(setq locking-user (match-string-no-properties 1))
(setq status 'rev-and-lock))
;; everything else: false
(nil)))
;; unexpected information in
;; keyword string --> quit
(nil)))
;; search for $Revision
;; --------------------
((re-search-forward (concat "\\$"
"Revision: \\([0-9.]+\\) \\$")
nil t)
;; if found, store the revision number ...
(setq version (match-string-no-properties 1))
;; and see if there's any lock information
(goto-char (point-min))
(if (re-search-forward (concat "\\$" "Locker:") nil t)
(cond ((looking-at " \\([^ ]+\\) \\$")
(setq locking-user (match-string-no-properties 1))
(setq status 'rev-and-lock))
((looking-at " *\\$")
(setq locking-user 'none)
(setq status 'rev-and-lock))
(t
(setq locking-user 'none)
(setq status 'rev-and-lock)))
(setq status 'rev)))
;; else: nothing found
;; -------------------
(t nil)))
(with-current-buffer (get-file-buffer file)
(goto-char (point-min))
(cond
;; search for $Id or $Header
;; -------------------------
;; The `\ 's below avoid an RCS 5.7 bug when checking in this file.
((or (and (search-forward "$Id\ : " nil t)
(looking-at "[^ ]+ \\([0-9.]+\\) "))
(and (progn (goto-char (point-min))
(search-forward "$Header\ : " nil t))
(looking-at "[^ ]+ \\([0-9.]+\\) ")))
(goto-char (match-end 0))
;; if found, store the revision number ...
(setq version (match-string-no-properties 1))
;; ... and check for the locking state
(cond
((looking-at
(concat "[0-9]+[/-][01][0-9][/-][0-3][0-9] " ; date
"[0-2][0-9]:[0-5][0-9]+:[0-6][0-9]+\\([+-][0-9:]+\\)? " ; time
"[^ ]+ [^ ]+ ")) ; author & state
(goto-char (match-end 0)) ; [0-6] in regexp handles leap seconds
(cond
;; unlocked revision
((looking-at "\\$")
(setq locking-user 'none)
(setq status 'rev-and-lock))
;; revision is locked by some user
((looking-at "\\([^ ]+\\) \\$")
(setq locking-user (match-string-no-properties 1))
(setq status 'rev-and-lock))
;; everything else: false
(nil)))
;; unexpected information in
;; keyword string --> quit
(nil)))
;; search for $Revision
;; --------------------
((re-search-forward (concat "\\$"
"Revision: \\([0-9.]+\\) \\$")
nil t)
;; if found, store the revision number ...
(setq version (match-string-no-properties 1))
;; and see if there's any lock information
(goto-char (point-min))
(if (re-search-forward (concat "\\$" "Locker:") nil t)
(cond ((looking-at " \\([^ ]+\\) \\$")
(setq locking-user (match-string-no-properties 1))
(setq status 'rev-and-lock))
((looking-at " *\\$")
(setq locking-user 'none)
(setq status 'rev-and-lock))
(t
(setq locking-user 'none)
(setq status 'rev-and-lock)))
(setq status 'rev)))
;; else: nothing found
;; -------------------
(t nil)))
(if status (vc-file-setprop file 'vc-working-revision version))
(and (eq status 'rev-and-lock)
(vc-file-setprop file 'vc-state

View File

@ -1942,8 +1942,7 @@ cleaning up these problems."
(unless (get-buffer whitespace-help-buffer-name)
(delete-other-windows)
(let ((buffer (get-buffer-create whitespace-help-buffer-name)))
(save-excursion
(set-buffer buffer)
(with-current-buffer buffer
(erase-buffer)
(insert whitespace-help-text)
(whitespace-insert-option-mark

View File

@ -1270,8 +1270,7 @@ window."
(setq size (+ (window-height) size)))
(setq new-window (split-window nil size))
(unless split-window-keep-point
(save-excursion
(set-buffer (window-buffer))
(with-current-buffer (window-buffer)
(goto-char (window-start))
(setq moved (vertical-motion (window-height)))
(set-window-start new-window (point))

View File

@ -175,10 +175,10 @@ action and type we got from `x-dnd-test-function'."
(let ((buffer (when (window-live-p window)
(window-buffer window)))
(current-state (x-dnd-get-state-for-frame window)))
(when (or (not (equal buffer (aref current-state 0)))
(not (equal window (aref current-state 1)))
(not (equal action (aref current-state 3))))
(save-excursion
(unless (and (equal buffer (aref current-state 0))
(equal window (aref current-state 1))
(equal action (aref current-state 3)))
(save-current-buffer
(when buffer (set-buffer buffer))
(let* ((action-type (funcall x-dnd-test-function
window