summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2009-10-31 02:38:34 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2009-10-31 02:38:34 +0000
commit9a5293129d0e7b2b6333a735f054d2273572b1b3 (patch)
treea04125bf576f98c659f65f5b4a35cbfedc494652
parentd566f228251359ebf1f1f5ab69753089c04e5515 (diff)
downloademacs-9a5293129d0e7b2b6333a735f054d2273572b1b3.tar.gz
* textmodes/two-column.el (2C-split):
* textmodes/texnfo-upd.el (texinfo-multi-file-included-list): * textmodes/tex-mode.el (tex-set-buffer-directory): * textmodes/spell.el (spell-region, spell-string): * textmodes/reftex.el (reftex-erase-buffer): (reftex-get-file-buffer-force, reftex-kill-temporary-buffers): * textmodes/reftex-toc.el (reftex-toc-promote-action): * textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct) (reftex-select-item): * textmodes/reftex-ref.el (reftex-label-info-update) (reftex-offer-label-menu): * textmodes/reftex-index.el (reftex-index-change-entry) (reftex-index-phrases-info): * textmodes/reftex-global.el (reftex-create-tags-file) (reftex-save-all-document-buffers, reftex-ensure-write-access): * textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite) (reftex-view-crossref-from-bibtex): * textmodes/reftex-cite.el (reftex-bibtex-selection-callback) (reftex-extract-bib-entries-from-thebibliography) (reftex-all-used-citation-keys, reftex-create-bibtex-file): * textmodes/refbib.el (r2b-capitalize-title): (r2b-convert-buffer, r2b-help): * textmodes/page-ext.el (pages-directory) (pages-directory-goto-with-mouse): * textmodes/bibtex.el (bibtex-validate-globally): * textmodes/bib-mode.el (bib-capitalize-title): * textmodes/artist.el (artist-clear-buffer, artist-system): * progmodes/xscheme.el (global-set-scheme-interaction-buffer): (local-set-scheme-interaction-buffer, xscheme-process-filter) (verify-xscheme-buffer, xscheme-enter-interaction-mode) (xscheme-enter-debugger-mode, xscheme-debugger-mode-p) (xscheme-send-control-g-interrupt, xscheme-start-process) (xscheme-process-sentinel, xscheme-cd): * progmodes/verilog-mode.el (verilog-read-always-signals) (verilog-set-define, verilog-getopt-file) (verilog-module-inside-filename-p): * progmodes/sh-script.el: * progmodes/python.el (python-pdbtrack-get-source-buffer) (python-pdbtrack-grub-for-buffer, python-execute-file): * progmodes/octave-inf.el (inferior-octave): * progmodes/idlwave.el (idlwave-scan-user-lib-files) (idlwave-shell-compile-helper-routines, idlwave-set-local) (idlwave-display-completion-list-xemacs, idlwave-list-abbrevs) (idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows) (idlwave-completion-fontify-classes, idlwave-display-calling-sequence): * progmodes/idlw-shell.el (idlwave-shell-examine-display-clear) (idlwave-shell-filter, idlwave-shell-examine-highlight) (idlwave-shell-sentinel, idlwave-shell-filter-directory) (idlwave-shell-display-line, idlwave-shell-set-bp-in-module) (idlwave-shell-examine-display, idlwave-shell-run-region) (idlwave-shell-filter-bp, idlwave-shell-save-and-action) (idlwave-shell-sources-filter, idlwave-shell-goto-next-error): * progmodes/idlw-help.el (idlwave-help-get-special-help) (idlwave-help-get-help-buffer): * progmodes/gud.el (gud-basic-call, gud-find-class) (gud-tooltip-activate-mouse-motions-if-enabled): * progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe): * progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as) (ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file) (ebrowse-tags-next-file): * progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps) (ebnf-eps-production-list, ebnf-begin-file, ebnf-log) (ebnf-eps-finish-and-write): * progmodes/cpp.el (cpp-edit-save): * progmodes/cperl-mode.el (cperl-pod-to-manpage): * progmodes/cc-defs.el (c-emacs-features): * progmodes/antlr-mode.el (antlr-invalidate-context-cache) (antlr-directory-dependencies): * progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name) (ada-run-application, ada-find-in-src-path, ada-goto-parent) (ada-find-any-references, ada-make-filename-from-adaname) (ada-make-body-gnatstub): * obsolete/rnews.el (news-list-news-groups): * obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file): * obsolete/iso-acc.el (iso-acc-minibuf-setup): * net/rcirc.el (rcirc-debug): * net/newst-treeview.el (newsticker--treeview-list-add-item) (newsticker--treeview-list-clear, newsticker-treeview-browse-url) (newsticker--treeview-list-update-faces, newsticker-treeview-save) (newsticker--treeview-item-show-text, newsticker--treeview-item-show) (newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init) (newsticker-treeview-show-item, newsticker--treeview-unfold-node) (newsticker--treeview-list-clear-highlight) (newsticker--treeview-list-update-highlight) (newsticker--treeview-list-highlight-start) (newsticker--treeview-tree-update-highlight) (newsticker--treeview-get-selected-item) (newsticker-treeview-mark-list-items-old) (newsticker--treeview-set-current-node): * net/newst-plainview.el (newsticker--buffer-set-uptodate): * net/newst-backend.el (newsticker--get-news-by-funcall) (newsticker--get-news-by-wget, newsticker--image-get) (newsticker--image-sentinel): * net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field): * net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session): (eudc-ph-close-session): * net/eudc.el (eudc-save-options): * language/thai-word.el (thai-update-word-table): * language/japan-util.el (japanese-string-conversion): * international/titdic-cnv.el (tsang-quick-converter) (ziranma-converter, ctlau-converter): * international/mule-cmds.el (describe-language-environment): * international/ja-dic-cnv.el (skkdic-convert-okuri-ari) (skkdic-convert-postfix, skkdic-convert-prefix): (skkdic-convert-okuri-nasi, skkdic-convert): * emacs-lisp/re-builder.el (reb-update-overlays): * emacs-lisp/pp.el (pp-to-string, pp-display-expression): * emacs-lisp/gulp.el (gulp-send-requests): * emacs-lisp/find-gc.el (trace-call-tree): * emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class) (eieio-describe-generic): * emacs-lisp/eieio-base.el (eieio-persistent-read): * emacs-lisp/edebug.el (edebug-outside-excursion): * emacs-lisp/debug.el (debugger-make-xrefs): * emacs-lisp/cust-print.el (custom-prin1-to-string): * emacs-lisp/chart.el (chart-new-buffer): * emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log): Use with-current-buffer. * textmodes/artist.el (artist-system): Don't call copy-sequence on a fresh string. * progmodes/idlw-shell.el (easymenu setup): Use dolist.
-rw-r--r--lisp/ChangeLog124
-rw-r--r--lisp/emacs-lisp/authors.el6
-rw-r--r--lisp/emacs-lisp/chart.el3
-rw-r--r--lisp/emacs-lisp/cust-print.el6
-rw-r--r--lisp/emacs-lisp/debug.el3
-rw-r--r--lisp/emacs-lisp/edebug.el3
-rw-r--r--lisp/emacs-lisp/eieio-base.el3
-rw-r--r--lisp/emacs-lisp/eieio-opt.el9
-rw-r--r--lisp/emacs-lisp/find-gc.el3
-rw-r--r--lisp/emacs-lisp/gulp.el3
-rw-r--r--lisp/emacs-lisp/pp.el6
-rw-r--r--lisp/emacs-lisp/re-builder.el3
-rw-r--r--lisp/international/ja-dic-cnv.el41
-rw-r--r--lisp/international/mule-cmds.el3
-rw-r--r--lisp/international/titdic-cnv.el9
-rw-r--r--lisp/language/japan-util.el3
-rw-r--r--lisp/language/thai-word.el3
-rw-r--r--lisp/net/eudc.el3
-rw-r--r--lisp/net/eudcb-ph.el9
-rw-r--r--lisp/net/mairix.el10
-rw-r--r--lisp/net/newst-backend.el12
-rw-r--r--lisp/net/newst-plainview.el9
-rw-r--r--lisp/net/newst-treeview.el63
-rw-r--r--lisp/net/rcirc.el3
-rw-r--r--lisp/obsolete/iso-acc.el3
-rw-r--r--lisp/obsolete/resume.el6
-rw-r--r--lisp/obsolete/rnews.el3
-rw-r--r--lisp/progmodes/ada-xref.el34
-rw-r--r--lisp/progmodes/antlr-mode.el6
-rw-r--r--lisp/progmodes/cc-defs.el3
-rw-r--r--lisp/progmodes/cperl-mode.el3
-rw-r--r--lisp/progmodes/cpp.el3
-rw-r--r--lisp/progmodes/ebnf2ps.el18
-rw-r--r--lisp/progmodes/ebrowse.el34
-rw-r--r--lisp/progmodes/gdb-mi.el3
-rw-r--r--lisp/progmodes/gud.el9
-rw-r--r--lisp/progmodes/idlw-help.el6
-rw-r--r--lisp/progmodes/idlw-shell.el94
-rw-r--r--lisp/progmodes/idlwave.el34
-rw-r--r--lisp/progmodes/octave-inf.el3
-rw-r--r--lisp/progmodes/python.el13
-rw-r--r--lisp/progmodes/sh-script.el3
-rw-r--r--lisp/progmodes/verilog-mode.el18
-rw-r--r--lisp/progmodes/xscheme.el38
-rw-r--r--lisp/textmodes/artist.el9
-rw-r--r--lisp/textmodes/bib-mode.el11
-rw-r--r--lisp/textmodes/bibtex.el3
-rw-r--r--lisp/textmodes/page-ext.el6
-rw-r--r--lisp/textmodes/refbib.el51
-rw-r--r--lisp/textmodes/reftex-cite.el10
-rw-r--r--lisp/textmodes/reftex-dcr.el8
-rw-r--r--lisp/textmodes/reftex-global.el34
-rw-r--r--lisp/textmodes/reftex-index.el5
-rw-r--r--lisp/textmodes/reftex-ref.el6
-rw-r--r--lisp/textmodes/reftex-sel.el52
-rw-r--r--lisp/textmodes/reftex-toc.el3
-rw-r--r--lisp/textmodes/reftex.el11
-rw-r--r--lisp/textmodes/spell.el86
-rw-r--r--lisp/textmodes/tex-mode.el3
-rw-r--r--lisp/textmodes/texnfo-upd.el3
-rw-r--r--lisp/textmodes/two-column.el3
61 files changed, 462 insertions, 516 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d444501c4ef..b735945d386 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,127 @@
+2009-10-31 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * textmodes/two-column.el (2C-split):
+ * textmodes/texnfo-upd.el (texinfo-multi-file-included-list):
+ * textmodes/tex-mode.el (tex-set-buffer-directory):
+ * textmodes/spell.el (spell-region, spell-string):
+ * textmodes/reftex.el (reftex-erase-buffer):
+ (reftex-get-file-buffer-force, reftex-kill-temporary-buffers):
+ * textmodes/reftex-toc.el (reftex-toc-promote-action):
+ * textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct)
+ (reftex-select-item):
+ * textmodes/reftex-ref.el (reftex-label-info-update)
+ (reftex-offer-label-menu):
+ * textmodes/reftex-index.el (reftex-index-change-entry)
+ (reftex-index-phrases-info):
+ * textmodes/reftex-global.el (reftex-create-tags-file)
+ (reftex-save-all-document-buffers, reftex-ensure-write-access):
+ * textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite)
+ (reftex-view-crossref-from-bibtex):
+ * textmodes/reftex-cite.el (reftex-bibtex-selection-callback)
+ (reftex-extract-bib-entries-from-thebibliography)
+ (reftex-all-used-citation-keys, reftex-create-bibtex-file):
+ * textmodes/refbib.el (r2b-capitalize-title):
+ (r2b-convert-buffer, r2b-help):
+ * textmodes/page-ext.el (pages-directory)
+ (pages-directory-goto-with-mouse):
+ * textmodes/bibtex.el (bibtex-validate-globally):
+ * textmodes/bib-mode.el (bib-capitalize-title):
+ * textmodes/artist.el (artist-clear-buffer, artist-system):
+ * progmodes/xscheme.el (global-set-scheme-interaction-buffer):
+ (local-set-scheme-interaction-buffer, xscheme-process-filter)
+ (verify-xscheme-buffer, xscheme-enter-interaction-mode)
+ (xscheme-enter-debugger-mode, xscheme-debugger-mode-p)
+ (xscheme-send-control-g-interrupt, xscheme-start-process)
+ (xscheme-process-sentinel, xscheme-cd):
+ * progmodes/verilog-mode.el (verilog-read-always-signals)
+ (verilog-set-define, verilog-getopt-file)
+ (verilog-module-inside-filename-p):
+ * progmodes/sh-script.el:
+ * progmodes/python.el (python-pdbtrack-get-source-buffer)
+ (python-pdbtrack-grub-for-buffer, python-execute-file):
+ * progmodes/octave-inf.el (inferior-octave):
+ * progmodes/idlwave.el (idlwave-scan-user-lib-files)
+ (idlwave-shell-compile-helper-routines, idlwave-set-local)
+ (idlwave-display-completion-list-xemacs, idlwave-list-abbrevs)
+ (idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows)
+ (idlwave-completion-fontify-classes, idlwave-display-calling-sequence):
+ * progmodes/idlw-shell.el (idlwave-shell-examine-display-clear)
+ (idlwave-shell-filter, idlwave-shell-examine-highlight)
+ (idlwave-shell-sentinel, idlwave-shell-filter-directory)
+ (idlwave-shell-display-line, idlwave-shell-set-bp-in-module)
+ (idlwave-shell-examine-display, idlwave-shell-run-region)
+ (idlwave-shell-filter-bp, idlwave-shell-save-and-action)
+ (idlwave-shell-sources-filter, idlwave-shell-goto-next-error):
+ * progmodes/idlw-help.el (idlwave-help-get-special-help)
+ (idlwave-help-get-help-buffer):
+ * progmodes/gud.el (gud-basic-call, gud-find-class)
+ (gud-tooltip-activate-mouse-motions-if-enabled):
+ * progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
+ * progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as)
+ (ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file)
+ (ebrowse-tags-next-file):
+ * progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps)
+ (ebnf-eps-production-list, ebnf-begin-file, ebnf-log)
+ (ebnf-eps-finish-and-write):
+ * progmodes/cpp.el (cpp-edit-save):
+ * progmodes/cperl-mode.el (cperl-pod-to-manpage):
+ * progmodes/cc-defs.el (c-emacs-features):
+ * progmodes/antlr-mode.el (antlr-invalidate-context-cache)
+ (antlr-directory-dependencies):
+ * progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name)
+ (ada-run-application, ada-find-in-src-path, ada-goto-parent)
+ (ada-find-any-references, ada-make-filename-from-adaname)
+ (ada-make-body-gnatstub):
+ * obsolete/rnews.el (news-list-news-groups):
+ * obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file):
+ * obsolete/iso-acc.el (iso-acc-minibuf-setup):
+ * net/rcirc.el (rcirc-debug):
+ * net/newst-treeview.el (newsticker--treeview-list-add-item)
+ (newsticker--treeview-list-clear, newsticker-treeview-browse-url)
+ (newsticker--treeview-list-update-faces, newsticker-treeview-save)
+ (newsticker--treeview-item-show-text, newsticker--treeview-item-show)
+ (newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init)
+ (newsticker-treeview-show-item, newsticker--treeview-unfold-node)
+ (newsticker--treeview-list-clear-highlight)
+ (newsticker--treeview-list-update-highlight)
+ (newsticker--treeview-list-highlight-start)
+ (newsticker--treeview-tree-update-highlight)
+ (newsticker--treeview-get-selected-item)
+ (newsticker-treeview-mark-list-items-old)
+ (newsticker--treeview-set-current-node):
+ * net/newst-plainview.el (newsticker--buffer-set-uptodate):
+ * net/newst-backend.el (newsticker--get-news-by-funcall)
+ (newsticker--get-news-by-wget, newsticker--image-get)
+ (newsticker--image-sentinel):
+ * net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field):
+ * net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session):
+ (eudc-ph-close-session):
+ * net/eudc.el (eudc-save-options):
+ * language/thai-word.el (thai-update-word-table):
+ * language/japan-util.el (japanese-string-conversion):
+ * international/titdic-cnv.el (tsang-quick-converter)
+ (ziranma-converter, ctlau-converter):
+ * international/mule-cmds.el (describe-language-environment):
+ * international/ja-dic-cnv.el (skkdic-convert-okuri-ari)
+ (skkdic-convert-postfix, skkdic-convert-prefix):
+ (skkdic-convert-okuri-nasi, skkdic-convert):
+ * emacs-lisp/re-builder.el (reb-update-overlays):
+ * emacs-lisp/pp.el (pp-to-string, pp-display-expression):
+ * emacs-lisp/gulp.el (gulp-send-requests):
+ * emacs-lisp/find-gc.el (trace-call-tree):
+ * emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class)
+ (eieio-describe-generic):
+ * emacs-lisp/eieio-base.el (eieio-persistent-read):
+ * emacs-lisp/edebug.el (edebug-outside-excursion):
+ * emacs-lisp/debug.el (debugger-make-xrefs):
+ * emacs-lisp/cust-print.el (custom-prin1-to-string):
+ * emacs-lisp/chart.el (chart-new-buffer):
+ * emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log):
+ Use with-current-buffer.
+ * textmodes/artist.el (artist-system): Don't call
+ copy-sequence on a fresh string.
+ * progmodes/idlw-shell.el (easymenu setup): Use dolist.
+
2009-10-31 Stephen Berman <stephen.berman@gmx.net>
* calendar/todo-mode.el (todo-edit-item): Signal an error if there
diff --git a/lisp/emacs-lisp/authors.el b/lisp/emacs-lisp/authors.el
index 1b60f339081..7eb61dd1a5a 100644
--- a/lisp/emacs-lisp/authors.el
+++ b/lisp/emacs-lisp/authors.el
@@ -706,8 +706,7 @@ with the file and the number of each action:
(existing-buffer (get-file-buffer log-file))
(buffer (find-file-noselect log-file))
authors file pos)
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(save-restriction
(widen)
(goto-char (point-min))
@@ -758,8 +757,7 @@ TABLE is a hash table to add author information to."
(enable-local-eval nil)
(buffer (find-file-noselect file)))
(setq file (file-name-nondirectory file))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(save-restriction
(widen)
(goto-char (point-min))
diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el
index 1ec7fda4014..0f0e4046167 100644
--- a/lisp/emacs-lisp/chart.el
+++ b/lisp/emacs-lisp/chart.el
@@ -134,8 +134,7 @@ Useful if new Emacs is used on B&W display.")
(defun chart-new-buffer (obj)
"Create a new buffer NAME in which the chart OBJ is displayed.
Returns the newly created buffer."
- (save-excursion
- (set-buffer (get-buffer-create (format "*%s*" (oref obj title))))
+ (with-current-buffer (get-buffer-create (format "*%s*" (oref obj title)))
(chart-mode)
(setq chart-local-object obj)
(current-buffer)))
diff --git a/lisp/emacs-lisp/cust-print.el b/lisp/emacs-lisp/cust-print.el
index f3a571d5b3f..b9591739cbd 100644
--- a/lisp/emacs-lisp/cust-print.el
+++ b/lisp/emacs-lisp/cust-print.el
@@ -332,15 +332,13 @@ This is the custom-print replacement for the standard `prin1-to-string'."
(let ((buf (get-buffer-create " *custom-print-temp*")))
;; We must erase the buffer before printing in case an error
;; occurred during the last prin1-to-string and we are in debugger.
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(erase-buffer))
;; We must be in the current-buffer when the print occurs.
(if noescape
(custom-princ object buf)
(custom-prin1 object buf))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(buffer-string)
;; We could erase the buffer again, but why bother?
)))
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 59c37a5f3d5..f03e0ab9e40 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -329,8 +329,7 @@ That buffer should be current already."
(defun debugger-make-xrefs (&optional buffer)
"Attach cross-references to function names in the `*Backtrace*' buffer."
(interactive "b")
- (save-excursion
- (set-buffer (or buffer (current-buffer)))
+ (with-current-buffer (or buffer (current-buffer))
(setq buffer (current-buffer))
(let ((inhibit-read-only t)
(old-end (point-min)) (new-end (point-min)))
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index fe47074bf97..68c9659e8f3 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -3605,8 +3605,7 @@ Return the result of the last expression."
)
(setq-default cursor-in-non-selected-windows edebug-outside-d-c-i-n-s-w)
(unwind-protect
- (save-excursion ; of edebug-buffer
- (set-buffer edebug-outside-buffer)
+ (with-current-buffer edebug-outside-buffer ; of edebug-buffer
(goto-char edebug-outside-point)
(if (marker-buffer (edebug-mark-marker))
(set-marker (edebug-mark-marker) edebug-outside-mark))
diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el
index f624714f8a6..a8a219edeb5 100644
--- a/lisp/emacs-lisp/eieio-base.el
+++ b/lisp/emacs-lisp/eieio-base.el
@@ -230,8 +230,7 @@ a file. Optional argument NAME specifies a default file name."
(buffstr nil))
(unwind-protect
(progn
- (save-excursion
- (set-buffer (get-buffer-create " *tmp eieio read*"))
+ (with-current-buffer (get-buffer-create " *tmp eieio read*")
(insert-file-contents filename nil nil nil t)
(goto-char (point-min))
(setq buffstr (buffer-string)))
diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el
index 499f5ebf45a..4afe1738a81 100644
--- a/lisp/emacs-lisp/eieio-opt.el
+++ b/lisp/emacs-lisp/eieio-opt.el
@@ -43,8 +43,7 @@ variable `eieio-default-superclass'."
(if (not root-class) (setq root-class 'eieio-default-superclass))
(if (not (class-p root-class)) (signal 'wrong-type-argument (list 'class-p root-class)))
(display-buffer (get-buffer-create "*EIEIO OBJECT BROWSE*") t)
- (save-excursion
- (set-buffer (get-buffer "*EIEIO OBJECT BROWSE*"))
+ (with-current-buffer (get-buffer "*EIEIO OBJECT BROWSE*")
(erase-buffer)
(goto-char 0)
(eieio-browse-tree root-class "" "")
@@ -161,8 +160,7 @@ Optional HEADERFCN should be called to insert a few bits of info first."
(terpri)
(terpri))
(setq methods (cdr methods))))))
- (save-excursion
- (set-buffer (help-buffer))
+ (with-current-buffer (help-buffer)
(buffer-string)))
(defun eieio-describe-class-slots (class)
@@ -376,8 +374,7 @@ Also extracts information about all methods specific to this generic."
(terpri)
(terpri)))
(setq i (1+ i)))))
- (save-excursion
- (set-buffer (help-buffer))
+ (with-current-buffer (help-buffer)
(buffer-string)))
(defun eieio-lambda-arglist (func)
diff --git a/lisp/emacs-lisp/find-gc.el b/lisp/emacs-lisp/find-gc.el
index 180c3b8a843..1b60b25dc0e 100644
--- a/lisp/emacs-lisp/find-gc.el
+++ b/lisp/emacs-lisp/find-gc.el
@@ -113,8 +113,7 @@ Also store it in `find-gc-unsafe'."
(call-process "csh" nil nil nil "-c"
(format "ln -s %s/*.[ch] /tmp/esrc"
find-gc-source-directory))))
- (save-excursion
- (set-buffer (get-buffer-create "*Trace Call Tree*"))
+ (with-current-buffer (get-buffer-create "*Trace Call Tree*")
(setq find-gc-subrs-called nil)
(let ((case-fold-search nil)
(files find-gc-source-files)
diff --git a/lisp/emacs-lisp/gulp.el b/lisp/emacs-lisp/gulp.el
index 475e2ad753a..cdc2a66be4b 100644
--- a/lisp/emacs-lisp/gulp.el
+++ b/lisp/emacs-lisp/gulp.el
@@ -91,8 +91,7 @@ You can't edit the messages, but you can confirm whether to send each one.
The list of addresses for which you decided not to send mail
is left in the `*gulp*' buffer at the end."
(interactive "DRequest updates for Lisp directory: \nP")
- (save-excursion
- (set-buffer (get-buffer-create gulp-tmp-buffer))
+ (with-current-buffer (get-buffer-create gulp-tmp-buffer)
(let ((m-p-alist (gulp-create-m-p-alist
(directory-files dir nil "^[^=].*\\.el$" t)
dir))
diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el
index 55ae740bd38..45e659efd30 100644
--- a/lisp/emacs-lisp/pp.el
+++ b/lisp/emacs-lisp/pp.el
@@ -42,8 +42,7 @@
"Return a string containing the pretty-printed representation of OBJECT.
OBJECT can be any Lisp object. Quoting characters are used as needed
to make output that `read' can handle, whenever this is possible."
- (save-excursion
- (set-buffer (generate-new-buffer " pp-to-string"))
+ (with-current-buffer (generate-new-buffer " pp-to-string")
(unwind-protect
(progn
(lisp-mode-variables nil)
@@ -105,8 +104,7 @@ after OUT-BUFFER-NAME."
(temp-buffer-show-function
(function
(lambda (buf)
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(goto-char (point-min))
(end-of-line 1)
(if (or (< (1+ (point)) (point-max))
diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index 31f7d8da49e..4b64f7aa808 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -658,8 +658,7 @@ If SUBEXP is non-nil mark only the corresponding sub-expressions."
(matches 0)
(submatches 0)
firstmatch)
- (save-excursion
- (set-buffer reb-target-buffer)
+ (with-current-buffer reb-target-buffer
(reb-delete-overlays)
(goto-char (point-min))
(while (and (not (eobp))
diff --git a/lisp/international/ja-dic-cnv.el b/lisp/international/ja-dic-cnv.el
index 301d24242fd..7300d90f858 100644
--- a/lisp/international/ja-dic-cnv.el
+++ b/lisp/international/ja-dic-cnv.el
@@ -57,8 +57,7 @@
(defun skkdic-convert-okuri-ari (skkbuf buf)
(message "Processing OKURI-ARI entries ...")
(goto-char (point-min))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(insert ";; Setting okuri-ari entries.\n"
"(skkdic-set-okuri-ari\n"))
(while (not (eobp))
@@ -67,8 +66,7 @@
(end-of-line)
(setq to (point))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(insert-buffer-substring skkbuf from to)
(beginning-of-line)
(insert "\"")
@@ -81,8 +79,7 @@
(insert "\"\n"))
(forward-line 1)))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(insert ")\n\n")))
(defconst skkdic-postfix-list '(skkdic-postfix-list))
@@ -111,15 +108,13 @@
(defun skkdic-convert-postfix (skkbuf buf)
(message "Processing POSTFIX entries ...")
(goto-char (point-min))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(insert ";; Setting postfix entries.\n"
"(skkdic-set-postfix\n"))
;; Initialize SKKDIC-POSTFIX-LIST by predefined data
;; SKKDIC-POSTFIX-DATA.
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(let ((l skkdic-postfix-data)
kana candidates entry)
(while l
@@ -146,8 +141,7 @@
(if (not (member str candidates))
(setq candidates (cons str candidates)))
(goto-char (match-end 1)))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(insert "\"" kana)
(while candidates
(insert " " (car candidates))
@@ -160,8 +154,7 @@
skkdic-postfix-list)))
(setq candidates (cdr candidates)))
(insert "\"\n"))))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(insert ")\n\n")))
(defconst skkdic-prefix-list '(skkdic-prefix-list))
@@ -169,8 +162,7 @@
(defun skkdic-convert-prefix (skkbuf buf)
(message "Processing PREFIX entries ...")
(goto-char (point-min))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(insert ";; Setting prefix entries.\n"
"(skkdic-set-prefix\n"))
(save-excursion
@@ -182,16 +174,14 @@
(if (not (member str candidates))
(setq candidates (cons str candidates)))
(goto-char (match-end 1)))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(insert "\"" kana)
(while candidates
(insert " " (car candidates))
(set-nested-alist (car candidates) kana skkdic-prefix-list)
(setq candidates (cdr candidates)))
(insert "\"\n")))))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(insert ")\n\n")))
;; FROM and TO point the head and tail of "/J../J../.../".
@@ -315,8 +305,7 @@
(defun skkdic-convert-okuri-nasi (skkbuf buf)
(message "Processing OKURI-NASI entries ...")
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(insert ";; Setting okuri-nasi entries.\n"
"(skkdic-set-okuri-nasi\n")
(let ((l (nreverse skkdic-okuri-nasi-entries))
@@ -354,9 +343,8 @@ The name of generated file is specified by the variable `ja-dic-filename'."
(let* ((coding-system-for-read 'euc-japan)
(skkbuf(find-file-noselect (expand-file-name filename)))
(buf (get-buffer-create "*skkdic-work*")))
- (save-excursion
- ;; Setup and generate the header part of working buffer.
- (set-buffer buf)
+ ;; Setup and generate the header part of working buffer.
+ (with-current-buffer buf
(erase-buffer)
(buffer-disable-undo)
(insert ";;; ja-dic.el --- dictionary for Japanese input method"
@@ -415,8 +403,7 @@ The name of generated file is specified by the variable `ja-dic-filename'."
(skkdic-convert-okuri-nasi skkbuf buf)
;; Postfix
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(goto-char (point-max))
(insert ";;\n(provide 'ja-dic)\n\n;;; ja-dic.el ends here\n")))
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index d98053dbd76..dc8d134f16c 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -2070,8 +2070,7 @@ See `set-language-info-alist' for use in programs."
(help-setup-xref (list #'describe-language-environment language-name)
(called-interactively-p 'interactive))
(with-output-to-temp-buffer (help-buffer)
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(insert language-name " language environment\n\n")
(if (stringp doc)
(insert doc "\n\n"))
diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el
index 749af106758..bbf98dc1e97 100644
--- a/lisp/international/titdic-cnv.el
+++ b/lisp/international/titdic-cnv.el
@@ -775,8 +775,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"."
(\",\" . quail-prev-translation-block))
nil nil)\n\n")
(insert "(quail-define-rules\n")
- (save-excursion
- (set-buffer dicbuf)
+ (with-current-buffer dicbuf
;; Handle double CR line ends, which result when checking out of
;; CVS on MS-Windows.
(goto-char (point-min))
@@ -931,8 +930,7 @@ method `chinese-tonepy' with which you must specify tones by digits
(defun ziranma-converter (dicbuf name title)
(let (dic)
- (save-excursion
- (set-buffer dicbuf)
+ (with-current-buffer dicbuf
(goto-char (point-min))
(search-forward "\n%keyname end")
(forward-line 1)
@@ -1052,8 +1050,7 @@ To input symbols and punctuations, type `/' followed by one of `a' to
(let (dicbuf-start dicbuf-end key-start key (pos (point)))
;; Find the dictionary, which starts below a horizontal rule and
;; ends at the second to last line in the HTML file.
- (save-excursion
- (set-buffer dicbuf)
+ (with-current-buffer dicbuf
(goto-char (point-min))
(re-search-forward "^#<hr>")
(forward-line 1)
diff --git a/lisp/language/japan-util.el b/lisp/language/japan-util.el
index a97656e25d7..96fd8957d20 100644
--- a/lisp/language/japan-util.el
+++ b/lisp/language/japan-util.el
@@ -162,8 +162,7 @@ belongs to `japanese-jisx0208', ASCII belongs to `ascii'.")
;; Convert string STR by FUNC and return a resulting string.
(defun japanese-string-conversion (str func &rest args)
(let ((buf (get-buffer-create " *Japanese work*")))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(erase-buffer)
(insert str)
(apply func 1 (point) args)
diff --git a/lisp/language/thai-word.el b/lisp/language/thai-word.el
index ed028cb3eaa..322ab45c9ff 100644
--- a/lisp/language/thai-word.el
+++ b/lisp/language/thai-word.el
@@ -10748,8 +10748,7 @@ the current word list."
(coding-system-for-read 'thai-tis620)
(table (if append thai-word-table (list 'thai-words))))
(unwind-protect
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(insert-file-contents file)
(goto-char (point-min))
(while (re-search-forward "\\ct+" nil t)
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el
index e831aac6356..9b5f5977f9e 100644
--- a/lisp/net/eudc.el
+++ b/lisp/net/eudc.el
@@ -1036,8 +1036,7 @@ queries the server for the existing fields and displays a corresponding form."
(defun eudc-save-options ()
"Save options to `eudc-options-file'."
(interactive)
- (save-excursion
- (set-buffer (find-file-noselect eudc-options-file t))
+ (with-current-buffer (find-file-noselect eudc-options-file t)
(goto-char (point-min))
;; delete the previous setq
(let ((standard-output (current-buffer))
diff --git a/lisp/net/eudcb-ph.el b/lisp/net/eudcb-ph.el
index 88e921ee322..b80d3bb3f5b 100644
--- a/lisp/net/eudcb-ph.el
+++ b/lisp/net/eudcb-ph.el
@@ -149,8 +149,7 @@ Wait for response and return the buffer containing it."
(message "Contacting server...")
(setq process (eudc-ph-open-session))
(if process
- (save-excursion
- (set-buffer (setq buffer (process-buffer process)))
+ (with-current-buffer (setq buffer (process-buffer process))
(eudc-ph-send-command process request)
(message "Request sent, waiting for reply...")
(eudc-ph-read-response process))))
@@ -173,8 +172,7 @@ SERVER is either a string naming the server or a list (NAME PORT)."
(setq port (or (match-string 3 server)
eudc-ph-default-server-port))
(setq eudc-ph-process-buffer (get-buffer-create (format " *PH-%s*" host)))
- (save-excursion
- (set-buffer eudc-ph-process-buffer)
+ (with-current-buffer eudc-ph-process-buffer
(erase-buffer)
(setq eudc-ph-read-point (point))
(and (featurep 'xemacs) (featurep 'mule)
@@ -186,8 +184,7 @@ SERVER is either a string naming the server or a list (NAME PORT)."
process)))
(defun eudc-ph-close-session (process)
- (save-excursion
- (set-buffer (process-buffer process))
+ (with-current-buffer (process-buffer process)
(eudc-ph-send-command process "quit")
(eudc-ph-read-response process)
(run-at-time 2 nil 'delete-process process)))
diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el
index 9fd701954d5..4afffc246bb 100644
--- a/lisp/net/mairix.el
+++ b/lisp/net/mairix.el
@@ -260,8 +260,7 @@ Currently there are 'threads and 'flags.")
;; At this point, we are in rmail mode, so the rmail funcs are loaded.
(if (fboundp 'rmail-get-header) ; Emacs 23
(rmail-get-header field)
- (save-excursion
- (set-buffer rmail-buffer)
+ (with-current-buffer rmail-buffer
(save-restriction
;; Don't warn about this when compiling Emacs 23.
(with-no-warnings (rmail-narrow-to-non-pruned-header))
@@ -294,10 +293,9 @@ Currently there are 'threads and 'flags.")
"Get mail header FIELD for current message using Gnus."
(unless (gnus-alive-p)
(error "Gnus is not running"))
- (save-excursion
- (unless (gnus-buffer-exists-p gnus-article-buffer)
- (error "No article buffer available"))
- (set-buffer gnus-article-buffer)
+ (unless (gnus-buffer-exists-p gnus-article-buffer)
+ (error "No article buffer available"))
+ (with-current-buffer gnus-article-buffer
(gnus-summary-toggle-header 1)
(message-field-value field)))
diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
index 23c7e1450f9..8c47314367c 100644
--- a/lisp/net/newst-backend.el
+++ b/lisp/net/newst-backend.el
@@ -726,8 +726,7 @@ If URL is nil it is searched at point."
"Get news for the site FEED-NAME by calling FUNCTION.
See `newsticker-get-news'."
(let ((buffername (concat " *newsticker-funcall-" feed-name "*")))
- (save-excursion
- (set-buffer (get-buffer-create buffername))
+ (with-current-buffer (get-buffer-create buffername)
(erase-buffer)
(insert (string-to-multibyte (funcall function feed-name)))
(newsticker--sentinel-work nil t feed-name function
@@ -777,8 +776,7 @@ from."
WGET-ARGUMENTS is a list of arguments for wget.
See `newsticker-get-news'."
(let ((buffername (concat " *newsticker-wget-" feed-name "*")))
- (save-excursion
- (set-buffer (get-buffer-create buffername))
+ (with-current-buffer (get-buffer-create buffername)
(erase-buffer)
;; throw an error if there is an old wget-process around
(if (get-process feed-name)
@@ -1756,8 +1754,7 @@ If the image has been downloaded in the last 24h do nothing."
feed-name)))
(wget-arguments (or (car (cdr (cdr (cdr (cdr item)))))
newsticker-wget-arguments)))
- (save-excursion
- (set-buffer (get-buffer-create buffername))
+ (with-current-buffer (get-buffer-create buffername)
(erase-buffer)
;; throw an error if there is an old wget-process around
(if (get-process feed-name)
@@ -1785,8 +1782,7 @@ If the image has been downloaded in the last 24h do nothing."
feed-name)
(throw 'oops nil))
(let (image-name)
- (save-excursion
- (set-buffer (process-buffer process))
+ (with-current-buffer (process-buffer process)
(setq image-name (concat (newsticker--images-dir) feed-name))
(set-buffer-file-coding-system 'no-conversion)
;; make sure the cache dir exists
diff --git a/lisp/net/newst-plainview.el b/lisp/net/newst-plainview.el
index 551bda2426b..a6c120876e0 100644
--- a/lisp/net/newst-plainview.el
+++ b/lisp/net/newst-plainview.el
@@ -1210,11 +1210,10 @@ The mode-line is changed accordingly."
(setq newsticker--buffer-uptodate-p value)
(let ((b (get-buffer "*newsticker*")))
(when b
- (save-excursion
- (set-buffer b)
- (if value
- (setq mode-name "Newsticker -- up to date -- ")
- (setq mode-name "Newsticker -- NEED UPDATE -- ")))
+ (with-current-buffer b
+ (setq mode-name (if value
+ "Newsticker -- up to date -- "
+ "Newsticker -- NEED UPDATE -- ")))
(force-mode-line-update 0))))
(defun newsticker--buffer-redraw ()
diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el
index 63740ff5085..9bc094103ec 100644
--- a/lisp/net/newst-treeview.el
+++ b/lisp/net/newst-treeview.el
@@ -307,8 +307,7 @@ their id stays constant."
"Add news ITEM for FEED to newsticker treeview list window.
If string SHOW-FEED is non-nil it is shown in the item string."
(setq newsticker--treeview-list-show-feed show-feed)
- (save-excursion
- (set-buffer (newsticker--treeview-list-buffer))
+ (with-current-buffer (newsticker--treeview-list-buffer)
(let* ((inhibit-read-only t)
pos1 pos2)
(goto-char (point-max))
@@ -350,8 +349,7 @@ If string SHOW-FEED is non-nil it is shown in the item string."
(defun newsticker--treeview-list-clear ()
"Clear the newsticker treeview list window."
- (save-excursion
- (set-buffer (newsticker--treeview-list-buffer))
+ (with-current-buffer (newsticker--treeview-list-buffer)
(let ((inhibit-read-only t))
(erase-buffer)
(kill-all-local-variables)
@@ -549,8 +547,7 @@ The sort function is chosen according to the value of
(defun newsticker--treeview-list-update-faces ()
"Update faces in the treeview list buffer."
(let (pos-sel)
- (save-excursion
- (set-buffer (newsticker--treeview-list-buffer))
+ (with-current-buffer (newsticker--treeview-list-buffer)
(let ((inhibit-read-only t))
(goto-char (point-min))
(while (not (eobp))
@@ -582,8 +579,7 @@ The sort function is chosen according to the value of
(defun newsticker--treeview-list-clear-highlight ()
"Clear the highlight in the treeview list buffer."
- (save-excursion
- (set-buffer (newsticker--treeview-list-buffer))
+ (with-current-buffer (newsticker--treeview-list-buffer)
(let ((inhibit-read-only t))
(put-text-property (point-min) (point-max) :nt-selected nil))
(newsticker--treeview-list-update-faces)))
@@ -592,8 +588,7 @@ The sort function is chosen according to the value of
"Update the highlight in the treeview list buffer."
(newsticker--treeview-list-clear-highlight)
(let (pos num-lines)
- (save-excursion
- (set-buffer (newsticker--treeview-list-buffer))
+ (with-current-buffer (newsticker--treeview-list-buffer)
(let ((inhibit-read-only t))
(put-text-property (save-excursion (beginning-of-line) (point))
(save-excursion (end-of-line) (point))
@@ -602,8 +597,7 @@ The sort function is chosen according to the value of
(defun newsticker--treeview-list-highlight-start ()
"Return position of selection in treeview list buffer."
- (save-excursion
- (set-buffer (newsticker--treeview-list-buffer))
+ (with-current-buffer (newsticker--treeview-list-buffer)
(goto-char (point-min))
(next-single-property-change (point) :nt-selected)))
@@ -677,8 +671,7 @@ for the button."
;; ======================================================================
(defun newsticker--treeview-item-show-text (title description)
"Show text in treeview item buffer consisting of TITLE and DESCRIPTION."
- (save-excursion
- (set-buffer (newsticker--treeview-item-buffer))
+ (with-current-buffer (newsticker--treeview-item-buffer)
(when (fboundp 'w3m-process-stop)
(w3m-process-stop (current-buffer)))
(let ((inhibit-read-only t))
@@ -696,8 +689,7 @@ for the button."
(defun newsticker--treeview-item-show (item feed-name-symbol)
"Show news ITEM coming from FEED-NAME-SYMBOL in treeview item buffer."
(setq newsticker--treeview-current-feed (symbol-name feed-name-symbol))
- (save-excursion
- (set-buffer (newsticker--treeview-item-buffer))
+ (with-current-buffer (newsticker--treeview-item-buffer)
(when (fboundp 'w3m-process-stop)
(w3m-process-stop (current-buffer)))
(let ((inhibit-read-only t)
@@ -1012,8 +1004,7 @@ that case."
(let ((p (point))
(notify (widget-get w :notify)))
;; FIXME: This moves point!!!!
- (save-excursion
- (set-buffer (newsticker--treeview-tree-buffer))
+ (with-current-buffer (newsticker--treeview-tree-buffer)
(widget-value-set w (widget-value w)))
(goto-char p))))))
@@ -1045,8 +1036,7 @@ Arguments IGNORE are ignored."
(newsticker--treeview-get-current-node)
:parent) :from)))
(when (or (integerp pos) (and (markerp pos) (marker-position pos)))
- (save-excursion
- (set-buffer (newsticker--treeview-tree-buffer))
+ (with-current-buffer (newsticker--treeview-tree-buffer)
(goto-char pos)
(move-overlay newsticker--tree-selection-overlay
(save-excursion (beginning-of-line) (point))
@@ -1167,8 +1157,7 @@ Arguments IGNORE are ignored."
(defun newsticker-treeview-browse-url ()
"Call `browse-url' for the link of the item at point."
(interactive)
- (save-excursion
- (set-buffer (newsticker--treeview-list-buffer))
+ (with-current-buffer (newsticker--treeview-list-buffer)
(let ((url (get-text-property (point) :nt-link)))
(when url
(browse-url url)
@@ -1186,15 +1175,13 @@ Arguments IGNORE are ignored."
(get-buffer-create "*Newsticker Item*") t)
(unless newsticker--selection-overlay
- (save-excursion
- (set-buffer (newsticker--treeview-list-buffer))
+ (with-current-buffer (newsticker--treeview-list-buffer)
(setq newsticker--selection-overlay (make-overlay (point-min)
(point-max)))
(overlay-put newsticker--selection-overlay 'face
'newsticker-treeview-selection-face)))
(unless newsticker--tree-selection-overlay
- (save-excursion
- (set-buffer (newsticker--treeview-tree-buffer))
+ (with-current-buffer (newsticker--treeview-tree-buffer)
(setq newsticker--tree-selection-overlay (make-overlay (point-min)
(point-max)))
(overlay-put newsticker--tree-selection-overlay 'face
@@ -1237,11 +1224,10 @@ Note: does not update the layout."
(defun newsticker-treeview-save ()
"Save newsticker data including treeview settings."
(interactive)
- (save-excursion
- (let ((coding-system-for-write 'utf-8)
- (buf (find-file-noselect (concat newsticker-dir "/groups"))))
- (when buf
- (set-buffer buf)
+ (let ((coding-system-for-write 'utf-8)
+ (buf (find-file-noselect (concat newsticker-dir "/groups"))))
+ (when buf
+ (with-current-buffer buf
(setq buffer-undo-list t)
(erase-buffer)
(insert ";; -*- coding: utf-8 -*-\n")
@@ -1287,8 +1273,7 @@ Note: does not update the layout."
(interactive)
(newsticker--treeview-restore-layout)
(newsticker--treeview-list-update-highlight)
- (save-excursion
- (set-buffer (newsticker--treeview-list-buffer))
+ (with-current-buffer (newsticker--treeview-list-buffer)
(beginning-of-line)
(let ((item (get-text-property (point) :nt-item))
(feed (get-text-property (point) :nt-feed)))
@@ -1375,8 +1360,7 @@ Will move to previous feed until an item is found."
(defun newsticker--treeview-get-selected-item ()
"Return item that is currently selected in list buffer."
- (save-excursion
- (set-buffer (newsticker--treeview-list-buffer))
+ (with-current-buffer (newsticker--treeview-list-buffer)
(beginning-of-line)
(get-text-property (point) :nt-item)))
@@ -1415,8 +1399,7 @@ Move to next item unless DONT-PROCEED is non-nil."
(interactive)
(let ((current-feed (or newsticker--treeview-current-feed
newsticker--treeview-current-vfeed)))
- (save-excursion
- (set-buffer (newsticker--treeview-list-buffer))
+ (with-current-buffer (newsticker--treeview-list-buffer)
(goto-char (point-min))
(while (not (eobp))
(let ((item (get-text-property (point) :nt-item)))
@@ -1443,8 +1426,7 @@ Move to next item unless DONT-PROCEED is non-nil."
(defun newsticker--treeview-set-current-node (node)
"Make NODE the current node."
- (save-excursion
- (set-buffer (newsticker--treeview-tree-buffer))
+ (with-current-buffer (newsticker--treeview-tree-buffer)
(setq newsticker--treeview-current-node-id
(widget-get node :nt-id))
(setq newsticker--treeview-current-feed (widget-get node :nt-feed))
@@ -1626,8 +1608,7 @@ Return t if a new feed was activated, nil otherwise."
(newsticker--treeview-unfold-node group-name))
(setq node (newsticker--treeview-get-node-of-feed feed-name)))
(when node
- (save-excursion
- (set-buffer (newsticker--treeview-tree-buffer))
+ (with-current-buffer (newsticker--treeview-tree-buffer)
(widget-put node :nt-selected t)
(widget-apply-action node)
(newsticker--treeview-set-current-node node)))))
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 52d97f38b5c..d1f54c9909d 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -564,8 +564,7 @@ last ping."
Debug text is written to `rcirc-debug-buffer' if `rcirc-debug-flag'
is non-nil."
(when rcirc-debug-flag
- (save-excursion
- (set-buffer (get-buffer-create rcirc-debug-buffer))
+ (with-current-buffer (get-buffer-create rcirc-debug-buffer)
(goto-char (point-max))
(insert (concat
"["
diff --git a/lisp/obsolete/iso-acc.el b/lisp/obsolete/iso-acc.el
index ed949cd0eb3..2e4c01f919c 100644
--- a/lisp/obsolete/iso-acc.el
+++ b/lisp/obsolete/iso-acc.el
@@ -482,8 +482,7 @@ Noninteractively, this operates on text from START to END."
;; if it was in use in the previous buffer.
(defun iso-acc-minibuf-setup ()
(setq iso-accents-mode
- (save-excursion
- (set-buffer (window-buffer minibuffer-scroll-window))
+ (with-current-buffer (window-buffer minibuffer-scroll-window)
iso-accents-mode)))
(add-hook 'minibuffer-setup-hook 'iso-acc-minibuf-setup)
diff --git a/lisp/obsolete/resume.el b/lisp/obsolete/resume.el
index ef412536ba7..5b9e20f1ae3 100644
--- a/lisp/obsolete/resume.el
+++ b/lisp/obsolete/resume.el
@@ -107,8 +107,7 @@
;;;###autoload
(defun resume-suspend-hook ()
"Clear out the file used for transmitting args when Emacs resumes."
- (save-excursion
- (set-buffer (get-buffer-create resume-emacs-args-buffer))
+ (with-current-buffer (get-buffer-create resume-emacs-args-buffer)
(erase-buffer)
(resume-write-buffer-to-file (current-buffer) resume-emacs-args-file)))
@@ -116,8 +115,7 @@
"Writes the contents of BUFFER into FILE, if permissions allow."
(if (not (file-writable-p file))
(error "No permission to write file %s" file))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(clear-visited-file-modtime)
(save-restriction
(widen)
diff --git a/lisp/obsolete/rnews.el b/lisp/obsolete/rnews.el
index be761b1662c..7086108107e 100644
--- a/lisp/obsolete/rnews.el
+++ b/lisp/obsolete/rnews.el
@@ -453,8 +453,7 @@ to a list (a . b)"
"Display all the news groups to which you belong."
(interactive)
(with-output-to-temp-buffer "*Newsgroups*"
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(insert
"News Group Msg No. News Group Msg No.\n")
(insert
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el
index 4bb53a85f47..7a6212d4cfd 100644
--- a/lisp/progmodes/ada-xref.el
+++ b/lisp/progmodes/ada-xref.el
@@ -355,8 +355,7 @@ Return new value of PLIST.
GPR_FILE must be full path to file, normalized.
src_dir, obj_dir will include compiler runtime.
Assumes environment variable ADA_PROJECT_PATH is set properly."
- (save-excursion
- (set-buffer (get-buffer-create "*gnatls*"))
+ (with-current-buffer (get-buffer-create "*gnatls*")
(erase-buffer)
;; this can take a long time; let the user know what's up
@@ -1041,16 +1040,14 @@ existing buffer `*gnatfind*', if there is one."
(setq command (concat command " -p\"" ada-prj-default-project-file "\""))))
(if (and append (get-buffer ada-gnatfind-buffer-name))
- (save-excursion
- (set-buffer "*gnatfind*")
+ (with-current-buffer "*gnatfind*"
(setq old-contents (buffer-string))))
(let ((compilation-error "reference"))
(compilation-start command 'compilation-mode (lambda (mode) ada-gnatfind-buffer-name)))
;; Hide the "Compilation" menu
- (save-excursion
- (set-buffer ada-gnatfind-buffer-name)
+ (with-current-buffer ada-gnatfind-buffer-name
(local-unset-key [menu-bar compilation-menu])
(if old-contents
@@ -1318,8 +1315,7 @@ If ARG is non-nil, ask for user confirmation."
command)))
;; Run the command
- (save-excursion
- (set-buffer (get-buffer-create "*run*"))
+ (with-current-buffer (get-buffer-create "*run*")
(set 'buffer-read-only nil)
(erase-buffer)
@@ -1547,8 +1543,7 @@ the project file."
;; the 'D' lines. This is done repeatedly, in case the direct parent is
;; also a separate.
- (save-excursion
- (set-buffer (get-file-buffer file))
+ (with-current-buffer (get-file-buffer file)
(let ((short-ali-file-name
(concat (file-name-sans-extension (file-name-nondirectory file))
".ali"))
@@ -2044,13 +2039,11 @@ the declaration and documentation of the subprograms one is using."
choice
file)
- (save-excursion
-
- ;; Do the grep in all the directories. We do multiple shell
- ;; commands instead of one in case there is no .ali file in one
- ;; of the directory and the shell stops because of that.
+ ;; Do the grep in all the directories. We do multiple shell
+ ;; commands instead of one in case there is no .ali file in one
+ ;; of the directory and the shell stops because of that.
- (set-buffer (get-buffer-create "*grep*"))
+ (with-current-buffer (get-buffer-create "*grep*")
(while dirs
(insert (shell-command-to-string
(concat
@@ -2234,8 +2227,7 @@ Return the position of the declaration in the buffer, or nil if not found."
(unit-name nil)
(body-name nil)
(ali-name nil))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(goto-char (point-min))
(re-search-forward "^U \\([^ \t%]+\\)%[bs][ \t]+\\([^ \t]+\\)")
(setq unit-name (match-string 1))
@@ -2280,8 +2272,7 @@ Return the position of the declaration in the buffer, or nil if not found."
This is a GNAT specific function that uses gnatkrunch."
(let ((krunch-buf (generate-new-buffer "*gkrunch*"))
(cross-prefix (plist-get (cdr (ada-xref-current-project)) 'cross_prefix)))
- (save-excursion
- (set-buffer krunch-buf)
+ (with-current-buffer krunch-buf
;; send adaname to external process `gnatkr'.
;; Add a dummy extension, since gnatkr versions have two different
;; behaviors depending on the version:
@@ -2340,8 +2331,7 @@ If INTERACTIVE is nil, assume this is called from `ff-file-created-hook'."
" " gnatstub-opts " " filename))
(buffer (get-buffer-create "*gnat stub*")))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(compilation-minor-mode 1)
(erase-buffer)
(insert gnatstub-cmd)
diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el
index 521e8a17aeb..3dc312c0cab 100644
--- a/lisp/progmodes/antlr-mode.el
+++ b/lisp/progmodes/antlr-mode.el
@@ -1087,8 +1087,7 @@ Used for `antlr-slow-syntactic-context'.")
;; checkdoc-params: (dummies)
"Invalidate context cache for syntactical context information."
:XEMACS ; XEmacs bug workaround
- (save-excursion
- (set-buffer (get-buffer-create " ANTLR XEmacs bug workaround"))
+ (with-current-buffer (get-buffer-create " ANTLR XEmacs bug workaround")
(buffer-syntactic-context-depth)
nil)
:EMACS
@@ -2182,8 +2181,7 @@ export vocabulary specified in that file."
"\\'"))
classes dependencies)
(unwind-protect
- (save-excursion
- (set-buffer temp-buffer)
+ (with-current-buffer temp-buffer
(widen) ; just in case...
(dolist (file grammar)
(when (and (file-regular-p file)
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index dc5a005cb2e..c4b85c151ed 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -1469,8 +1469,7 @@ non-nil, a caret is prepended to invert the set."
parse-sexp-lookup-properties
parse-sexp-ignore-comments
lookup-syntax-properties)
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(set-syntax-table (make-syntax-table))
;; For some reason we have to set some of these after the
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 42f7a0e95da..7446de6ff8f 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -8571,8 +8571,7 @@ the appropriate statement modifier."
(let* ((pod2man-args (concat buffer-file-name " | nroff -man "))
(bufname (concat "Man " buffer-file-name))
(buffer (generate-new-buffer bufname)))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(let ((process-environment (copy-sequence process-environment)))
;; Prevent any attempt to use display terminal fanciness.
(setenv "TERM" "dumb")
diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el
index beb7b8cc066..2990cc34038 100644
--- a/lisp/progmodes/cpp.el
+++ b/lisp/progmodes/cpp.el
@@ -575,8 +575,7 @@ You can also use the keyboard accelerators indicated like this: [K]ey."
"Save the current cpp configuration in a file."
(interactive)
(require 'pp)
- (save-excursion
- (set-buffer cpp-edit-buffer)
+ (with-current-buffer cpp-edit-buffer
(let ((buffer (find-file-noselect cpp-config-file)))
(set-buffer buffer)
(erase-buffer)
diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el
index 172151fb274..b64ac2925af 100644
--- a/lisp/progmodes/ebnf2ps.el
+++ b/lisp/progmodes/ebnf2ps.el
@@ -4565,8 +4565,7 @@ end
horizontal (memq (ebnf-node-action prod)
ebnf-action-list))
;; generate production in EPS buffer
- (save-excursion
- (set-buffer eps-buffer)
+ (with-current-buffer eps-buffer
(setq ebnf-eps-upper-x 0.0
ebnf-eps-upper-y 0.0
ebnf-eps-max-width prod-width
@@ -4581,8 +4580,7 @@ end
(ebnf-eps-finish-and-write eps-buffer
(ebnf-eps-filename prod-name)))
;; prepare for next loop
- (save-excursion
- (set-buffer eps-buffer)
+ (with-current-buffer eps-buffer
(erase-buffer))
(setq ebnf-tree (cdr ebnf-tree)))
;; write and kill temporary buffers
@@ -4617,8 +4615,7 @@ end
prod-width prod-height eps-buffer)
(while prod-list
(add-to-list file-list-sym (car prod-list))
- (save-excursion
- (set-buffer (get-buffer-create (concat " *" (car prod-list) "*")))
+ (with-current-buffer (get-buffer-create (concat " *" (car prod-list) "*"))
(goto-char (point-max))
(cond
;; first production
@@ -5278,8 +5275,7 @@ killed after process termination."
(defun ebnf-begin-file ()
(ps-flush-output)
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(goto-char (point-min))
(and (search-forward "%%Creator: " nil t)
(not (search-forward "& ebnf2ps v"
@@ -5299,8 +5295,7 @@ killed after process termination."
(defun ebnf-eps-finish-and-write (buffer filename)
(when (buffer-modified-p buffer)
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(ebnf-eps-header-footer-set filename)
(setq ebnf-eps-upper-x (max ebnf-eps-upper-x ebnf-eps-max-width)
ebnf-eps-upper-y (if (zerop ebnf-eps-upper-y)
@@ -6349,8 +6344,7 @@ killed after process termination."
(defun ebnf-log (format-str &rest args)
(when ebnf-log
- (save-excursion
- (set-buffer (get-buffer-create "*Ebnf2ps Log*"))
+ (with-current-buffer (get-buffer-create "*Ebnf2ps Log*")
(goto-char (point-max))
(insert (apply 'format format-str args) "\n"))))
diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el
index 41a77151c1a..bd0f28b350d 100644
--- a/lisp/progmodes/ebrowse.el
+++ b/lisp/progmodes/ebrowse.el
@@ -1002,8 +1002,7 @@ HEADER is the tree header structure of the class tree."
(loop for buffer in (ebrowse-browser-buffer-list)
until (eq header (ebrowse-value-in-buffer 'ebrowse--header buffer))
finally do
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(ebrowse-fill-member-table))))
(ebrowse-hs-member-table header))
@@ -1613,8 +1612,7 @@ and (b) in the directories named in `ebrowse-search-path'."
Restore frame configuration active before viewing the file,
and possibly kill the viewed buffer."
(let (exit-action original-frame-configuration)
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(setq original-frame-configuration ebrowse--frame-configuration
exit-action ebrowse--view-exit-action))
;; Delete the frame in which we viewed.
@@ -3555,7 +3553,7 @@ The file name is read from the minibuffer."
(interactive)
(let* ((buffer (or (ebrowse-choose-from-browser-buffers)
(error "No tree buffer")))
- (files (save-excursion (set-buffer buffer) (ebrowse-files-table)))
+ (files (with-current-buffer buffer (ebrowse-files-table)))
(file (completing-read "List members in file: " files nil t))
(header (ebrowse-value-in-buffer 'ebrowse--header buffer))
temp-buffer-setup-hook
@@ -3733,8 +3731,7 @@ TREE-BUFFER specifies the class tree we operate on."
;; on which tree (s)he wants to operate.
(when initialize
(let ((buffer (or tree-buffer (ebrowse-choose-from-browser-buffers))))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(setq ebrowse-tags-next-file-list
(ebrowse-files-list (ebrowse-marked-classes-p))
ebrowse-tags-loop-last-file
@@ -4124,8 +4121,7 @@ Otherwise, FILE-NAME specifies the file to save the tree in."
(header (copy-ebrowse-hs ebrowse--header))
(tree ebrowse--tree))
(unwind-protect
- (save-excursion
- (set-buffer (setq standard-output temp-buffer))
+ (with-current-buffer (setq standard-output temp-buffer)
(erase-buffer)
(setf (ebrowse-hs-member-table header) nil)
(insert (prin1-to-string header) " ")
@@ -4210,8 +4206,8 @@ NUMBER-OF-STATIC-VARIABLES:"
;;; Global key bindings
-;;; The following can be used to bind key sequences starting with
-;;; prefix `\C-c\C-m' to browse commands.
+;; The following can be used to bind key sequences starting with
+;; prefix `\C-c\C-m' to browse commands.
(defvar ebrowse-global-map nil
"*Keymap for Ebrowse commands.")
@@ -4270,14 +4266,14 @@ NUMBER-OF-STATIC-VARIABLES:"
;;; Electric C++ browser buffer menu
-;;; Electric buffer menu customization to display only some buffers
-;;; (in this case Tree buffers). There is only one problem with this:
-;;; If the very first character typed in the buffer menu is a space,
-;;; this will select the buffer from which the buffer menu was
-;;; invoked. But this buffer is not displayed in the buffer list if
-;;; it isn't a tree buffer. I therefore let the buffer menu command
-;;; loop read the command `p' via `unread-command-char'. This command
-;;; has no effect since we are on the first line of the buffer.
+;; Electric buffer menu customization to display only some buffers
+;; (in this case Tree buffers). There is only one problem with this:
+;; If the very first character typed in the buffer menu is a space,
+;; this will select the buffer from which the buffer menu was
+;; invoked. But this buffer is not displayed in the buffer list if
+;; it isn't a tree buffer. I therefore let the buffer menu command
+;; loop read the command `p' via `unread-command-char'. This command
+;; has no effect since we are on the first line of the buffer.
(defvar electric-buffer-menu-mode-hook nil)
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index f547f9a17c5..703f4ac6162 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -2465,8 +2465,7 @@ If not in a source or disassembly buffer just set point."
obj)
(when (numberp pos)
(with-selected-window (posn-window posn)
- (save-excursion
- (set-buffer (window-buffer (selected-window)))
+ (with-current-buffer (window-buffer (selected-window))
(goto-char pos)
(dolist (overlay (overlays-in pos pos))
(when (overlay-get overlay 'put-break)
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 49637f9b970..e3413ab137b 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -2831,8 +2831,7 @@ Obeying it means displaying in another window the specified file and line."
(let ((proc (get-buffer-process gud-comint-buffer)))
(or proc (error "Current buffer has no process"))
;; Arrange for the current prompt to get deleted.
- (save-excursion
- (set-buffer gud-comint-buffer)
+ (with-current-buffer gud-comint-buffer
(save-restriction
(widen)
(if (marker-position gud-delete-prompt-marker)
@@ -3062,8 +3061,7 @@ class of the file (using s to separate nested class ids)."
;; symbols until 'topmost-intro is reached to find out if
;; point is within a nested class
(if (and fbuffer (equal (symbol-file 'java-mode) "cc-mode"))
- (save-excursion
- (set-buffer fbuffer)
+ (with-current-buffer fbuffer
(let ((nclass) (syntax))
;; While the c-syntactic information does not start
;; with the 'topmost-intro symbol, there may be
@@ -3327,8 +3325,7 @@ only tooltips in the buffer containing the overlay arrow."
(remove-hook 'post-command-hook
'gud-tooltip-activate-mouse-motions-if-enabled)
(dolist (buffer (buffer-list))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(if (and gud-tooltip-mode
(memq major-mode gud-tooltip-modes))
(gud-tooltip-activate-mouse-motions t)
diff --git a/lisp/progmodes/idlw-help.el b/lisp/progmodes/idlw-help.el
index dffec272b6c..4cf275b3e6f 100644
--- a/lisp/progmodes/idlw-help.el
+++ b/lisp/progmodes/idlw-help.el
@@ -807,8 +807,7 @@ see if a link is set for it. Try extra help functions if necessary."
(defun idlwave-help-get-special-help (name type class keyword)
"Call the function given by `idlwave-extra-help-function'."
(let* ((cw (selected-window))
- (help-pos (save-excursion
- (set-buffer (idlwave-help-get-help-buffer))
+ (help-pos (with-current-buffer (idlwave-help-get-help-buffer)
(let ((buffer-read-only nil))
(funcall idlwave-extra-help-function
name type class keyword)))))
@@ -1224,8 +1223,7 @@ Useful when source code is displayed as help. See the option
(if buf
nil
(setq buf (get-buffer-create "*IDLWAVE Help*"))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(idlwave-help-mode)))
buf))
diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el
index ee4fb984f9a..7fce6a6ae20 100644
--- a/lisp/progmodes/idlw-shell.el
+++ b/lisp/progmodes/idlw-shell.el
@@ -1541,11 +1541,11 @@ and then calls `idlwave-shell-send-command' for any pending commands."
(concat idlwave-shell-accumulation string)))
-;;; Test/Debug code
- ;(with-current-buffer
- ; (get-buffer-create "*idlwave-shell-output*")
- ; (goto-char (point-max))
- ; (insert "\nReceived STRING\n===>\n" string "\n<====\n"))
+ ;; ;; Test/Debug code
+ ;;(with-current-buffer
+ ;; (get-buffer-create "*idlwave-shell-output*")
+ ;; (goto-char (point-max))
+ ;; (insert "\nReceived STRING\n===>\n" string "\n<====\n"))
;; Check for prompt in current accumulating output
(when (setq idlwave-shell-ready
@@ -1553,8 +1553,7 @@ and then calls `idlwave-shell-send-command' for any pending commands."
idlwave-shell-accumulation))
;; Gather the command output
(if idlwave-shell-hide-output
- (save-excursion
- (set-buffer idlwave-shell-hidden-output-buffer)
+ (with-current-buffer idlwave-shell-hidden-output-buffer
(setq full-output (buffer-string))
(goto-char (point-max))
(re-search-backward idlwave-shell-prompt-pattern nil t)
@@ -1618,8 +1617,7 @@ and then calls `idlwave-shell-send-command' for any pending commands."
(let* ((buf (idlwave-shell-buffer))
(win (get-buffer-window buf)))
(when (get-buffer buf)
- (save-excursion
- (set-buffer (idlwave-shell-buffer))
+ (with-current-buffer (idlwave-shell-buffer)
(goto-char (point-max))
(insert (format "\n\n Process %s %s" process event))
(if (and idlwave-shell-save-command-history
@@ -1639,8 +1637,7 @@ and then calls `idlwave-shell-send-command' for any pending commands."
(idlwave-shell-cleanup)
;; Run the hook, if possible in the shell buffer.
(if (get-buffer buf)
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(run-hooks 'idlwave-shell-sentinel-hook))
(run-hooks 'idlwave-shell-sentinel-hook))))
@@ -2088,13 +2085,12 @@ HEAP_GC, /VERBOSE"
(defun idlwave-shell-filter-directory ()
"Get the current directory from `idlwave-shell-command-output'.
Change the default directory for the process buffer to concur."
- (save-excursion
- (set-buffer (idlwave-shell-buffer))
+ (with-current-buffer (idlwave-shell-buffer)
(if (string-match ",___cur[\n\r ]+\\([^\n\r]+\\)[\n\r]"
idlwave-shell-command-output)
(let ((dir (substring idlwave-shell-command-output
(match-beginning 1) (match-end 1))))
-; (message "Setting Emacs working dir to %s" dir)
+ ;; (message "Setting Emacs working dir to %s" dir)
(setq idlwave-shell-default-directory dir)
(setq default-directory (file-name-as-directory dir))))))
@@ -2363,10 +2359,10 @@ matter what the settings of that variable."
;; fixme: errors are dangerous in shell filters. but i think i
;; have never encountered this one.
(error "invalid frame - unable to access file: %s" (car frame))
-;;;
-;;; buffer : the buffer to display a line in.
-;;; select-shell: current buffer is the shell.
-;;;
+ ;;
+ ;; buffer : the buffer to display a line in.
+ ;; select-shell: current buffer is the shell.
+ ;;
(setq idlwave-shell-mode-line-info
(if (nth 2 frame)
(format "[%d:%s]"
@@ -2385,8 +2381,7 @@ matter what the settings of that variable."
nil (idlwave-shell-source-frame)))
;; enter the buffer and mark the line
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(save-restriction
(widen)
(goto-char (point-min))
@@ -2713,8 +2708,7 @@ Assumes that `idlwave-shell-sources-alist' contains an entry for that module."
(message "The source file for module %s is probably not compiled"
module)
(beep))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(save-excursion
(goto-char (point-min))
(let ((case-fold-search t))
@@ -2822,8 +2816,8 @@ Runs to the last statement and then steps 1 statement. Use the .out command."
(idlwave-shell-print (if (idlwave-region-active-p) '(4) nil)
,help ,ev))))
-;;; Begin terrible hack section -- XEmacs tests for button2 explicitly
-;;; on drag events, calling drag-n-drop code if detected. Ughhh...
+;; Begin terrible hack section -- XEmacs tests for button2 explicitly
+;; on drag events, calling drag-n-drop code if detected. Ughhh...
(defun idlwave-default-mouse-track-event-is-with-button (event n)
t)
@@ -3035,8 +3029,7 @@ from `idlwave-shell-examine-alist' via mini-buffer shortcut key."
(defun idlwave-shell-examine-display ()
"View the examine command output in a separate buffer."
(let (win cur-beg cur-end)
- (save-excursion
- (set-buffer (get-buffer-create "*Examine*"))
+ (with-current-buffer (get-buffer-create "*Examine*")
(use-local-map idlwave-shell-examine-map)
(setq buffer-read-only nil)
(goto-char (point-max))
@@ -3121,13 +3114,11 @@ from `idlwave-shell-examine-alist' via mini-buffer shortcut key."
(defun idlwave-shell-examine-display-clear ()
(interactive)
- (save-excursion
- (let ((buf (get-buffer "*Examine*")))
- (when (bufferp buf)
- (set-buffer buf)
- (setq buffer-read-only nil)
- (erase-buffer)
- (setq buffer-read-only t)))))
+ (let ((buf (get-buffer "*Examine*")))
+ (when (bufferp buf)
+ (with-current-buffer buf
+ (let ((inhibit-read-only t))
+ (erase-buffer))))))
(defun idlwave-retrieve-expression-from-level (expr level)
"Return IDL command to print the expression EXPR from stack level LEVEL.
@@ -3222,8 +3213,7 @@ size(___,/DIMENSIONS)"
(process (get-buffer-process buffer))
(process-mark (if process (process-mark process)))
output-begin output-end)
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(goto-char process-mark)
(beginning-of-line)
(setq output-end (point))
@@ -3295,9 +3285,8 @@ An END statement is appended to the region if necessary.
If there is a prefix argument, display IDL process."
(interactive "r\nP")
(let ((oldbuf (current-buffer)))
- (save-excursion
- (set-buffer (idlwave-find-file-noselect
- (idlwave-shell-temp-file 'pro) 'tmp))
+ (with-current-buffer (idlwave-find-file-noselect
+ (idlwave-shell-temp-file 'pro) 'tmp)
(set (make-local-variable 'comment-start-skip) ";+[ \t]*")
(set (make-local-variable 'comment-start) ";")
(erase-buffer)
@@ -3410,8 +3399,7 @@ of 'count, 'cmd and 'condition. Defaults to 'index."
Create `idlwave-shell-bp-alist' updating breakpoint count and command
data from previous breakpoint list. If NO-SHOW is set, don't update
the breakpoint overlays."
- (save-excursion
- (set-buffer (get-buffer-create idlwave-shell-bp-buffer))
+ (with-current-buffer (get-buffer-create idlwave-shell-bp-buffer)
(erase-buffer)
(insert idlwave-shell-command-output)
(goto-char (point-min))
@@ -3914,8 +3902,7 @@ handled by this command."
(idlwave-shell-last-save-and-action-file
(if (setq buf (idlwave-get-buffer-visiting
idlwave-shell-last-save-and-action-file))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(save-buffer))))
(t (setq idlwave-shell-last-save-and-action-file
(read-file-name "File: ")))))
@@ -3995,8 +3982,7 @@ Queries IDL using the string in `idlwave-shell-sources-query'."
Create `idlwave-shell-sources-alist' consisting of list elements
of the form:
(module name . (source-file-truename idlwave-internal-filename))"
- (save-excursion
- (set-buffer (get-buffer-create idlwave-shell-bp-buffer))
+ (with-current-buffer (get-buffer-create idlwave-shell-bp-buffer)
(erase-buffer)
(insert idlwave-shell-command-output)
(goto-char (point-min))
@@ -4068,8 +4054,7 @@ of the form:
"Move point to next IDL syntax error."
(interactive)
(let (frame col)
- (save-excursion
- (set-buffer idlwave-shell-error-buffer)
+ (with-current-buffer idlwave-shell-error-buffer
(goto-char idlwave-shell-error-last)
(if (or
(re-search-forward idlwave-shell-syntax-error nil t)
@@ -4526,14 +4511,13 @@ idlwave-shell-electric-debug-mode-map)
(easy-menu-define
idlwave-shell-mode-menu idlwave-shell-mode-map "IDL shell menus"
idlwave-shell-menu-def)
- (save-excursion
- (mapc (lambda (buf)
- (set-buffer buf)
- (if (eq major-mode 'idlwave-mode)
- (progn
- (easy-menu-remove idlwave-mode-debug-menu)
- (easy-menu-add idlwave-mode-debug-menu))))
- (buffer-list)))))
+ (save-current-buffer
+ (dolist (buf (buffer-list))
+ (set-buffer buf)
+ (if (eq major-mode 'idlwave-mode)
+ (progn
+ (easy-menu-remove idlwave-mode-debug-menu)
+ (easy-menu-add idlwave-mode-debug-menu)))))))
;; The Breakpoint Glyph -------------------------------------------------------
@@ -4694,7 +4678,7 @@ static char * file[] = {
(provide 'idlw-shell)
(provide 'idlwave-shell)
-;;; Load the toolbar when wanted by the user.
+;; Load the toolbar when wanted by the user.
(autoload 'idlwave-toolbar-toggle "idlw-toolbar"
"Toggle the IDLWAVE toolbar.")
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index 4f29d3c7079..8e80bc552e8 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -5512,8 +5512,7 @@ directories and save the routine info.
idlwave-path-alist path-alist ; for library-path instead
idlwave-true-path-alist nil)
(if idlwave-auto-write-paths (idlwave-write-paths))
- (save-excursion
- (set-buffer (get-buffer-create "*idlwave-scan.pro*"))
+ (with-current-buffer (get-buffer-create "*idlwave-scan.pro*")
(idlwave-mode)
(setq dirs-alist (reverse path-alist))
(while (setq dir (pop dirs-alist))
@@ -5818,9 +5817,8 @@ end
(defun idlwave-shell-compile-helper-routines (&optional wait)
(unless (and idlwave-idlwave_routine_info-compiled
(file-readable-p (idlwave-shell-temp-file 'rinfo)))
- (save-excursion
- (set-buffer (idlwave-find-file-noselect
- (idlwave-shell-temp-file 'pro)))
+ (with-current-buffer (idlwave-find-file-noselect
+ (idlwave-shell-temp-file 'pro))
(erase-buffer)
(insert idlwave-routine-info.pro)
(save-buffer 0))
@@ -7171,14 +7169,12 @@ If these don't exist, a letter in the string is automatically selected."
(defun idlwave-set-local (var value &optional buffer)
"Set the buffer-local value of VAR in BUFFER to VALUE."
- (save-excursion
- (set-buffer (or buffer (current-buffer)))
+ (with-current-buffer (or buffer (current-buffer))
(set (make-local-variable var) value)))
(defun idlwave-local-value (var &optional buffer)
"Return the value of VAR in BUFFER, but only if VAR is local to BUFFER."
- (save-excursion
- (set-buffer (or buffer (current-buffer)))
+ (with-current-buffer (or buffer (current-buffer))
(and (local-variable-p var (current-buffer))
(symbol-value var))))
@@ -7194,8 +7190,7 @@ If these don't exist, a letter in the string is automatically selected."
(apply 'display-completion-list list
':activate-callback 'idlwave-default-choose-completion
cl-args))
- (save-excursion
- (set-buffer "*Completions*")
+ (with-current-buffer "*Completions*"
(use-local-map
(or idlwave-completion-map
(setq idlwave-completion-map
@@ -7222,8 +7217,7 @@ If these don't exist, a letter in the string is automatically selected."
"Display completion list and install the choose wrappers."
(with-output-to-temp-buffer "*Completions*"
(display-completion-list list))
- (save-excursion
- (set-buffer "*Completions*")
+ (with-current-buffer "*Completions*"
(use-local-map
(or idlwave-completion-map
(setq idlwave-completion-map
@@ -7837,8 +7831,7 @@ associated TAG, if any."
(defun idlwave-completion-fontify-classes ()
"Goto the *Completions* buffer and fontify the class info."
(when (featurep 'font-lock)
- (save-excursion
- (set-buffer "*Completions*")
+ (with-current-buffer "*Completions*"
(save-excursion
(goto-char (point-min))
(let ((buffer-read-only nil))
@@ -8385,9 +8378,8 @@ If we do not know about MODULE, just return KEYWORD literally."
((null calling-seq)
(error "Calling sequence of %s %s not available" type name))
(t
- (save-excursion
- (move-marker idlwave-rinfo-marker (point))
- (set-buffer (get-buffer-create "*Help*"))
+ (move-marker idlwave-rinfo-marker (point))
+ (with-current-buffer (get-buffer-create "*Help*")
(use-local-map idlwave-rinfo-map)
(setq buffer-read-only nil)
(erase-buffer)
@@ -8755,8 +8747,7 @@ can be used to detect possible name clashes during this process."
(apply 'idlwave-do-find-module
(get-text-property (point) 'find-args))))
(message "Compiling list...( 0%%)")
- (save-excursion
- (set-buffer (get-buffer-create "*Shadows*"))
+ (with-current-buffer (get-buffer-create "*Shadows*")
(setq buffer-read-only nil)
(erase-buffer)
(while (setq routine (pop routines))
@@ -9358,8 +9349,7 @@ This function was written since `list-abbrevs' looks terrible for IDLWAVE mode."
(princ (format fmt str rpl func)))
abbrevs)))
;; Make sure each abbreviation uses only one display line
- (save-excursion
- (set-buffer "*Help*")
+ (with-current-buffer "*Help*"
(setq truncate-lines t)))
;; Add .pro files to speedbar for support, if it's loaded
diff --git a/lisp/progmodes/octave-inf.el b/lisp/progmodes/octave-inf.el
index db1d4d4d570..2c9051df4a5 100644
--- a/lisp/progmodes/octave-inf.el
+++ b/lisp/progmodes/octave-inf.el
@@ -178,8 +178,7 @@ startup file, `~/.emacs-octave'."
(get-buffer-create buffer)
(if (comint-check-proc buffer)
()
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(comint-mode)
(inferior-octave-startup)
(inferior-octave-mode)))
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 77e10cf06e0..ce54d2a0873 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2654,8 +2654,7 @@ problem."
;; Add in number of lines for leading '##' comments:
(setq lineno
(+ lineno
- (save-excursion
- (set-buffer funcbuffer)
+ (with-current-buffer funcbuffer
(if (equal (point-min)(point-max))
0
(count-lines
@@ -2683,13 +2682,12 @@ problem."
(while (and buffers (not got))
(setq buf (car buffers)
buffers (cdr buffers))
- (if (and (save-excursion (set-buffer buf)
- (string= major-mode "python-mode"))
+ (if (and (with-current-buffer buf
+ (string= major-mode "python-mode"))
(or (string-match funcname (buffer-name buf))
(string-match (concat "^\\s-*\\(def\\|class\\)\\s-+"
funcname "\\s-*(")
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(buffer-substring (point-min)
(point-max))))))
(setq got buf)))
@@ -2747,8 +2745,7 @@ comint believe the user typed this string so that
;; add some comment, so that we can filter it out of history
(cmd (format "execfile(r'%s') # PYTHON-MODE\n" filename)))
(unwind-protect
- (save-excursion
- (set-buffer procbuf)
+ (with-current-buffer procbuf
(goto-char (point-max))
(move-marker (process-mark proc) (point))
(funcall (process-filter proc) proc msg))
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index ef37b3bfa0d..0ab55d6a045 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -2978,8 +2978,7 @@ so that `occur-next' and `occur-prev' will work."
;;
;; (defun what-i-learned (list)
;; (let ((p list))
-;; (save-excursion
-;; (set-buffer "*scratch*")
+;; (with-current-buffer "*scratch*"
;; (goto-char (point-max))
;; (insert "(setq\n")
;; (while p
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 557d587e6f3..27f7580f523 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -7137,7 +7137,10 @@ IGNORE-NEXT is true to ignore next token, fake from inside case statement."
uses-delayed) ;; Found signal/rvalue; push if not function
(search-forward ")")
(verilog-read-always-signals-recurse nil nil nil)
- ;;(if dbg (save-excursion (set-buffer (get-buffer-create "*vl-dbg*")) (delete-region (point-min) (point-max)) (insert dbg) (setq dbg "")))
+ ;;(if dbg (with-current-buffer (get-buffer-create "*vl-dbg*")
+ ;; (delete-region (point-min) (point-max))
+ ;; (insert dbg)
+ ;; (setq dbg "")))
;; Return what was found
(list sigs-out nil sigs-in uses-delayed))))
@@ -7249,8 +7252,7 @@ list of ( (signal_name connection_name)... )."
(defun verilog-set-define (defname defvalue &optional buffer enumname)
"Set the definition DEFNAME to the DEFVALUE in the given BUFFER.
Optionally associate it with the specified enumeration ENUMNAME."
- (save-excursion
- (set-buffer (or buffer (current-buffer)))
+ (with-current-buffer (or buffer (current-buffer))
(let ((mac (intern (concat "vh-" defname))))
;;(message "Define %s=%s" defname defvalue) (sleep-for 1)
;; Need to define to a constant if no value given
@@ -7497,8 +7499,8 @@ Some macros and such are also found and included. For dinotrace.el."
(forward-line 1)
(when (string-match "//" line)
(setq line (substring line 0 (match-beginning 0))))
- (save-excursion
- (set-buffer orig-buffer) ; Variables are buffer-local, so need right context.
+ ;; Variables are buffer-local, so need right context.
+ (with-current-buffer orig-buffer
(verilog-getopt line))))))
(defun verilog-getopt-flags ()
@@ -7599,11 +7601,11 @@ Allows version control to check out the file if need be."
(and (fboundp 'vc-backend)
(vc-backend filename)))
(let (pt)
- (save-excursion
- (set-buffer (find-file-noselect filename))
+ (with-current-buffer (find-file-noselect filename)
(goto-char (point-min))
(while (and
- ;; It may be tempting to look for verilog-defun-re, don't, it slows things down a lot!
+ ;; It may be tempting to look for verilog-defun-re,
+ ;; don't, it slows things down a lot!
(verilog-re-search-forward-quick "\\<module\\>" nil t)
(verilog-re-search-forward-quick "[(;]" nil t))
(if (equal module (verilog-read-module-name))
diff --git a/lisp/progmodes/xscheme.el b/lisp/progmodes/xscheme.el
index 5cf4651ad13..2477865745d 100644
--- a/lisp/progmodes/xscheme.el
+++ b/lisp/progmodes/xscheme.el
@@ -264,8 +264,8 @@ With argument, asks for a command line."
(setq-default xscheme-buffer-name buffer-name)
(setq-default xscheme-process-name process-name)
(setq-default xscheme-runlight-string
- (save-excursion (set-buffer buffer-name)
- xscheme-runlight-string))
+ (with-current-buffer buffer-name
+ xscheme-runlight-string))
(setq-default xscheme-runlight
(if (eq (process-status process-name) 'run)
default-xscheme-runlight
@@ -283,8 +283,8 @@ With argument, asks for a command line."
(make-local-variable 'xscheme-process-name)
(setq xscheme-process-name process-name)
(make-local-variable 'xscheme-runlight)
- (setq xscheme-runlight (save-excursion (set-buffer buffer-name)
- xscheme-runlight))))
+ (setq xscheme-runlight (with-current-buffer buffer-name
+ xscheme-runlight))))
(defun local-clear-scheme-interaction-buffer ()
"Make the current buffer use the default scheme interaction buffer."
@@ -305,8 +305,7 @@ With argument, asks for a command line."
((not process)
(error "Buffer `%s' is not a scheme interaction buffer" buffer-name))
(t
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(if (not (xscheme-process-buffer-current-p))
(error "Buffer `%s' is not a scheme interaction buffer"
buffer-name)))
@@ -469,8 +468,7 @@ with no args, if that value is non-nil.
(scheme-interaction-mode-commands scheme-interaction-mode-map)))
(defun xscheme-enter-interaction-mode ()
- (save-excursion
- (set-buffer (xscheme-process-buffer))
+ (with-current-buffer (xscheme-process-buffer)
(if (not (eq major-mode 'scheme-interaction-mode))
(if (eq major-mode 'scheme-debugger-mode)
(scheme-interaction-mode-initialize)
@@ -519,8 +517,7 @@ Commands:
(xscheme-send-char last-command-event))
(defun xscheme-enter-debugger-mode (prompt-string)
- (save-excursion
- (set-buffer (xscheme-process-buffer))
+ (with-current-buffer (xscheme-process-buffer)
(if (not (eq major-mode 'scheme-debugger-mode))
(progn
(if (not (eq major-mode 'scheme-interaction-mode))
@@ -530,8 +527,7 @@ Commands:
(defun xscheme-debugger-mode-p ()
(let ((buffer (xscheme-process-buffer)))
(and buffer
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(eq major-mode 'scheme-debugger-mode)))))
;;;; Evaluation Commands
@@ -765,13 +761,11 @@ Control returns to the top level rep loop."
(let ((inhibit-quit t))
(cond ((not xscheme-control-g-synchronization-p)
(interrupt-process xscheme-process-name))
- ((save-excursion
- (set-buffer xscheme-buffer-name)
+ ((with-current-buffer xscheme-buffer-name
xscheme-control-g-disabled-p)
(message "Relax..."))
(t
- (save-excursion
- (set-buffer xscheme-buffer-name)
+ (with-current-buffer xscheme-buffer-name
(setq xscheme-control-g-disabled-p t))
(message xscheme-control-g-message-string)
(interrupt-process xscheme-process-name)
@@ -807,8 +801,7 @@ Control returns to the top level rep loop."
(defun xscheme-start-process (command-line the-process the-buffer)
(let ((buffer (get-buffer-create the-buffer)))
(let ((process (get-buffer-process buffer)))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(if (and process (memq (process-status process) '(run stop)))
(set-marker (process-mark process) (point-max))
(progn (if process (delete-process process))
@@ -944,8 +937,7 @@ the remaining input.")
(defun xscheme-process-sentinel (proc reason)
(let* ((buffer (process-buffer proc))
(name (buffer-name buffer)))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(xscheme-process-filter-initialize (eq reason 'run))
(if (not (eq reason 'run))
(progn
@@ -983,8 +975,7 @@ the remaining input.")
(call-noexcursion nil))
(while xscheme-filter-input
(setq call-noexcursion nil)
- (save-excursion
- (set-buffer (process-buffer proc))
+ (with-current-buffer (process-buffer proc)
(cond ((eq xscheme-process-filter-state 'idle)
(let ((start (string-match "\e" xscheme-filter-input)))
(if start
@@ -1193,8 +1184,7 @@ the remaining input.")
string))
(defun xscheme-cd (directory-string)
- (save-excursion
- (set-buffer (xscheme-process-buffer))
+ (with-current-buffer (xscheme-process-buffer)
(cd directory-string)))
(defun xscheme-prompt-for-confirmation (prompt-string)
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index 6920b18045c..c69e3bc37ab 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -1801,8 +1801,7 @@ info-variant-part."
(defun artist-clear-buffer (buf)
"Clear contents of buffer BUF."
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(goto-char (point-min))
(delete-char (- (point-max) (point-min)) nil)))
@@ -1848,10 +1847,8 @@ Return a list (RETURN-CODE STDOUT STDERR)."
;; the return value
(list res
- (save-excursion
- (set-buffer tmp-stdout-buffer)
- (copy-sequence (buffer-substring (point-min)
- (point-max))))
+ (with-current-buffer tmp-stdout-buffer
+ (buffer-substring (point-min) (point-max)))
(artist-file-to-string tmp-stderr-file-name)))
;; Unwind: remove temporary files and buffers
diff --git a/lisp/textmodes/bib-mode.el b/lisp/textmodes/bib-mode.el
index d6f7003867d..d4ebe5f09c9 100644
--- a/lisp/textmodes/bib-mode.el
+++ b/lisp/textmodes/bib-mode.el
@@ -228,12 +228,11 @@ named by variable `unread-bib-file'."
(defun bib-capitalize-title (s)
"Like `capitalize', but don't capitalize stop words, except the first."
- (save-excursion
- (set-buffer (get-buffer-create "$$$Scratch$$$"))
- (erase-buffer)
- (insert s)
- (bib-capitalize-title-region (point-min) (point-max))
- (buffer-string)))
+ (with-current-buffer (get-buffer-create "$$$Scratch$$$")
+ (erase-buffer)
+ (insert s)
+ (bib-capitalize-title-region (point-min) (point-max))
+ (buffer-string)))
(provide 'bib-mode)
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 99995aed2ea..bede8184e88 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -3863,8 +3863,7 @@ Return t if test was successful, nil otherwise."
buffer-key-list current-buf current-keys error-list)
;; Check for duplicate keys within BibTeX buffer
(dolist (buffer buffer-list)
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(let (entry-type key key-list)
(goto-char (point-min))
(while (re-search-forward bibtex-entry-head nil t)
diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el
index 67a39d5cf51..3176ae28c4c 100644
--- a/lisp/textmodes/page-ext.el
+++ b/lisp/textmodes/page-ext.el
@@ -580,8 +580,7 @@ directory for only the accessible portion of the buffer."
;; `standard-output' to the buffer named as its first argument,
;; but does not switch to that buffer.
(with-output-to-temp-buffer pages-directory-buffer
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(pages-directory-mode)
(insert
"==== Pages Directory: use `C-c C-c' to go to page under cursor. ====" ?\n)
@@ -736,8 +735,7 @@ to the same line in the pages buffer."
(defun pages-directory-goto-with-mouse (event)
"Go to the corresponding line under the mouse pointer in the pages buffer."
(interactive "e")
- (save-excursion
- (set-buffer (window-buffer (posn-window (event-end event))))
+ (with-current-buffer (window-buffer (posn-window (event-end event)))
(save-excursion
(goto-char (posn-point (event-end event)))
(pages-directory-goto))))
diff --git a/lisp/textmodes/refbib.el b/lisp/textmodes/refbib.el
index b0600dbaafa..fc017eb4ca2 100644
--- a/lisp/textmodes/refbib.el
+++ b/lisp/textmodes/refbib.el
@@ -170,12 +170,11 @@ This is in addition to the `r2b-capitalize-title-stop-words'.")
(defun r2b-capitalize-title (s)
"Like `capitalize', but don't capitalize stop words, except the first."
- (save-excursion
- (set-buffer (get-buffer-create "$$$Scratch$$$"))
- (erase-buffer)
- (insert s)
- (r2b-capitalize-title-region (point-min) (point-max))
- (buffer-string)))
+ (with-current-buffer (get-buffer-create "$$$Scratch$$$")
+ (erase-buffer)
+ (insert s)
+ (r2b-capitalize-title-region (point-min) (point-max))
+ (buffer-string)))
;*********************************************************
(defun r2b-reset ()
@@ -681,22 +680,19 @@ Do `\\[r2b-help]' for more info."
(defun r2b-convert-buffer (output)
- "Transform current buffer and append to buffer OUTPUT.
+ "Transform current buffer and append to buffer OUTPUT.
Do `\\[r2b-help]' for more info."
- (interactive
- (list (read-string "Output to buffer: " r2b-out-buf-name)))
- (save-excursion
- (setq r2b-log (get-buffer-create r2b-log-name))
- (set-buffer r2b-log)
- (erase-buffer))
- (widen)
- (goto-char (point-min))
- (message "Working, please be patient...")
- (sit-for 0)
- (while (r2b-convert-record output) t)
- (message "Done, results in %s, errors in %s"
- r2b-out-buf-name r2b-log-name)
- )
+ (interactive
+ (list (read-string "Output to buffer: " r2b-out-buf-name)))
+ (with-current-buffer (setq r2b-log (get-buffer-create r2b-log-name))
+ (erase-buffer))
+ (widen)
+ (goto-char (point-min))
+ (message "Working, please be patient...")
+ (sit-for 0)
+ (while (r2b-convert-record output) t)
+ (message "Done, results in %s, errors in %s"
+ r2b-out-buf-name r2b-log-name))
(defvar r2b-help-message
" Refer to Bibtex Bibliography Conversion
@@ -740,13 +736,12 @@ Please send bug reports and suggestions to
(defun r2b-help ()
- "Print help describing the `refbib' package."
- (interactive)
- (with-output-to-temp-buffer "*Help*"
- (princ r2b-help-message)
- (save-excursion
- (set-buffer standard-output)
- (help-mode))))
+ "Print help describing the `refbib' package."
+ (interactive)
+ (with-output-to-temp-buffer "*Help*"
+ (princ r2b-help-message)
+ (with-current-buffer standard-output
+ (help-mode))))
(provide 'refbib)
(provide 'refer-to-bibtex)
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index c81d20fb4e1..ed055bb2b78 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -356,8 +356,7 @@
(error "No such file %s" file))
(message "Scanning thebibliography environment in %s" file)
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(save-restriction
(widen)
(goto-char (point-min))
@@ -1076,8 +1075,7 @@ While entering the regexp, completion on knows citation keys is possible.
bibfile-list item bibtype)
(catch 'exit
- (save-excursion
- (set-buffer reftex-call-back-to-this-buffer)
+ (with-current-buffer reftex-call-back-to-this-buffer
(setq bibtype (reftex-bib-or-thebib))
(cond
((eq bibtype 'bib)
@@ -1109,7 +1107,7 @@ While entering the regexp, completion on knows citation keys is possible.
(defun reftex-all-used-citation-keys ()
(reftex-access-scan-info)
(let ((files (reftex-all-document-files)) file keys kk k)
- (save-excursion
+ (save-current-buffer
(while (setq file (pop files))
(set-buffer (reftex-get-file-buffer-force file 'mark))
(save-excursion
@@ -1137,7 +1135,7 @@ The sequence in the new file is the same as it was in the old database."
(let ((keys (reftex-all-used-citation-keys))
(files (reftex-get-bibfile-list))
file key entries beg end entry)
- (save-excursion
+ (save-current-buffer
(while (setq file (pop files))
(set-buffer (reftex-get-file-buffer-force file 'mark))
(reftex-with-special-syntax-for-bib
diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el
index 8626b25721f..0b76c723798 100644
--- a/lisp/textmodes/reftex-dcr.el
+++ b/lisp/textmodes/reftex-dcr.el
@@ -276,8 +276,7 @@ With argument, actually select the window showing the cross reference."
(message "ref(%s): %s" (nth 1 entry) (nth 2 entry)))
(let ((buf (get-buffer " *Echo Area*")))
(when buf
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(run-hooks 'reftex-display-copied-context-hook)))))))
(defun reftex-echo-cite (key files item)
@@ -313,8 +312,7 @@ With argument, actually select the window showing the cross reference."
(unless (or (null string) (equal string ""))
(message "cite: %s" string))
(when (setq buf (get-buffer " *Echo Area*"))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(run-hooks 'reftex-display-copied-context-hook)))))
(defvar reftex-use-itimer-in-xemacs nil
@@ -373,7 +371,7 @@ Calling this function several times find successive citation locations."
;; Establish connection to reference buffer
(unless ref-buffer
(setq ref-buffer
- (save-excursion
+ (save-current-buffer
(completing-read
"Reference buffer: "
(delq nil
diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el
index b0c4b34584c..85ee4626d16 100644
--- a/lisp/textmodes/reftex-global.el
+++ b/lisp/textmodes/reftex-global.el
@@ -40,8 +40,7 @@ The TAGS file is also immediately visited with `visit-tags-table'."
(files (reftex-all-document-files))
(cmd (format "etags %s" (mapconcat 'shell-quote-argument
files " "))))
- (save-excursion
- (set-buffer (reftex-get-file-buffer-force master))
+ (with-current-buffer (reftex-get-file-buffer-force master)
(message "Running etags to create TAGS file...")
(shell-command cmd)
(visit-tags-table "TAGS"))))
@@ -314,7 +313,7 @@ labels."
(interactive)
(let ((files (reftex-all-document-files))
file buffer)
- (save-excursion
+ (save-current-buffer
(while (setq file (pop files))
(setq buffer (reftex-get-buffer-visiting file))
(when buffer
@@ -335,8 +334,7 @@ Also checks if buffers visiting the files are in read-only mode."
(or (y-or-n-p (format "No write access to %s. Continue? " file))
(error "Abort")))
(when (and (setq buf (reftex-get-buffer-visiting file))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
buffer-read-only))
(ding)
(or (y-or-n-p (format "Buffer %s is read-only. Continue? "
@@ -345,11 +343,11 @@ Also checks if buffers visiting the files are in read-only mode."
;;; Multi-file RefTeX Isearch
-;;; `reftex-isearch-wrap-function', `reftex-isearch-push-state-function',
-;;; `reftex-isearch-pop-state-function', `reftex-isearch-isearch-search'
-;;; functions remain here only for backward-compatibility with Emacs 22
-;;; and are obsolete since Emacs 23 that supports a single function
-;;; variable `multi-isearch-next-buffer-function'.
+;; `reftex-isearch-wrap-function', `reftex-isearch-push-state-function',
+;; `reftex-isearch-pop-state-function', `reftex-isearch-isearch-search'
+;; functions remain here only for backward-compatibility with Emacs 22
+;; and are obsolete since Emacs 23 that supports a single function
+;; variable `multi-isearch-next-buffer-function'.
(defun reftex-isearch-wrap-function ()
(if (not isearch-word)
@@ -402,14 +400,14 @@ Also checks if buffers visiting the files are in read-only mode."
(point))
(error nil))))))
-;;; This function is called when isearch reaches the end of a
-;;; buffer. For reftex what we want to do is not wrap to the
-;;; beginning, but switch to the next buffer in the logical order of
-;;; the document. This function looks through list of files in the
-;;; document (reftex-all-document-files), searches for the current
-;;; buffer and switches to the next/previous one in the logical order
-;;; of the document. If WRAPP is true then wrap the search to the
-;;; beginning/end of the file list, depending of the search direction.
+;; This function is called when isearch reaches the end of a
+;; buffer. For reftex what we want to do is not wrap to the
+;; beginning, but switch to the next buffer in the logical order of
+;; the document. This function looks through list of files in the
+;; document (reftex-all-document-files), searches for the current
+;; buffer and switches to the next/previous one in the logical order
+;; of the document. If WRAPP is true then wrap the search to the
+;; beginning/end of the file list, depending of the search direction.
(defun reftex-isearch-switch-to-next-file (crt-buf &optional wrapp)
(reftex-access-scan-info)
(let ((cb (buffer-file-name crt-buf))
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index d26365b6d70..f640710c01e 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -1012,8 +1012,7 @@ When index is restricted, select the previous section as restriction criterion."
(setq beg (match-beginning 0) end (match-end 0))
(setq old (nth 2 data))
(and (equal old new) (error "Entry unchanged"))
- (save-excursion
- (set-buffer (get-file-buffer (nth 3 data)))
+ (with-current-buffer (get-file-buffer (nth 3 data))
(goto-char beg)
(unless (looking-at (regexp-quote old))
(error "This should not happen (reftex-index-change-entry)"))
@@ -1594,7 +1593,7 @@ this function repeatedly."
(while (re-search-forward re2 nil t)
(push (cons (count-lines 1 (point)) (match-string 1)) superphrases)
(incf ntimes2))))
- (save-excursion
+ (save-current-buffer
(while (setq file (pop files))
(setq buf (reftex-get-file-buffer-force file))
(when buf
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index 3ec284eacac..0a62027acbd 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -78,8 +78,7 @@ If optional BOUND is an integer, limit backward searches to that point."
file (not (eq t reftex-keep-temporary-buffers)))))
(if (not buf)
(list label typekey "" file comment "LOST LABEL. RESCAN TO FIX.")
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(save-restriction
(widen)
(goto-char 1)
@@ -538,8 +537,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
reftex-latex-syntax-table (syntax-table))
(if reftex-use-multiple-selection-buffers
(switch-to-buffer-other-window
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(reftex-make-selection-buffer-name typekey)))
(switch-to-buffer-other-window "*RefTeX Select*")
(reftex-erase-buffer))
diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el
index f6f384fcb7d..98ce7bc92ad 100644
--- a/lisp/textmodes/reftex-sel.el
+++ b/lisp/textmodes/reftex-sel.el
@@ -90,28 +90,27 @@ During a selection process, these are the local bindings.
;; We do not set a local map - reftex-select-item does this.
(run-hooks 'reftex-select-bib-mode-hook))
-;;; (defun reftex-get-offset (buf here-am-I &optional typekey toc index file)
-;;; ;; Find the correct offset data, like insert-docstruct would, but faster.
-;;; ;; Buffer BUF knows the correct docstruct to use.
-;;; ;; Basically this finds the first docstruct entry after HERE-I-AM which
-;;; ;; is of allowed type. The optional arguments specify what is allowed.
-;;; (catch 'exit
-;;; (save-excursion
-;;; (set-buffer buf)
-;;; (reftex-access-scan-info)
-;;; (let* ((rest (memq here-am-I (symbol-value reftex-docstruct-symbol)))
-;;; entry)
-;;; (while (setq entry (pop rest))
-;;; (if (or (and typekey
-;;; (stringp (car entry))
-;;; (or (equal typekey " ")
-;;; (equal typekey (nth 1 entry))))
-;;; (and toc (eq (car entry) 'toc))
-;;; (and index (eq (car entry) 'index))
-;;; (and file
-;;; (memq (car entry) '(bof eof file-error))))
-;;; (throw 'exit entry)))
-;;; nil))))
+;; (defun reftex-get-offset (buf here-am-I &optional typekey toc index file)
+;; ;; Find the correct offset data, like insert-docstruct would, but faster.
+;; ;; Buffer BUF knows the correct docstruct to use.
+;; ;; Basically this finds the first docstruct entry after HERE-I-AM which
+;; ;; is of allowed type. The optional arguments specify what is allowed.
+;; (catch 'exit
+;; (with-current-buffer buf
+;; (reftex-access-scan-info)
+;; (let* ((rest (memq here-am-I (symbol-value reftex-docstruct-symbol)))
+;; entry)
+;; (while (setq entry (pop rest))
+;; (if (or (and typekey
+;; (stringp (car entry))
+;; (or (equal typekey " ")
+;; (equal typekey (nth 1 entry))))
+;; (and toc (eq (car entry) 'toc))
+;; (and index (eq (car entry) 'index))
+;; (and file
+;; (memq (car entry) '(bof eof file-error))))
+;; (throw 'exit entry)))
+;; nil))))
(defun reftex-get-offset (buf here-am-I &optional typekey toc index file)
;; Find the correct offset data, like insert-docstruct would, but faster.
@@ -119,8 +118,7 @@ During a selection process, these are the local bindings.
;; Basically this finds the first docstruct entry before HERE-I-AM which
;; is of allowed type. The optional arguments specify what is allowed.
(catch 'exit
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(reftex-access-scan-info)
(let* ((rest (symbol-value reftex-docstruct-symbol))
lastentry entry)
@@ -178,8 +176,7 @@ During a selection process, these are the local bindings.
prev-inserted offset from to index-tag docstruct-symbol)
;; Pop to buffer buf to get the correct buffer-local variables
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
;; Ensure access to scanning info
(reftex-access-scan-info)
@@ -413,8 +410,7 @@ During a selection process, these are the local bindings.
(recursive-edit))
(set-marker reftex-recursive-edit-marker nil)
- (save-excursion
- (set-buffer selection-buffer)
+ (with-current-buffer selection-buffer
(use-local-map nil)
(remove-hook 'pre-command-hook 'reftex-select-pre-command-hook t)
(remove-hook 'post-command-hook
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index 6f7d536d6c6..0a50555d37d 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -708,8 +708,7 @@ DELTA and PRO-OR-DE are assumed to be dynamically scoped into this function."
(name (nth 1 x))
(newname (nth 2 x))
(marker (nth 4 data)))
- (save-excursion
- (set-buffer (marker-buffer marker))
+ (with-current-buffer (marker-buffer marker)
(goto-char (marker-position marker))
(if (looking-at (concat "\\([ \t]*\\\\\\)" (regexp-quote name)))
(replace-match (concat "\\1" newname))
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index d905ce66905..6bc5c0c69c0 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -1822,9 +1822,8 @@ When DIE is non-nil, throw an error if file not found."
(let ((buffer-read-only nil)) (erase-buffer)))
((setq buffer (get-buffer buffer))
;; buffer exists
- (save-excursion
- (set-buffer buffer)
- (let ((buffer-read-only nil)) (erase-buffer))))))
+ (with-current-buffer buffer
+ (let ((inhibit-read-only t)) (erase-buffer))))))
(defun reftex-this-word (&optional class)
;; Grab the word around point.
@@ -2072,8 +2071,7 @@ When DIE is non-nil, throw an error if file not found."
;; Is there a hook to run?
(when (listp reftex-initialize-temporary-buffers)
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(run-hooks 'reftex-initialize-temporary-buffers))))
;; Lets see if we got a license to kill :-|
@@ -2100,8 +2098,7 @@ When DIE is non-nil, throw an error if file not found."
(and (buffer-modified-p buffer)
(y-or-n-p (format "Save file %s? "
(buffer-file-name buffer)))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(save-buffer)))
(kill-buffer buffer))
(pop reftex-buffers-to-kill)))))
diff --git a/lisp/textmodes/spell.el b/lisp/textmodes/spell.el
index aa062edffc4..2cda1a17612 100644
--- a/lisp/textmodes/spell.el
+++ b/lisp/textmodes/spell.el
@@ -93,8 +93,7 @@ for example, \"word\"."
(interactive "r")
(let ((filter spell-filter)
(buf (get-buffer-create " *temp*")))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(widen)
(erase-buffer))
(message "Checking spelling of %s..." (or description "region"))
@@ -104,41 +103,37 @@ for example, \"word\"."
(call-process-region start end shell-file-name
nil buf nil "-c" spell-command))
(let ((oldbuf (current-buffer)))
- (save-excursion
- (set-buffer buf)
- (insert-buffer-substring oldbuf start end)
- (or (bolp) (insert ?\n))
- (if filter (funcall filter))
- (if (string= "spell" spell-command)
- (call-process-region (point-min) (point-max) "spell" t buf)
- (call-process-region (point-min) (point-max) shell-file-name
- t buf nil "-c" spell-command)))))
+ (with-current-buffer buf
+ (insert-buffer-substring oldbuf start end)
+ (or (bolp) (insert ?\n))
+ (if filter (funcall filter))
+ (if (string= "spell" spell-command)
+ (call-process-region (point-min) (point-max) "spell" t buf)
+ (call-process-region (point-min) (point-max) shell-file-name
+ t buf nil "-c" spell-command)))))
(message "Checking spelling of %s...%s"
(or description "region")
- (if (save-excursion
- (set-buffer buf)
- (> (buffer-size) 0))
+ (if (with-current-buffer buf
+ (> (buffer-size) 0))
"not correct"
"correct"))
(let (word newword
(case-fold-search t)
(case-replace t))
- (while (save-excursion
- (set-buffer buf)
- (> (buffer-size) 0))
- (save-excursion
- (set-buffer buf)
- (goto-char (point-min))
- (setq word (downcase
- (buffer-substring (point)
- (progn (end-of-line) (point)))))
- (forward-char 1)
- (delete-region (point-min) (point))
- (setq newword
- (read-string (concat "`" word
- "' not recognized; edit a replacement: ")
- word))
- (flush-lines (concat "^" (regexp-quote word) "$")))
+ (while (with-current-buffer buf
+ (> (buffer-size) 0))
+ (with-current-buffer buf
+ (goto-char (point-min))
+ (setq word (downcase
+ (buffer-substring (point)
+ (progn (end-of-line) (point)))))
+ (forward-char 1)
+ (delete-region (point-min) (point))
+ (setq newword
+ (read-string (concat "`" word
+ "' not recognized; edit a replacement: ")
+ word))
+ (flush-lines (concat "^" (regexp-quote word) "$")))
(if (not (equal word newword))
(progn
(goto-char (point-min))
@@ -152,22 +147,21 @@ for example, \"word\"."
"Check spelling of string supplied as argument."
(interactive "sSpell string: ")
(let ((buf (get-buffer-create " *temp*")))
- (save-excursion
- (set-buffer buf)
- (widen)
- (erase-buffer)
- (insert string "\n")
- (if (string= "spell" spell-command)
- (call-process-region (point-min) (point-max) "spell"
- t t)
- (call-process-region (point-min) (point-max) shell-file-name
- t t nil "-c" spell-command))
- (if (= 0 (buffer-size))
- (message "%s is correct" string)
- (goto-char (point-min))
- (while (search-forward "\n" nil t)
- (replace-match " "))
- (message "%sincorrect" (buffer-substring 1 (point-max)))))))
+ (with-current-buffer buf
+ (widen)
+ (erase-buffer)
+ (insert string "\n")
+ (if (string= "spell" spell-command)
+ (call-process-region (point-min) (point-max) "spell"
+ t t)
+ (call-process-region (point-min) (point-max) shell-file-name
+ t t nil "-c" spell-command))
+ (if (= 0 (buffer-size))
+ (message "%s is correct" string)
+ (goto-char (point-min))
+ (while (search-forward "\n" nil t)
+ (replace-match " "))
+ (message "%sincorrect" (buffer-substring 1 (point-max)))))))
;;;###autoload
(make-obsolete 'spell-string "The `spell' package is obsolete - use `ispell'."
"23.1")
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index f4aca3198ab..db873483579 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1700,8 +1700,7 @@ In the tex shell buffer this command behaves like `comint-send-input'."
(setq directory (file-name-as-directory (expand-file-name directory)))
(if (not (file-directory-p directory))
(error "%s is not a directory" directory)
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(setq default-directory directory))))
(defvar tex-send-command-modified-tick 0)
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el
index 2550e129b19..e6f48a33801 100644
--- a/lisp/textmodes/texnfo-upd.el
+++ b/lisp/textmodes/texnfo-upd.el
@@ -1723,8 +1723,7 @@ node names in pre-existing `@node' lines that lack names."
"Return a list of the included files in OUTER-FILE."
(let ((included-file-list (list outer-file))
start)
- (save-excursion
- (set-buffer (find-file-noselect outer-file))
+ (with-current-buffer (find-file-noselect outer-file)
(widen)
(goto-char (point-min))
(while (re-search-forward "^@include" nil t)
diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el
index c393e1d9bcd..ed51434fe85 100644
--- a/lisp/textmodes/two-column.el
+++ b/lisp/textmodes/two-column.el
@@ -407,8 +407,7 @@ First column's text sSs Second column's text
(if (y-or-n-p (concat "Overwrite associated buffer `"
(buffer-name (2C-other))
"'? "))
- (save-excursion
- (set-buffer (2C-other))
+ (with-current-buffer (2C-other)
(erase-buffer))
(signal 'quit nil)))
(let ((point (point))