aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 @@
12009-10-31 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * textmodes/two-column.el (2C-split):
4 * textmodes/texnfo-upd.el (texinfo-multi-file-included-list):
5 * textmodes/tex-mode.el (tex-set-buffer-directory):
6 * textmodes/spell.el (spell-region, spell-string):
7 * textmodes/reftex.el (reftex-erase-buffer):
8 (reftex-get-file-buffer-force, reftex-kill-temporary-buffers):
9 * textmodes/reftex-toc.el (reftex-toc-promote-action):
10 * textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct)
11 (reftex-select-item):
12 * textmodes/reftex-ref.el (reftex-label-info-update)
13 (reftex-offer-label-menu):
14 * textmodes/reftex-index.el (reftex-index-change-entry)
15 (reftex-index-phrases-info):
16 * textmodes/reftex-global.el (reftex-create-tags-file)
17 (reftex-save-all-document-buffers, reftex-ensure-write-access):
18 * textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite)
19 (reftex-view-crossref-from-bibtex):
20 * textmodes/reftex-cite.el (reftex-bibtex-selection-callback)
21 (reftex-extract-bib-entries-from-thebibliography)
22 (reftex-all-used-citation-keys, reftex-create-bibtex-file):
23 * textmodes/refbib.el (r2b-capitalize-title):
24 (r2b-convert-buffer, r2b-help):
25 * textmodes/page-ext.el (pages-directory)
26 (pages-directory-goto-with-mouse):
27 * textmodes/bibtex.el (bibtex-validate-globally):
28 * textmodes/bib-mode.el (bib-capitalize-title):
29 * textmodes/artist.el (artist-clear-buffer, artist-system):
30 * progmodes/xscheme.el (global-set-scheme-interaction-buffer):
31 (local-set-scheme-interaction-buffer, xscheme-process-filter)
32 (verify-xscheme-buffer, xscheme-enter-interaction-mode)
33 (xscheme-enter-debugger-mode, xscheme-debugger-mode-p)
34 (xscheme-send-control-g-interrupt, xscheme-start-process)
35 (xscheme-process-sentinel, xscheme-cd):
36 * progmodes/verilog-mode.el (verilog-read-always-signals)
37 (verilog-set-define, verilog-getopt-file)
38 (verilog-module-inside-filename-p):
39 * progmodes/sh-script.el:
40 * progmodes/python.el (python-pdbtrack-get-source-buffer)
41 (python-pdbtrack-grub-for-buffer, python-execute-file):
42 * progmodes/octave-inf.el (inferior-octave):
43 * progmodes/idlwave.el (idlwave-scan-user-lib-files)
44 (idlwave-shell-compile-helper-routines, idlwave-set-local)
45 (idlwave-display-completion-list-xemacs, idlwave-list-abbrevs)
46 (idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows)
47 (idlwave-completion-fontify-classes, idlwave-display-calling-sequence):
48 * progmodes/idlw-shell.el (idlwave-shell-examine-display-clear)
49 (idlwave-shell-filter, idlwave-shell-examine-highlight)
50 (idlwave-shell-sentinel, idlwave-shell-filter-directory)
51 (idlwave-shell-display-line, idlwave-shell-set-bp-in-module)
52 (idlwave-shell-examine-display, idlwave-shell-run-region)
53 (idlwave-shell-filter-bp, idlwave-shell-save-and-action)
54 (idlwave-shell-sources-filter, idlwave-shell-goto-next-error):
55 * progmodes/idlw-help.el (idlwave-help-get-special-help)
56 (idlwave-help-get-help-buffer):
57 * progmodes/gud.el (gud-basic-call, gud-find-class)
58 (gud-tooltip-activate-mouse-motions-if-enabled):
59 * progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
60 * progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as)
61 (ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file)
62 (ebrowse-tags-next-file):
63 * progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps)
64 (ebnf-eps-production-list, ebnf-begin-file, ebnf-log)
65 (ebnf-eps-finish-and-write):
66 * progmodes/cpp.el (cpp-edit-save):
67 * progmodes/cperl-mode.el (cperl-pod-to-manpage):
68 * progmodes/cc-defs.el (c-emacs-features):
69 * progmodes/antlr-mode.el (antlr-invalidate-context-cache)
70 (antlr-directory-dependencies):
71 * progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name)
72 (ada-run-application, ada-find-in-src-path, ada-goto-parent)
73 (ada-find-any-references, ada-make-filename-from-adaname)
74 (ada-make-body-gnatstub):
75 * obsolete/rnews.el (news-list-news-groups):
76 * obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file):
77 * obsolete/iso-acc.el (iso-acc-minibuf-setup):
78 * net/rcirc.el (rcirc-debug):
79 * net/newst-treeview.el (newsticker--treeview-list-add-item)
80 (newsticker--treeview-list-clear, newsticker-treeview-browse-url)
81 (newsticker--treeview-list-update-faces, newsticker-treeview-save)
82 (newsticker--treeview-item-show-text, newsticker--treeview-item-show)
83 (newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init)
84 (newsticker-treeview-show-item, newsticker--treeview-unfold-node)
85 (newsticker--treeview-list-clear-highlight)
86 (newsticker--treeview-list-update-highlight)
87 (newsticker--treeview-list-highlight-start)
88 (newsticker--treeview-tree-update-highlight)
89 (newsticker--treeview-get-selected-item)
90 (newsticker-treeview-mark-list-items-old)
91 (newsticker--treeview-set-current-node):
92 * net/newst-plainview.el (newsticker--buffer-set-uptodate):
93 * net/newst-backend.el (newsticker--get-news-by-funcall)
94 (newsticker--get-news-by-wget, newsticker--image-get)
95 (newsticker--image-sentinel):
96 * net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field):
97 * net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session):
98 (eudc-ph-close-session):
99 * net/eudc.el (eudc-save-options):
100 * language/thai-word.el (thai-update-word-table):
101 * language/japan-util.el (japanese-string-conversion):
102 * international/titdic-cnv.el (tsang-quick-converter)
103 (ziranma-converter, ctlau-converter):
104 * international/mule-cmds.el (describe-language-environment):
105 * international/ja-dic-cnv.el (skkdic-convert-okuri-ari)
106 (skkdic-convert-postfix, skkdic-convert-prefix):
107 (skkdic-convert-okuri-nasi, skkdic-convert):
108 * emacs-lisp/re-builder.el (reb-update-overlays):
109 * emacs-lisp/pp.el (pp-to-string, pp-display-expression):
110 * emacs-lisp/gulp.el (gulp-send-requests):
111 * emacs-lisp/find-gc.el (trace-call-tree):
112 * emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class)
113 (eieio-describe-generic):
114 * emacs-lisp/eieio-base.el (eieio-persistent-read):
115 * emacs-lisp/edebug.el (edebug-outside-excursion):
116 * emacs-lisp/debug.el (debugger-make-xrefs):
117 * emacs-lisp/cust-print.el (custom-prin1-to-string):
118 * emacs-lisp/chart.el (chart-new-buffer):
119 * emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log):
120 Use with-current-buffer.
121 * textmodes/artist.el (artist-system): Don't call
122 copy-sequence on a fresh string.
123 * progmodes/idlw-shell.el (easymenu setup): Use dolist.
124
12009-10-31 Stephen Berman <stephen.berman@gmx.net> 1252009-10-31 Stephen Berman <stephen.berman@gmx.net>
2 126
3 * calendar/todo-mode.el (todo-edit-item): Signal an error if there 127 * 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:
706 (existing-buffer (get-file-buffer log-file)) 706 (existing-buffer (get-file-buffer log-file))
707 (buffer (find-file-noselect log-file)) 707 (buffer (find-file-noselect log-file))
708 authors file pos) 708 authors file pos)
709 (save-excursion 709 (with-current-buffer buffer
710 (set-buffer buffer)
711 (save-restriction 710 (save-restriction
712 (widen) 711 (widen)
713 (goto-char (point-min)) 712 (goto-char (point-min))
@@ -758,8 +757,7 @@ TABLE is a hash table to add author information to."
758 (enable-local-eval nil) 757 (enable-local-eval nil)
759 (buffer (find-file-noselect file))) 758 (buffer (find-file-noselect file)))
760 (setq file (file-name-nondirectory file)) 759 (setq file (file-name-nondirectory file))
761 (save-excursion 760 (with-current-buffer buffer
762 (set-buffer buffer)
763 (save-restriction 761 (save-restriction
764 (widen) 762 (widen)
765 (goto-char (point-min)) 763 (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.")
134(defun chart-new-buffer (obj) 134(defun chart-new-buffer (obj)
135 "Create a new buffer NAME in which the chart OBJ is displayed. 135 "Create a new buffer NAME in which the chart OBJ is displayed.
136Returns the newly created buffer." 136Returns the newly created buffer."
137 (save-excursion 137 (with-current-buffer (get-buffer-create (format "*%s*" (oref obj title)))
138 (set-buffer (get-buffer-create (format "*%s*" (oref obj title))))
139 (chart-mode) 138 (chart-mode)
140 (setq chart-local-object obj) 139 (setq chart-local-object obj)
141 (current-buffer))) 140 (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'."
332 (let ((buf (get-buffer-create " *custom-print-temp*"))) 332 (let ((buf (get-buffer-create " *custom-print-temp*")))
333 ;; We must erase the buffer before printing in case an error 333 ;; We must erase the buffer before printing in case an error
334 ;; occurred during the last prin1-to-string and we are in debugger. 334 ;; occurred during the last prin1-to-string and we are in debugger.
335 (save-excursion 335 (with-current-buffer buf
336 (set-buffer buf)
337 (erase-buffer)) 336 (erase-buffer))
338 ;; We must be in the current-buffer when the print occurs. 337 ;; We must be in the current-buffer when the print occurs.
339 (if noescape 338 (if noescape
340 (custom-princ object buf) 339 (custom-princ object buf)
341 (custom-prin1 object buf)) 340 (custom-prin1 object buf))
342 (save-excursion 341 (with-current-buffer buf
343 (set-buffer buf)
344 (buffer-string) 342 (buffer-string)
345 ;; We could erase the buffer again, but why bother? 343 ;; We could erase the buffer again, but why bother?
346 ))) 344 )))
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."
329(defun debugger-make-xrefs (&optional buffer) 329(defun debugger-make-xrefs (&optional buffer)
330 "Attach cross-references to function names in the `*Backtrace*' buffer." 330 "Attach cross-references to function names in the `*Backtrace*' buffer."
331 (interactive "b") 331 (interactive "b")
332 (save-excursion 332 (with-current-buffer (or buffer (current-buffer))
333 (set-buffer (or buffer (current-buffer)))
334 (setq buffer (current-buffer)) 333 (setq buffer (current-buffer))
335 (let ((inhibit-read-only t) 334 (let ((inhibit-read-only t)
336 (old-end (point-min)) (new-end (point-min))) 335 (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."
3605 ) 3605 )
3606 (setq-default cursor-in-non-selected-windows edebug-outside-d-c-i-n-s-w) 3606 (setq-default cursor-in-non-selected-windows edebug-outside-d-c-i-n-s-w)
3607 (unwind-protect 3607 (unwind-protect
3608 (save-excursion ; of edebug-buffer 3608 (with-current-buffer edebug-outside-buffer ; of edebug-buffer
3609 (set-buffer edebug-outside-buffer)
3610 (goto-char edebug-outside-point) 3609 (goto-char edebug-outside-point)
3611 (if (marker-buffer (edebug-mark-marker)) 3610 (if (marker-buffer (edebug-mark-marker))
3612 (set-marker (edebug-mark-marker) edebug-outside-mark)) 3611 (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."
230 (buffstr nil)) 230 (buffstr nil))
231 (unwind-protect 231 (unwind-protect
232 (progn 232 (progn
233 (save-excursion 233 (with-current-buffer (get-buffer-create " *tmp eieio read*")
234 (set-buffer (get-buffer-create " *tmp eieio read*"))
235 (insert-file-contents filename nil nil nil t) 234 (insert-file-contents filename nil nil nil t)
236 (goto-char (point-min)) 235 (goto-char (point-min))
237 (setq buffstr (buffer-string))) 236 (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'."
43 (if (not root-class) (setq root-class 'eieio-default-superclass)) 43 (if (not root-class) (setq root-class 'eieio-default-superclass))
44 (if (not (class-p root-class)) (signal 'wrong-type-argument (list 'class-p root-class))) 44 (if (not (class-p root-class)) (signal 'wrong-type-argument (list 'class-p root-class)))
45 (display-buffer (get-buffer-create "*EIEIO OBJECT BROWSE*") t) 45 (display-buffer (get-buffer-create "*EIEIO OBJECT BROWSE*") t)
46 (save-excursion 46 (with-current-buffer (get-buffer "*EIEIO OBJECT BROWSE*")
47 (set-buffer (get-buffer "*EIEIO OBJECT BROWSE*"))
48 (erase-buffer) 47 (erase-buffer)
49 (goto-char 0) 48 (goto-char 0)
50 (eieio-browse-tree root-class "" "") 49 (eieio-browse-tree root-class "" "")
@@ -161,8 +160,7 @@ Optional HEADERFCN should be called to insert a few bits of info first."
161 (terpri) 160 (terpri)
162 (terpri)) 161 (terpri))
163 (setq methods (cdr methods)))))) 162 (setq methods (cdr methods))))))
164 (save-excursion 163 (with-current-buffer (help-buffer)
165 (set-buffer (help-buffer))
166 (buffer-string))) 164 (buffer-string)))
167 165
168(defun eieio-describe-class-slots (class) 166(defun eieio-describe-class-slots (class)
@@ -376,8 +374,7 @@ Also extracts information about all methods specific to this generic."
376 (terpri) 374 (terpri)
377 (terpri))) 375 (terpri)))
378 (setq i (1+ i))))) 376 (setq i (1+ i)))))
379 (save-excursion 377 (with-current-buffer (help-buffer)
380 (set-buffer (help-buffer))
381 (buffer-string))) 378 (buffer-string)))
382 379
383(defun eieio-lambda-arglist (func) 380(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'."
113 (call-process "csh" nil nil nil "-c" 113 (call-process "csh" nil nil nil "-c"
114 (format "ln -s %s/*.[ch] /tmp/esrc" 114 (format "ln -s %s/*.[ch] /tmp/esrc"
115 find-gc-source-directory)))) 115 find-gc-source-directory))))
116 (save-excursion 116 (with-current-buffer (get-buffer-create "*Trace Call Tree*")
117 (set-buffer (get-buffer-create "*Trace Call Tree*"))
118 (setq find-gc-subrs-called nil) 117 (setq find-gc-subrs-called nil)
119 (let ((case-fold-search nil) 118 (let ((case-fold-search nil)
120 (files find-gc-source-files) 119 (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.
91The list of addresses for which you decided not to send mail 91The list of addresses for which you decided not to send mail
92is left in the `*gulp*' buffer at the end." 92is left in the `*gulp*' buffer at the end."
93 (interactive "DRequest updates for Lisp directory: \nP") 93 (interactive "DRequest updates for Lisp directory: \nP")
94 (save-excursion 94 (with-current-buffer (get-buffer-create gulp-tmp-buffer)
95 (set-buffer (get-buffer-create gulp-tmp-buffer))
96 (let ((m-p-alist (gulp-create-m-p-alist 95 (let ((m-p-alist (gulp-create-m-p-alist
97 (directory-files dir nil "^[^=].*\\.el$" t) 96 (directory-files dir nil "^[^=].*\\.el$" t)
98 dir)) 97 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 @@
42 "Return a string containing the pretty-printed representation of OBJECT. 42 "Return a string containing the pretty-printed representation of OBJECT.
43OBJECT can be any Lisp object. Quoting characters are used as needed 43OBJECT can be any Lisp object. Quoting characters are used as needed
44to make output that `read' can handle, whenever this is possible." 44to make output that `read' can handle, whenever this is possible."
45 (save-excursion 45 (with-current-buffer (generate-new-buffer " pp-to-string")
46 (set-buffer (generate-new-buffer " pp-to-string"))
47 (unwind-protect 46 (unwind-protect
48 (progn 47 (progn
49 (lisp-mode-variables nil) 48 (lisp-mode-variables nil)
@@ -105,8 +104,7 @@ after OUT-BUFFER-NAME."
105 (temp-buffer-show-function 104 (temp-buffer-show-function
106 (function 105 (function
107 (lambda (buf) 106 (lambda (buf)
108 (save-excursion 107 (with-current-buffer buf
109 (set-buffer buf)
110 (goto-char (point-min)) 108 (goto-char (point-min))
111 (end-of-line 1) 109 (end-of-line 1)
112 (if (or (< (1+ (point)) (point-max)) 110 (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."
658 (matches 0) 658 (matches 0)
659 (submatches 0) 659 (submatches 0)
660 firstmatch) 660 firstmatch)
661 (save-excursion 661 (with-current-buffer reb-target-buffer
662 (set-buffer reb-target-buffer)
663 (reb-delete-overlays) 662 (reb-delete-overlays)
664 (goto-char (point-min)) 663 (goto-char (point-min))
665 (while (and (not (eobp)) 664 (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 @@
57(defun skkdic-convert-okuri-ari (skkbuf buf) 57(defun skkdic-convert-okuri-ari (skkbuf buf)
58 (message "Processing OKURI-ARI entries ...") 58 (message "Processing OKURI-ARI entries ...")
59 (goto-char (point-min)) 59 (goto-char (point-min))
60 (save-excursion 60 (with-current-buffer buf
61 (set-buffer buf)
62 (insert ";; Setting okuri-ari entries.\n" 61 (insert ";; Setting okuri-ari entries.\n"
63 "(skkdic-set-okuri-ari\n")) 62 "(skkdic-set-okuri-ari\n"))
64 (while (not (eobp)) 63 (while (not (eobp))
@@ -67,8 +66,7 @@
67 (end-of-line) 66 (end-of-line)
68 (setq to (point)) 67 (setq to (point))
69 68
70 (save-excursion 69 (with-current-buffer buf
71 (set-buffer buf)
72 (insert-buffer-substring skkbuf from to) 70 (insert-buffer-substring skkbuf from to)
73 (beginning-of-line) 71 (beginning-of-line)
74 (insert "\"") 72 (insert "\"")
@@ -81,8 +79,7 @@
81 (insert "\"\n")) 79 (insert "\"\n"))
82 80
83 (forward-line 1))) 81 (forward-line 1)))
84 (save-excursion 82 (with-current-buffer buf
85 (set-buffer buf)
86 (insert ")\n\n"))) 83 (insert ")\n\n")))
87 84
88(defconst skkdic-postfix-list '(skkdic-postfix-list)) 85(defconst skkdic-postfix-list '(skkdic-postfix-list))
@@ -111,15 +108,13 @@
111(defun skkdic-convert-postfix (skkbuf buf) 108(defun skkdic-convert-postfix (skkbuf buf)
112 (message "Processing POSTFIX entries ...") 109 (message "Processing POSTFIX entries ...")
113 (goto-char (point-min)) 110 (goto-char (point-min))
114 (save-excursion 111 (with-current-buffer buf
115 (set-buffer buf)
116 (insert ";; Setting postfix entries.\n" 112 (insert ";; Setting postfix entries.\n"
117 "(skkdic-set-postfix\n")) 113 "(skkdic-set-postfix\n"))
118 114
119 ;; Initialize SKKDIC-POSTFIX-LIST by predefined data 115 ;; Initialize SKKDIC-POSTFIX-LIST by predefined data
120 ;; SKKDIC-POSTFIX-DATA. 116 ;; SKKDIC-POSTFIX-DATA.
121 (save-excursion 117 (with-current-buffer buf
122 (set-buffer buf)
123 (let ((l skkdic-postfix-data) 118 (let ((l skkdic-postfix-data)
124 kana candidates entry) 119 kana candidates entry)
125 (while l 120 (while l
@@ -146,8 +141,7 @@
146 (if (not (member str candidates)) 141 (if (not (member str candidates))
147 (setq candidates (cons str candidates))) 142 (setq candidates (cons str candidates)))
148 (goto-char (match-end 1))) 143 (goto-char (match-end 1)))
149 (save-excursion 144 (with-current-buffer buf
150 (set-buffer buf)
151 (insert "\"" kana) 145 (insert "\"" kana)
152 (while candidates 146 (while candidates
153 (insert " " (car candidates)) 147 (insert " " (car candidates))
@@ -160,8 +154,7 @@
160 skkdic-postfix-list))) 154 skkdic-postfix-list)))
161 (setq candidates (cdr candidates))) 155 (setq candidates (cdr candidates)))
162 (insert "\"\n")))) 156 (insert "\"\n"))))
163 (save-excursion 157 (with-current-buffer buf
164 (set-buffer buf)
165 (insert ")\n\n"))) 158 (insert ")\n\n")))
166 159
167(defconst skkdic-prefix-list '(skkdic-prefix-list)) 160(defconst skkdic-prefix-list '(skkdic-prefix-list))
@@ -169,8 +162,7 @@
169(defun skkdic-convert-prefix (skkbuf buf) 162(defun skkdic-convert-prefix (skkbuf buf)
170 (message "Processing PREFIX entries ...") 163 (message "Processing PREFIX entries ...")
171 (goto-char (point-min)) 164 (goto-char (point-min))
172 (save-excursion 165 (with-current-buffer buf
173 (set-buffer buf)
174 (insert ";; Setting prefix entries.\n" 166 (insert ";; Setting prefix entries.\n"
175 "(skkdic-set-prefix\n")) 167 "(skkdic-set-prefix\n"))
176 (save-excursion 168 (save-excursion
@@ -182,16 +174,14 @@
182 (if (not (member str candidates)) 174 (if (not (member str candidates))
183 (setq candidates (cons str candidates))) 175 (setq candidates (cons str candidates)))
184 (goto-char (match-end 1))) 176 (goto-char (match-end 1)))
185 (save-excursion 177 (with-current-buffer buf
186 (set-buffer buf)
187 (insert "\"" kana) 178 (insert "\"" kana)
188 (while candidates 179 (while candidates
189 (insert " " (car candidates)) 180 (insert " " (car candidates))
190 (set-nested-alist (car candidates) kana skkdic-prefix-list) 181 (set-nested-alist (car candidates) kana skkdic-prefix-list)
191 (setq candidates (cdr candidates))) 182 (setq candidates (cdr candidates)))
192 (insert "\"\n"))))) 183 (insert "\"\n")))))
193 (save-excursion 184 (with-current-buffer buf
194 (set-buffer buf)
195 (insert ")\n\n"))) 185 (insert ")\n\n")))
196 186
197;; FROM and TO point the head and tail of "/J../J../.../". 187;; FROM and TO point the head and tail of "/J../J../.../".
@@ -315,8 +305,7 @@
315 305
316(defun skkdic-convert-okuri-nasi (skkbuf buf) 306(defun skkdic-convert-okuri-nasi (skkbuf buf)
317 (message "Processing OKURI-NASI entries ...") 307 (message "Processing OKURI-NASI entries ...")
318 (save-excursion 308 (with-current-buffer buf
319 (set-buffer buf)
320 (insert ";; Setting okuri-nasi entries.\n" 309 (insert ";; Setting okuri-nasi entries.\n"
321 "(skkdic-set-okuri-nasi\n") 310 "(skkdic-set-okuri-nasi\n")
322 (let ((l (nreverse skkdic-okuri-nasi-entries)) 311 (let ((l (nreverse skkdic-okuri-nasi-entries))
@@ -354,9 +343,8 @@ The name of generated file is specified by the variable `ja-dic-filename'."
354 (let* ((coding-system-for-read 'euc-japan) 343 (let* ((coding-system-for-read 'euc-japan)
355 (skkbuf(find-file-noselect (expand-file-name filename))) 344 (skkbuf(find-file-noselect (expand-file-name filename)))
356 (buf (get-buffer-create "*skkdic-work*"))) 345 (buf (get-buffer-create "*skkdic-work*")))
357 (save-excursion 346 ;; Setup and generate the header part of working buffer.
358 ;; Setup and generate the header part of working buffer. 347 (with-current-buffer buf
359 (set-buffer buf)
360 (erase-buffer) 348 (erase-buffer)
361 (buffer-disable-undo) 349 (buffer-disable-undo)
362 (insert ";;; ja-dic.el --- dictionary for Japanese input method" 350 (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'."
415 (skkdic-convert-okuri-nasi skkbuf buf) 403 (skkdic-convert-okuri-nasi skkbuf buf)
416 404
417 ;; Postfix 405 ;; Postfix
418 (save-excursion 406 (with-current-buffer buf
419 (set-buffer buf)
420 (goto-char (point-max)) 407 (goto-char (point-max))
421 (insert ";;\n(provide 'ja-dic)\n\n;;; ja-dic.el ends here\n"))) 408 (insert ";;\n(provide 'ja-dic)\n\n;;; ja-dic.el ends here\n")))
422 409
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."
2070 (help-setup-xref (list #'describe-language-environment language-name) 2070 (help-setup-xref (list #'describe-language-environment language-name)
2071 (called-interactively-p 'interactive)) 2071 (called-interactively-p 'interactive))
2072 (with-output-to-temp-buffer (help-buffer) 2072 (with-output-to-temp-buffer (help-buffer)
2073 (save-excursion 2073 (with-current-buffer standard-output
2074 (set-buffer standard-output)
2075 (insert language-name " language environment\n\n") 2074 (insert language-name " language environment\n\n")
2076 (if (stringp doc) 2075 (if (stringp doc)
2077 (insert doc "\n\n")) 2076 (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\"."
775 (\",\" . quail-prev-translation-block)) 775 (\",\" . quail-prev-translation-block))
776 nil nil)\n\n") 776 nil nil)\n\n")
777 (insert "(quail-define-rules\n") 777 (insert "(quail-define-rules\n")
778 (save-excursion 778 (with-current-buffer dicbuf
779 (set-buffer dicbuf)
780 ;; Handle double CR line ends, which result when checking out of 779 ;; Handle double CR line ends, which result when checking out of
781 ;; CVS on MS-Windows. 780 ;; CVS on MS-Windows.
782 (goto-char (point-min)) 781 (goto-char (point-min))
@@ -931,8 +930,7 @@ method `chinese-tonepy' with which you must specify tones by digits
931 930
932(defun ziranma-converter (dicbuf name title) 931(defun ziranma-converter (dicbuf name title)
933 (let (dic) 932 (let (dic)
934 (save-excursion 933 (with-current-buffer dicbuf
935 (set-buffer dicbuf)
936 (goto-char (point-min)) 934 (goto-char (point-min))
937 (search-forward "\n%keyname end") 935 (search-forward "\n%keyname end")
938 (forward-line 1) 936 (forward-line 1)
@@ -1052,8 +1050,7 @@ To input symbols and punctuations, type `/' followed by one of `a' to
1052 (let (dicbuf-start dicbuf-end key-start key (pos (point))) 1050 (let (dicbuf-start dicbuf-end key-start key (pos (point)))
1053 ;; Find the dictionary, which starts below a horizontal rule and 1051 ;; Find the dictionary, which starts below a horizontal rule and
1054 ;; ends at the second to last line in the HTML file. 1052 ;; ends at the second to last line in the HTML file.
1055 (save-excursion 1053 (with-current-buffer dicbuf
1056 (set-buffer dicbuf)
1057 (goto-char (point-min)) 1054 (goto-char (point-min))
1058 (re-search-forward "^#<hr>") 1055 (re-search-forward "^#<hr>")
1059 (forward-line 1) 1056 (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'.")
162;; Convert string STR by FUNC and return a resulting string. 162;; Convert string STR by FUNC and return a resulting string.
163(defun japanese-string-conversion (str func &rest args) 163(defun japanese-string-conversion (str func &rest args)
164 (let ((buf (get-buffer-create " *Japanese work*"))) 164 (let ((buf (get-buffer-create " *Japanese work*")))
165 (save-excursion 165 (with-current-buffer buf
166 (set-buffer buf)
167 (erase-buffer) 166 (erase-buffer)
168 (insert str) 167 (insert str)
169 (apply func 1 (point) args) 168 (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."
10748 (coding-system-for-read 'thai-tis620) 10748 (coding-system-for-read 'thai-tis620)
10749 (table (if append thai-word-table (list 'thai-words)))) 10749 (table (if append thai-word-table (list 'thai-words))))
10750 (unwind-protect 10750 (unwind-protect
10751 (save-excursion 10751 (with-current-buffer buf
10752 (set-buffer buf)
10753 (insert-file-contents file) 10752 (insert-file-contents file)
10754 (goto-char (point-min)) 10753 (goto-char (point-min))
10755 (while (re-search-forward "\\ct+" nil t) 10754 (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."
1036(defun eudc-save-options () 1036(defun eudc-save-options ()
1037 "Save options to `eudc-options-file'." 1037 "Save options to `eudc-options-file'."
1038 (interactive) 1038 (interactive)
1039 (save-excursion 1039 (with-current-buffer (find-file-noselect eudc-options-file t)
1040 (set-buffer (find-file-noselect eudc-options-file t))
1041 (goto-char (point-min)) 1040 (goto-char (point-min))
1042 ;; delete the previous setq 1041 ;; delete the previous setq
1043 (let ((standard-output (current-buffer)) 1042 (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."
149 (message "Contacting server...") 149 (message "Contacting server...")
150 (setq process (eudc-ph-open-session)) 150 (setq process (eudc-ph-open-session))
151 (if process 151 (if process
152 (save-excursion 152 (with-current-buffer (setq buffer (process-buffer process))
153 (set-buffer (setq buffer (process-buffer process)))
154 (eudc-ph-send-command process request) 153 (eudc-ph-send-command process request)
155 (message "Request sent, waiting for reply...") 154 (message "Request sent, waiting for reply...")
156 (eudc-ph-read-response process)))) 155 (eudc-ph-read-response process))))
@@ -173,8 +172,7 @@ SERVER is either a string naming the server or a list (NAME PORT)."
173 (setq port (or (match-string 3 server) 172 (setq port (or (match-string 3 server)
174 eudc-ph-default-server-port)) 173 eudc-ph-default-server-port))
175 (setq eudc-ph-process-buffer (get-buffer-create (format " *PH-%s*" host))) 174 (setq eudc-ph-process-buffer (get-buffer-create (format " *PH-%s*" host)))
176 (save-excursion 175 (with-current-buffer eudc-ph-process-buffer
177 (set-buffer eudc-ph-process-buffer)
178 (erase-buffer) 176 (erase-buffer)
179 (setq eudc-ph-read-point (point)) 177 (setq eudc-ph-read-point (point))
180 (and (featurep 'xemacs) (featurep 'mule) 178 (and (featurep 'xemacs) (featurep 'mule)
@@ -186,8 +184,7 @@ SERVER is either a string naming the server or a list (NAME PORT)."
186 process))) 184 process)))
187 185
188(defun eudc-ph-close-session (process) 186(defun eudc-ph-close-session (process)
189 (save-excursion 187 (with-current-buffer (process-buffer process)
190 (set-buffer (process-buffer process))
191 (eudc-ph-send-command process "quit") 188 (eudc-ph-send-command process "quit")
192 (eudc-ph-read-response process) 189 (eudc-ph-read-response process)
193 (run-at-time 2 nil 'delete-process process))) 190 (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.")
260 ;; At this point, we are in rmail mode, so the rmail funcs are loaded. 260 ;; At this point, we are in rmail mode, so the rmail funcs are loaded.
261 (if (fboundp 'rmail-get-header) ; Emacs 23 261 (if (fboundp 'rmail-get-header) ; Emacs 23
262 (rmail-get-header field) 262 (rmail-get-header field)
263 (save-excursion 263 (with-current-buffer rmail-buffer
264 (set-buffer rmail-buffer)
265 (save-restriction 264 (save-restriction
266 ;; Don't warn about this when compiling Emacs 23. 265 ;; Don't warn about this when compiling Emacs 23.
267 (with-no-warnings (rmail-narrow-to-non-pruned-header)) 266 (with-no-warnings (rmail-narrow-to-non-pruned-header))
@@ -294,10 +293,9 @@ Currently there are 'threads and 'flags.")
294 "Get mail header FIELD for current message using Gnus." 293 "Get mail header FIELD for current message using Gnus."
295 (unless (gnus-alive-p) 294 (unless (gnus-alive-p)
296 (error "Gnus is not running")) 295 (error "Gnus is not running"))
297 (save-excursion 296 (unless (gnus-buffer-exists-p gnus-article-buffer)
298 (unless (gnus-buffer-exists-p gnus-article-buffer) 297 (error "No article buffer available"))
299 (error "No article buffer available")) 298 (with-current-buffer gnus-article-buffer
300 (set-buffer gnus-article-buffer)
301 (gnus-summary-toggle-header 1) 299 (gnus-summary-toggle-header 1)
302 (message-field-value field))) 300 (message-field-value field)))
303 301
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."
726 "Get news for the site FEED-NAME by calling FUNCTION. 726 "Get news for the site FEED-NAME by calling FUNCTION.
727See `newsticker-get-news'." 727See `newsticker-get-news'."
728 (let ((buffername (concat " *newsticker-funcall-" feed-name "*"))) 728 (let ((buffername (concat " *newsticker-funcall-" feed-name "*")))
729 (save-excursion 729 (with-current-buffer (get-buffer-create buffername)
730 (set-buffer (get-buffer-create buffername))
731 (erase-buffer) 730 (erase-buffer)
732 (insert (string-to-multibyte (funcall function feed-name))) 731 (insert (string-to-multibyte (funcall function feed-name)))
733 (newsticker--sentinel-work nil t feed-name function 732 (newsticker--sentinel-work nil t feed-name function
@@ -777,8 +776,7 @@ from."
777WGET-ARGUMENTS is a list of arguments for wget. 776WGET-ARGUMENTS is a list of arguments for wget.
778See `newsticker-get-news'." 777See `newsticker-get-news'."
779 (let ((buffername (concat " *newsticker-wget-" feed-name "*"))) 778 (let ((buffername (concat " *newsticker-wget-" feed-name "*")))
780 (save-excursion 779 (with-current-buffer (get-buffer-create buffername)
781 (set-buffer (get-buffer-create buffername))
782 (erase-buffer) 780 (erase-buffer)
783 ;; throw an error if there is an old wget-process around 781 ;; throw an error if there is an old wget-process around
784 (if (get-process feed-name) 782 (if (get-process feed-name)
@@ -1756,8 +1754,7 @@ If the image has been downloaded in the last 24h do nothing."
1756 feed-name))) 1754 feed-name)))
1757 (wget-arguments (or (car (cdr (cdr (cdr (cdr item))))) 1755 (wget-arguments (or (car (cdr (cdr (cdr (cdr item)))))
1758 newsticker-wget-arguments))) 1756 newsticker-wget-arguments)))
1759 (save-excursion 1757 (with-current-buffer (get-buffer-create buffername)
1760 (set-buffer (get-buffer-create buffername))
1761 (erase-buffer) 1758 (erase-buffer)
1762 ;; throw an error if there is an old wget-process around 1759 ;; throw an error if there is an old wget-process around
1763 (if (get-process feed-name) 1760 (if (get-process feed-name)
@@ -1785,8 +1782,7 @@ If the image has been downloaded in the last 24h do nothing."
1785 feed-name) 1782 feed-name)
1786 (throw 'oops nil)) 1783 (throw 'oops nil))
1787 (let (image-name) 1784 (let (image-name)
1788 (save-excursion 1785 (with-current-buffer (process-buffer process)
1789 (set-buffer (process-buffer process))
1790 (setq image-name (concat (newsticker--images-dir) feed-name)) 1786 (setq image-name (concat (newsticker--images-dir) feed-name))
1791 (set-buffer-file-coding-system 'no-conversion) 1787 (set-buffer-file-coding-system 'no-conversion)
1792 ;; make sure the cache dir exists 1788 ;; 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."
1210 (setq newsticker--buffer-uptodate-p value) 1210 (setq newsticker--buffer-uptodate-p value)
1211 (let ((b (get-buffer "*newsticker*"))) 1211 (let ((b (get-buffer "*newsticker*")))
1212 (when b 1212 (when b
1213 (save-excursion 1213 (with-current-buffer b
1214 (set-buffer b) 1214 (setq mode-name (if value
1215 (if value 1215 "Newsticker -- up to date -- "
1216 (setq mode-name "Newsticker -- up to date -- ") 1216 "Newsticker -- NEED UPDATE -- ")))
1217 (setq mode-name "Newsticker -- NEED UPDATE -- ")))
1218 (force-mode-line-update 0)))) 1217 (force-mode-line-update 0))))
1219 1218
1220(defun newsticker--buffer-redraw () 1219(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."
307 "Add news ITEM for FEED to newsticker treeview list window. 307 "Add news ITEM for FEED to newsticker treeview list window.
308If string SHOW-FEED is non-nil it is shown in the item string." 308If string SHOW-FEED is non-nil it is shown in the item string."
309 (setq newsticker--treeview-list-show-feed show-feed) 309 (setq newsticker--treeview-list-show-feed show-feed)
310 (save-excursion 310 (with-current-buffer (newsticker--treeview-list-buffer)
311 (set-buffer (newsticker--treeview-list-buffer))
312 (let* ((inhibit-read-only t) 311 (let* ((inhibit-read-only t)
313 pos1 pos2) 312 pos1 pos2)
314 (goto-char (point-max)) 313 (goto-char (point-max))
@@ -350,8 +349,7 @@ If string SHOW-FEED is non-nil it is shown in the item string."
350 349
351(defun newsticker--treeview-list-clear () 350(defun newsticker--treeview-list-clear ()
352 "Clear the newsticker treeview list window." 351 "Clear the newsticker treeview list window."
353 (save-excursion 352 (with-current-buffer (newsticker--treeview-list-buffer)
354 (set-buffer (newsticker--treeview-list-buffer))
355 (let ((inhibit-read-only t)) 353 (let ((inhibit-read-only t))
356 (erase-buffer) 354 (erase-buffer)
357 (kill-all-local-variables) 355 (kill-all-local-variables)
@@ -549,8 +547,7 @@ The sort function is chosen according to the value of
549(defun newsticker--treeview-list-update-faces () 547(defun newsticker--treeview-list-update-faces ()
550 "Update faces in the treeview list buffer." 548 "Update faces in the treeview list buffer."
551 (let (pos-sel) 549 (let (pos-sel)
552 (save-excursion 550 (with-current-buffer (newsticker--treeview-list-buffer)
553 (set-buffer (newsticker--treeview-list-buffer))
554 (let ((inhibit-read-only t)) 551 (let ((inhibit-read-only t))
555 (goto-char (point-min)) 552 (goto-char (point-min))
556 (while (not (eobp)) 553 (while (not (eobp))
@@ -582,8 +579,7 @@ The sort function is chosen according to the value of
582 579
583(defun newsticker--treeview-list-clear-highlight () 580(defun newsticker--treeview-list-clear-highlight ()
584 "Clear the highlight in the treeview list buffer." 581 "Clear the highlight in the treeview list buffer."
585 (save-excursion 582 (with-current-buffer (newsticker--treeview-list-buffer)
586 (set-buffer (newsticker--treeview-list-buffer))
587 (let ((inhibit-read-only t)) 583 (let ((inhibit-read-only t))
588 (put-text-property (point-min) (point-max) :nt-selected nil)) 584 (put-text-property (point-min) (point-max) :nt-selected nil))
589 (newsticker--treeview-list-update-faces))) 585 (newsticker--treeview-list-update-faces)))
@@ -592,8 +588,7 @@ The sort function is chosen according to the value of
592 "Update the highlight in the treeview list buffer." 588 "Update the highlight in the treeview list buffer."
593 (newsticker--treeview-list-clear-highlight) 589 (newsticker--treeview-list-clear-highlight)
594 (let (pos num-lines) 590 (let (pos num-lines)
595 (save-excursion 591 (with-current-buffer (newsticker--treeview-list-buffer)
596 (set-buffer (newsticker--treeview-list-buffer))
597 (let ((inhibit-read-only t)) 592 (let ((inhibit-read-only t))
598 (put-text-property (save-excursion (beginning-of-line) (point)) 593 (put-text-property (save-excursion (beginning-of-line) (point))
599 (save-excursion (end-of-line) (point)) 594 (save-excursion (end-of-line) (point))
@@ -602,8 +597,7 @@ The sort function is chosen according to the value of
602 597
603(defun newsticker--treeview-list-highlight-start () 598(defun newsticker--treeview-list-highlight-start ()
604 "Return position of selection in treeview list buffer." 599 "Return position of selection in treeview list buffer."
605 (save-excursion 600 (with-current-buffer (newsticker--treeview-list-buffer)
606 (set-buffer (newsticker--treeview-list-buffer))
607 (goto-char (point-min)) 601 (goto-char (point-min))
608 (next-single-property-change (point) :nt-selected))) 602 (next-single-property-change (point) :nt-selected)))
609 603
@@ -677,8 +671,7 @@ for the button."
677;; ====================================================================== 671;; ======================================================================
678(defun newsticker--treeview-item-show-text (title description) 672(defun newsticker--treeview-item-show-text (title description)
679 "Show text in treeview item buffer consisting of TITLE and DESCRIPTION." 673 "Show text in treeview item buffer consisting of TITLE and DESCRIPTION."
680 (save-excursion 674 (with-current-buffer (newsticker--treeview-item-buffer)
681 (set-buffer (newsticker--treeview-item-buffer))
682 (when (fboundp 'w3m-process-stop) 675 (when (fboundp 'w3m-process-stop)
683 (w3m-process-stop (current-buffer))) 676 (w3m-process-stop (current-buffer)))
684 (let ((inhibit-read-only t)) 677 (let ((inhibit-read-only t))
@@ -696,8 +689,7 @@ for the button."
696(defun newsticker--treeview-item-show (item feed-name-symbol) 689(defun newsticker--treeview-item-show (item feed-name-symbol)
697 "Show news ITEM coming from FEED-NAME-SYMBOL in treeview item buffer." 690 "Show news ITEM coming from FEED-NAME-SYMBOL in treeview item buffer."
698 (setq newsticker--treeview-current-feed (symbol-name feed-name-symbol)) 691 (setq newsticker--treeview-current-feed (symbol-name feed-name-symbol))
699 (save-excursion 692 (with-current-buffer (newsticker--treeview-item-buffer)
700 (set-buffer (newsticker--treeview-item-buffer))
701 (when (fboundp 'w3m-process-stop) 693 (when (fboundp 'w3m-process-stop)
702 (w3m-process-stop (current-buffer))) 694 (w3m-process-stop (current-buffer)))
703 (let ((inhibit-read-only t) 695 (let ((inhibit-read-only t)
@@ -1012,8 +1004,7 @@ that case."
1012 (let ((p (point)) 1004 (let ((p (point))
1013 (notify (widget-get w :notify))) 1005 (notify (widget-get w :notify)))
1014 ;; FIXME: This moves point!!!! 1006 ;; FIXME: This moves point!!!!
1015 (save-excursion 1007 (with-current-buffer (newsticker--treeview-tree-buffer)
1016 (set-buffer (newsticker--treeview-tree-buffer))
1017 (widget-value-set w (widget-value w))) 1008 (widget-value-set w (widget-value w)))
1018 (goto-char p)))))) 1009 (goto-char p))))))
1019 1010
@@ -1045,8 +1036,7 @@ Arguments IGNORE are ignored."
1045 (newsticker--treeview-get-current-node) 1036 (newsticker--treeview-get-current-node)
1046 :parent) :from))) 1037 :parent) :from)))
1047 (when (or (integerp pos) (and (markerp pos) (marker-position pos))) 1038 (when (or (integerp pos) (and (markerp pos) (marker-position pos)))
1048 (save-excursion 1039 (with-current-buffer (newsticker--treeview-tree-buffer)
1049 (set-buffer (newsticker--treeview-tree-buffer))
1050 (goto-char pos) 1040 (goto-char pos)
1051 (move-overlay newsticker--tree-selection-overlay 1041 (move-overlay newsticker--tree-selection-overlay
1052 (save-excursion (beginning-of-line) (point)) 1042 (save-excursion (beginning-of-line) (point))
@@ -1167,8 +1157,7 @@ Arguments IGNORE are ignored."
1167(defun newsticker-treeview-browse-url () 1157(defun newsticker-treeview-browse-url ()
1168 "Call `browse-url' for the link of the item at point." 1158 "Call `browse-url' for the link of the item at point."
1169 (interactive) 1159 (interactive)
1170 (save-excursion 1160 (with-current-buffer (newsticker--treeview-list-buffer)
1171 (set-buffer (newsticker--treeview-list-buffer))
1172 (let ((url (get-text-property (point) :nt-link))) 1161 (let ((url (get-text-property (point) :nt-link)))
1173 (when url 1162 (when url
1174 (browse-url url) 1163 (browse-url url)
@@ -1186,15 +1175,13 @@ Arguments IGNORE are ignored."
1186 (get-buffer-create "*Newsticker Item*") t) 1175 (get-buffer-create "*Newsticker Item*") t)
1187 1176
1188 (unless newsticker--selection-overlay 1177 (unless newsticker--selection-overlay
1189 (save-excursion 1178 (with-current-buffer (newsticker--treeview-list-buffer)
1190 (set-buffer (newsticker--treeview-list-buffer))
1191 (setq newsticker--selection-overlay (make-overlay (point-min) 1179 (setq newsticker--selection-overlay (make-overlay (point-min)
1192 (point-max))) 1180 (point-max)))
1193 (overlay-put newsticker--selection-overlay 'face 1181 (overlay-put newsticker--selection-overlay 'face
1194 'newsticker-treeview-selection-face))) 1182 'newsticker-treeview-selection-face)))
1195 (unless newsticker--tree-selection-overlay 1183 (unless newsticker--tree-selection-overlay
1196 (save-excursion 1184 (with-current-buffer (newsticker--treeview-tree-buffer)
1197 (set-buffer (newsticker--treeview-tree-buffer))
1198 (setq newsticker--tree-selection-overlay (make-overlay (point-min) 1185 (setq newsticker--tree-selection-overlay (make-overlay (point-min)
1199 (point-max))) 1186 (point-max)))
1200 (overlay-put newsticker--tree-selection-overlay 'face 1187 (overlay-put newsticker--tree-selection-overlay 'face
@@ -1237,11 +1224,10 @@ Note: does not update the layout."
1237(defun newsticker-treeview-save () 1224(defun newsticker-treeview-save ()
1238 "Save newsticker data including treeview settings." 1225 "Save newsticker data including treeview settings."
1239 (interactive) 1226 (interactive)
1240 (save-excursion 1227 (let ((coding-system-for-write 'utf-8)
1241 (let ((coding-system-for-write 'utf-8) 1228 (buf (find-file-noselect (concat newsticker-dir "/groups"))))
1242 (buf (find-file-noselect (concat newsticker-dir "/groups")))) 1229 (when buf
1243 (when buf 1230 (with-current-buffer buf
1244 (set-buffer buf)
1245 (setq buffer-undo-list t) 1231 (setq buffer-undo-list t)
1246 (erase-buffer) 1232 (erase-buffer)
1247 (insert ";; -*- coding: utf-8 -*-\n") 1233 (insert ";; -*- coding: utf-8 -*-\n")
@@ -1287,8 +1273,7 @@ Note: does not update the layout."
1287 (interactive) 1273 (interactive)
1288 (newsticker--treeview-restore-layout) 1274 (newsticker--treeview-restore-layout)
1289 (newsticker--treeview-list-update-highlight) 1275 (newsticker--treeview-list-update-highlight)
1290 (save-excursion 1276 (with-current-buffer (newsticker--treeview-list-buffer)
1291 (set-buffer (newsticker--treeview-list-buffer))
1292 (beginning-of-line) 1277 (beginning-of-line)
1293 (let ((item (get-text-property (point) :nt-item)) 1278 (let ((item (get-text-property (point) :nt-item))
1294 (feed (get-text-property (point) :nt-feed))) 1279 (feed (get-text-property (point) :nt-feed)))
@@ -1375,8 +1360,7 @@ Will move to previous feed until an item is found."
1375 1360
1376(defun newsticker--treeview-get-selected-item () 1361(defun newsticker--treeview-get-selected-item ()
1377 "Return item that is currently selected in list buffer." 1362 "Return item that is currently selected in list buffer."
1378 (save-excursion 1363 (with-current-buffer (newsticker--treeview-list-buffer)
1379 (set-buffer (newsticker--treeview-list-buffer))
1380 (beginning-of-line) 1364 (beginning-of-line)
1381 (get-text-property (point) :nt-item))) 1365 (get-text-property (point) :nt-item)))
1382 1366
@@ -1415,8 +1399,7 @@ Move to next item unless DONT-PROCEED is non-nil."
1415 (interactive) 1399 (interactive)
1416 (let ((current-feed (or newsticker--treeview-current-feed 1400 (let ((current-feed (or newsticker--treeview-current-feed
1417 newsticker--treeview-current-vfeed))) 1401 newsticker--treeview-current-vfeed)))
1418 (save-excursion 1402 (with-current-buffer (newsticker--treeview-list-buffer)
1419 (set-buffer (newsticker--treeview-list-buffer))
1420 (goto-char (point-min)) 1403 (goto-char (point-min))
1421 (while (not (eobp)) 1404 (while (not (eobp))
1422 (let ((item (get-text-property (point) :nt-item))) 1405 (let ((item (get-text-property (point) :nt-item)))
@@ -1443,8 +1426,7 @@ Move to next item unless DONT-PROCEED is non-nil."
1443 1426
1444(defun newsticker--treeview-set-current-node (node) 1427(defun newsticker--treeview-set-current-node (node)
1445 "Make NODE the current node." 1428 "Make NODE the current node."
1446 (save-excursion 1429 (with-current-buffer (newsticker--treeview-tree-buffer)
1447 (set-buffer (newsticker--treeview-tree-buffer))
1448 (setq newsticker--treeview-current-node-id 1430 (setq newsticker--treeview-current-node-id
1449 (widget-get node :nt-id)) 1431 (widget-get node :nt-id))
1450 (setq newsticker--treeview-current-feed (widget-get node :nt-feed)) 1432 (setq newsticker--treeview-current-feed (widget-get node :nt-feed))
@@ -1626,8 +1608,7 @@ Return t if a new feed was activated, nil otherwise."
1626 (newsticker--treeview-unfold-node group-name)) 1608 (newsticker--treeview-unfold-node group-name))
1627 (setq node (newsticker--treeview-get-node-of-feed feed-name))) 1609 (setq node (newsticker--treeview-get-node-of-feed feed-name)))
1628 (when node 1610 (when node
1629 (save-excursion 1611 (with-current-buffer (newsticker--treeview-tree-buffer)
1630 (set-buffer (newsticker--treeview-tree-buffer))
1631 (widget-put node :nt-selected t) 1612 (widget-put node :nt-selected t)
1632 (widget-apply-action node) 1613 (widget-apply-action node)
1633 (newsticker--treeview-set-current-node node))))) 1614 (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."
564Debug text is written to `rcirc-debug-buffer' if `rcirc-debug-flag' 564Debug text is written to `rcirc-debug-buffer' if `rcirc-debug-flag'
565is non-nil." 565is non-nil."
566 (when rcirc-debug-flag 566 (when rcirc-debug-flag
567 (save-excursion 567 (with-current-buffer (get-buffer-create rcirc-debug-buffer)
568 (set-buffer (get-buffer-create rcirc-debug-buffer))
569 (goto-char (point-max)) 568 (goto-char (point-max))
570 (insert (concat 569 (insert (concat
571 "[" 570 "["
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."
482;; if it was in use in the previous buffer. 482;; if it was in use in the previous buffer.
483(defun iso-acc-minibuf-setup () 483(defun iso-acc-minibuf-setup ()
484 (setq iso-accents-mode 484 (setq iso-accents-mode
485 (save-excursion 485 (with-current-buffer (window-buffer minibuffer-scroll-window)
486 (set-buffer (window-buffer minibuffer-scroll-window))
487 iso-accents-mode))) 486 iso-accents-mode)))
488 487
489(add-hook 'minibuffer-setup-hook 'iso-acc-minibuf-setup) 488(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 @@
107;;;###autoload 107;;;###autoload
108(defun resume-suspend-hook () 108(defun resume-suspend-hook ()
109 "Clear out the file used for transmitting args when Emacs resumes." 109 "Clear out the file used for transmitting args when Emacs resumes."
110 (save-excursion 110 (with-current-buffer (get-buffer-create resume-emacs-args-buffer)
111 (set-buffer (get-buffer-create resume-emacs-args-buffer))
112 (erase-buffer) 111 (erase-buffer)
113 (resume-write-buffer-to-file (current-buffer) resume-emacs-args-file))) 112 (resume-write-buffer-to-file (current-buffer) resume-emacs-args-file)))
114 113
@@ -116,8 +115,7 @@
116 "Writes the contents of BUFFER into FILE, if permissions allow." 115 "Writes the contents of BUFFER into FILE, if permissions allow."
117 (if (not (file-writable-p file)) 116 (if (not (file-writable-p file))
118 (error "No permission to write file %s" file)) 117 (error "No permission to write file %s" file))
119 (save-excursion 118 (with-current-buffer buffer
120 (set-buffer buffer)
121 (clear-visited-file-modtime) 119 (clear-visited-file-modtime)
122 (save-restriction 120 (save-restriction
123 (widen) 121 (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)"
453 "Display all the news groups to which you belong." 453 "Display all the news groups to which you belong."
454 (interactive) 454 (interactive)
455 (with-output-to-temp-buffer "*Newsgroups*" 455 (with-output-to-temp-buffer "*Newsgroups*"
456 (save-excursion 456 (with-current-buffer standard-output
457 (set-buffer standard-output)
458 (insert 457 (insert
459 "News Group Msg No. News Group Msg No.\n") 458 "News Group Msg No. News Group Msg No.\n")
460 (insert 459 (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.
355GPR_FILE must be full path to file, normalized. 355GPR_FILE must be full path to file, normalized.
356src_dir, obj_dir will include compiler runtime. 356src_dir, obj_dir will include compiler runtime.
357Assumes environment variable ADA_PROJECT_PATH is set properly." 357Assumes environment variable ADA_PROJECT_PATH is set properly."
358 (save-excursion 358 (with-current-buffer (get-buffer-create "*gnatls*")
359 (set-buffer (get-buffer-create "*gnatls*"))
360 (erase-buffer) 359 (erase-buffer)
361 360
362 ;; this can take a long time; let the user know what's up 361 ;; this can take a long time; let the user know what's up
@@ -1041,16 +1040,14 @@ existing buffer `*gnatfind*', if there is one."
1041 (setq command (concat command " -p\"" ada-prj-default-project-file "\"")))) 1040 (setq command (concat command " -p\"" ada-prj-default-project-file "\""))))
1042 1041
1043 (if (and append (get-buffer ada-gnatfind-buffer-name)) 1042 (if (and append (get-buffer ada-gnatfind-buffer-name))
1044 (save-excursion 1043 (with-current-buffer "*gnatfind*"
1045 (set-buffer "*gnatfind*")
1046 (setq old-contents (buffer-string)))) 1044 (setq old-contents (buffer-string))))
1047 1045
1048 (let ((compilation-error "reference")) 1046 (let ((compilation-error "reference"))
1049 (compilation-start command 'compilation-mode (lambda (mode) ada-gnatfind-buffer-name))) 1047 (compilation-start command 'compilation-mode (lambda (mode) ada-gnatfind-buffer-name)))
1050 1048
1051 ;; Hide the "Compilation" menu 1049 ;; Hide the "Compilation" menu
1052 (save-excursion 1050 (with-current-buffer ada-gnatfind-buffer-name
1053 (set-buffer ada-gnatfind-buffer-name)
1054 (local-unset-key [menu-bar compilation-menu]) 1051 (local-unset-key [menu-bar compilation-menu])
1055 1052
1056 (if old-contents 1053 (if old-contents
@@ -1318,8 +1315,7 @@ If ARG is non-nil, ask for user confirmation."
1318 command))) 1315 command)))
1319 1316
1320 ;; Run the command 1317 ;; Run the command
1321 (save-excursion 1318 (with-current-buffer (get-buffer-create "*run*")
1322 (set-buffer (get-buffer-create "*run*"))
1323 (set 'buffer-read-only nil) 1319 (set 'buffer-read-only nil)
1324 1320
1325 (erase-buffer) 1321 (erase-buffer)
@@ -1547,8 +1543,7 @@ the project file."
1547 ;; the 'D' lines. This is done repeatedly, in case the direct parent is 1543 ;; the 'D' lines. This is done repeatedly, in case the direct parent is
1548 ;; also a separate. 1544 ;; also a separate.
1549 1545
1550 (save-excursion 1546 (with-current-buffer (get-file-buffer file)
1551 (set-buffer (get-file-buffer file))
1552 (let ((short-ali-file-name 1547 (let ((short-ali-file-name
1553 (concat (file-name-sans-extension (file-name-nondirectory file)) 1548 (concat (file-name-sans-extension (file-name-nondirectory file))
1554 ".ali")) 1549 ".ali"))
@@ -2044,13 +2039,11 @@ the declaration and documentation of the subprograms one is using."
2044 choice 2039 choice
2045 file) 2040 file)
2046 2041
2047 (save-excursion 2042 ;; Do the grep in all the directories. We do multiple shell
2048 2043 ;; commands instead of one in case there is no .ali file in one
2049 ;; Do the grep in all the directories. We do multiple shell 2044 ;; of the directory and the shell stops because of that.
2050 ;; commands instead of one in case there is no .ali file in one
2051 ;; of the directory and the shell stops because of that.
2052 2045
2053 (set-buffer (get-buffer-create "*grep*")) 2046 (with-current-buffer (get-buffer-create "*grep*")
2054 (while dirs 2047 (while dirs
2055 (insert (shell-command-to-string 2048 (insert (shell-command-to-string
2056 (concat 2049 (concat
@@ -2234,8 +2227,7 @@ Return the position of the declaration in the buffer, or nil if not found."
2234 (unit-name nil) 2227 (unit-name nil)
2235 (body-name nil) 2228 (body-name nil)
2236 (ali-name nil)) 2229 (ali-name nil))
2237 (save-excursion 2230 (with-current-buffer buffer
2238 (set-buffer buffer)
2239 (goto-char (point-min)) 2231 (goto-char (point-min))
2240 (re-search-forward "^U \\([^ \t%]+\\)%[bs][ \t]+\\([^ \t]+\\)") 2232 (re-search-forward "^U \\([^ \t%]+\\)%[bs][ \t]+\\([^ \t]+\\)")
2241 (setq unit-name (match-string 1)) 2233 (setq unit-name (match-string 1))
@@ -2280,8 +2272,7 @@ Return the position of the declaration in the buffer, or nil if not found."
2280This is a GNAT specific function that uses gnatkrunch." 2272This is a GNAT specific function that uses gnatkrunch."
2281 (let ((krunch-buf (generate-new-buffer "*gkrunch*")) 2273 (let ((krunch-buf (generate-new-buffer "*gkrunch*"))
2282 (cross-prefix (plist-get (cdr (ada-xref-current-project)) 'cross_prefix))) 2274 (cross-prefix (plist-get (cdr (ada-xref-current-project)) 'cross_prefix)))
2283 (save-excursion 2275 (with-current-buffer krunch-buf
2284 (set-buffer krunch-buf)
2285 ;; send adaname to external process `gnatkr'. 2276 ;; send adaname to external process `gnatkr'.
2286 ;; Add a dummy extension, since gnatkr versions have two different 2277 ;; Add a dummy extension, since gnatkr versions have two different
2287 ;; behaviors depending on the version: 2278 ;; behaviors depending on the version:
@@ -2340,8 +2331,7 @@ If INTERACTIVE is nil, assume this is called from `ff-file-created-hook'."
2340 " " gnatstub-opts " " filename)) 2331 " " gnatstub-opts " " filename))
2341 (buffer (get-buffer-create "*gnat stub*"))) 2332 (buffer (get-buffer-create "*gnat stub*")))
2342 2333
2343 (save-excursion 2334 (with-current-buffer buffer
2344 (set-buffer buffer)
2345 (compilation-minor-mode 1) 2335 (compilation-minor-mode 1)
2346 (erase-buffer) 2336 (erase-buffer)
2347 (insert gnatstub-cmd) 2337 (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'.")
1087;; checkdoc-params: (dummies) 1087;; checkdoc-params: (dummies)
1088 "Invalidate context cache for syntactical context information." 1088 "Invalidate context cache for syntactical context information."
1089 :XEMACS ; XEmacs bug workaround 1089 :XEMACS ; XEmacs bug workaround
1090 (save-excursion 1090 (with-current-buffer (get-buffer-create " ANTLR XEmacs bug workaround")
1091 (set-buffer (get-buffer-create " ANTLR XEmacs bug workaround"))
1092 (buffer-syntactic-context-depth) 1091 (buffer-syntactic-context-depth)
1093 nil) 1092 nil)
1094 :EMACS 1093 :EMACS
@@ -2182,8 +2181,7 @@ export vocabulary specified in that file."
2182 "\\'")) 2181 "\\'"))
2183 classes dependencies) 2182 classes dependencies)
2184 (unwind-protect 2183 (unwind-protect
2185 (save-excursion 2184 (with-current-buffer temp-buffer
2186 (set-buffer temp-buffer)
2187 (widen) ; just in case... 2185 (widen) ; just in case...
2188 (dolist (file grammar) 2186 (dolist (file grammar)
2189 (when (and (file-regular-p file) 2187 (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."
1469 parse-sexp-lookup-properties 1469 parse-sexp-lookup-properties
1470 parse-sexp-ignore-comments 1470 parse-sexp-ignore-comments
1471 lookup-syntax-properties) 1471 lookup-syntax-properties)
1472 (save-excursion 1472 (with-current-buffer buf
1473 (set-buffer buf)
1474 (set-syntax-table (make-syntax-table)) 1473 (set-syntax-table (make-syntax-table))
1475 1474
1476 ;; For some reason we have to set some of these after the 1475 ;; 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."
8571 (let* ((pod2man-args (concat buffer-file-name " | nroff -man ")) 8571 (let* ((pod2man-args (concat buffer-file-name " | nroff -man "))
8572 (bufname (concat "Man " buffer-file-name)) 8572 (bufname (concat "Man " buffer-file-name))
8573 (buffer (generate-new-buffer bufname))) 8573 (buffer (generate-new-buffer bufname)))
8574 (save-excursion 8574 (with-current-buffer buffer
8575 (set-buffer buffer)
8576 (let ((process-environment (copy-sequence process-environment))) 8575 (let ((process-environment (copy-sequence process-environment)))
8577 ;; Prevent any attempt to use display terminal fanciness. 8576 ;; Prevent any attempt to use display terminal fanciness.
8578 (setenv "TERM" "dumb") 8577 (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."
575 "Save the current cpp configuration in a file." 575 "Save the current cpp configuration in a file."
576 (interactive) 576 (interactive)
577 (require 'pp) 577 (require 'pp)
578 (save-excursion 578 (with-current-buffer cpp-edit-buffer
579 (set-buffer cpp-edit-buffer)
580 (let ((buffer (find-file-noselect cpp-config-file))) 579 (let ((buffer (find-file-noselect cpp-config-file)))
581 (set-buffer buffer) 580 (set-buffer buffer)
582 (erase-buffer) 581 (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
4565 horizontal (memq (ebnf-node-action prod) 4565 horizontal (memq (ebnf-node-action prod)
4566 ebnf-action-list)) 4566 ebnf-action-list))
4567 ;; generate production in EPS buffer 4567 ;; generate production in EPS buffer
4568 (save-excursion 4568 (with-current-buffer eps-buffer
4569 (set-buffer eps-buffer)
4570 (setq ebnf-eps-upper-x 0.0 4569 (setq ebnf-eps-upper-x 0.0
4571 ebnf-eps-upper-y 0.0 4570 ebnf-eps-upper-y 0.0
4572 ebnf-eps-max-width prod-width 4571 ebnf-eps-max-width prod-width
@@ -4581,8 +4580,7 @@ end
4581 (ebnf-eps-finish-and-write eps-buffer 4580 (ebnf-eps-finish-and-write eps-buffer
4582 (ebnf-eps-filename prod-name))) 4581 (ebnf-eps-filename prod-name)))
4583 ;; prepare for next loop 4582 ;; prepare for next loop
4584 (save-excursion 4583 (with-current-buffer eps-buffer
4585 (set-buffer eps-buffer)
4586 (erase-buffer)) 4584 (erase-buffer))
4587 (setq ebnf-tree (cdr ebnf-tree))) 4585 (setq ebnf-tree (cdr ebnf-tree)))
4588 ;; write and kill temporary buffers 4586 ;; write and kill temporary buffers
@@ -4617,8 +4615,7 @@ end
4617 prod-width prod-height eps-buffer) 4615 prod-width prod-height eps-buffer)
4618 (while prod-list 4616 (while prod-list
4619 (add-to-list file-list-sym (car prod-list)) 4617 (add-to-list file-list-sym (car prod-list))
4620 (save-excursion 4618 (with-current-buffer (get-buffer-create (concat " *" (car prod-list) "*"))
4621 (set-buffer (get-buffer-create (concat " *" (car prod-list) "*")))
4622 (goto-char (point-max)) 4619 (goto-char (point-max))
4623 (cond 4620 (cond
4624 ;; first production 4621 ;; first production
@@ -5278,8 +5275,7 @@ killed after process termination."
5278 5275
5279(defun ebnf-begin-file () 5276(defun ebnf-begin-file ()
5280 (ps-flush-output) 5277 (ps-flush-output)
5281 (save-excursion 5278 (with-current-buffer ps-spool-buffer
5282 (set-buffer ps-spool-buffer)
5283 (goto-char (point-min)) 5279 (goto-char (point-min))
5284 (and (search-forward "%%Creator: " nil t) 5280 (and (search-forward "%%Creator: " nil t)
5285 (not (search-forward "& ebnf2ps v" 5281 (not (search-forward "& ebnf2ps v"
@@ -5299,8 +5295,7 @@ killed after process termination."
5299 5295
5300(defun ebnf-eps-finish-and-write (buffer filename) 5296(defun ebnf-eps-finish-and-write (buffer filename)
5301 (when (buffer-modified-p buffer) 5297 (when (buffer-modified-p buffer)
5302 (save-excursion 5298 (with-current-buffer buffer
5303 (set-buffer buffer)
5304 (ebnf-eps-header-footer-set filename) 5299 (ebnf-eps-header-footer-set filename)
5305 (setq ebnf-eps-upper-x (max ebnf-eps-upper-x ebnf-eps-max-width) 5300 (setq ebnf-eps-upper-x (max ebnf-eps-upper-x ebnf-eps-max-width)
5306 ebnf-eps-upper-y (if (zerop ebnf-eps-upper-y) 5301 ebnf-eps-upper-y (if (zerop ebnf-eps-upper-y)
@@ -6349,8 +6344,7 @@ killed after process termination."
6349 6344
6350(defun ebnf-log (format-str &rest args) 6345(defun ebnf-log (format-str &rest args)
6351 (when ebnf-log 6346 (when ebnf-log
6352 (save-excursion 6347 (with-current-buffer (get-buffer-create "*Ebnf2ps Log*")
6353 (set-buffer (get-buffer-create "*Ebnf2ps Log*"))
6354 (goto-char (point-max)) 6348 (goto-char (point-max))
6355 (insert (apply 'format format-str args) "\n")))) 6349 (insert (apply 'format format-str args) "\n"))))
6356 6350
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."
1002 (loop for buffer in (ebrowse-browser-buffer-list) 1002 (loop for buffer in (ebrowse-browser-buffer-list)
1003 until (eq header (ebrowse-value-in-buffer 'ebrowse--header buffer)) 1003 until (eq header (ebrowse-value-in-buffer 'ebrowse--header buffer))
1004 finally do 1004 finally do
1005 (save-excursion 1005 (with-current-buffer buffer
1006 (set-buffer buffer)
1007 (ebrowse-fill-member-table)))) 1006 (ebrowse-fill-member-table))))
1008 (ebrowse-hs-member-table header)) 1007 (ebrowse-hs-member-table header))
1009 1008
@@ -1613,8 +1612,7 @@ and (b) in the directories named in `ebrowse-search-path'."
1613Restore frame configuration active before viewing the file, 1612Restore frame configuration active before viewing the file,
1614and possibly kill the viewed buffer." 1613and possibly kill the viewed buffer."
1615 (let (exit-action original-frame-configuration) 1614 (let (exit-action original-frame-configuration)
1616 (save-excursion 1615 (with-current-buffer buffer
1617 (set-buffer buffer)
1618 (setq original-frame-configuration ebrowse--frame-configuration 1616 (setq original-frame-configuration ebrowse--frame-configuration
1619 exit-action ebrowse--view-exit-action)) 1617 exit-action ebrowse--view-exit-action))
1620 ;; Delete the frame in which we viewed. 1618 ;; Delete the frame in which we viewed.
@@ -3555,7 +3553,7 @@ The file name is read from the minibuffer."
3555 (interactive) 3553 (interactive)
3556 (let* ((buffer (or (ebrowse-choose-from-browser-buffers) 3554 (let* ((buffer (or (ebrowse-choose-from-browser-buffers)
3557 (error "No tree buffer"))) 3555 (error "No tree buffer")))
3558 (files (save-excursion (set-buffer buffer) (ebrowse-files-table))) 3556 (files (with-current-buffer buffer (ebrowse-files-table)))
3559 (file (completing-read "List members in file: " files nil t)) 3557 (file (completing-read "List members in file: " files nil t))
3560 (header (ebrowse-value-in-buffer 'ebrowse--header buffer)) 3558 (header (ebrowse-value-in-buffer 'ebrowse--header buffer))
3561 temp-buffer-setup-hook 3559 temp-buffer-setup-hook
@@ -3733,8 +3731,7 @@ TREE-BUFFER specifies the class tree we operate on."
3733 ;; on which tree (s)he wants to operate. 3731 ;; on which tree (s)he wants to operate.
3734 (when initialize 3732 (when initialize
3735 (let ((buffer (or tree-buffer (ebrowse-choose-from-browser-buffers)))) 3733 (let ((buffer (or tree-buffer (ebrowse-choose-from-browser-buffers))))
3736 (save-excursion 3734 (with-current-buffer buffer
3737 (set-buffer buffer)
3738 (setq ebrowse-tags-next-file-list 3735 (setq ebrowse-tags-next-file-list
3739 (ebrowse-files-list (ebrowse-marked-classes-p)) 3736 (ebrowse-files-list (ebrowse-marked-classes-p))
3740 ebrowse-tags-loop-last-file 3737 ebrowse-tags-loop-last-file
@@ -4124,8 +4121,7 @@ Otherwise, FILE-NAME specifies the file to save the tree in."
4124 (header (copy-ebrowse-hs ebrowse--header)) 4121 (header (copy-ebrowse-hs ebrowse--header))
4125 (tree ebrowse--tree)) 4122 (tree ebrowse--tree))
4126 (unwind-protect 4123 (unwind-protect
4127 (save-excursion 4124 (with-current-buffer (setq standard-output temp-buffer)
4128 (set-buffer (setq standard-output temp-buffer))
4129 (erase-buffer) 4125 (erase-buffer)
4130 (setf (ebrowse-hs-member-table header) nil) 4126 (setf (ebrowse-hs-member-table header) nil)
4131 (insert (prin1-to-string header) " ") 4127 (insert (prin1-to-string header) " ")
@@ -4210,8 +4206,8 @@ NUMBER-OF-STATIC-VARIABLES:"
4210 4206
4211;;; Global key bindings 4207;;; Global key bindings
4212 4208
4213;;; The following can be used to bind key sequences starting with 4209;; The following can be used to bind key sequences starting with
4214;;; prefix `\C-c\C-m' to browse commands. 4210;; prefix `\C-c\C-m' to browse commands.
4215 4211
4216(defvar ebrowse-global-map nil 4212(defvar ebrowse-global-map nil
4217 "*Keymap for Ebrowse commands.") 4213 "*Keymap for Ebrowse commands.")
@@ -4270,14 +4266,14 @@ NUMBER-OF-STATIC-VARIABLES:"
4270 4266
4271;;; Electric C++ browser buffer menu 4267;;; Electric C++ browser buffer menu
4272 4268
4273;;; Electric buffer menu customization to display only some buffers 4269;; Electric buffer menu customization to display only some buffers
4274;;; (in this case Tree buffers). There is only one problem with this: 4270;; (in this case Tree buffers). There is only one problem with this:
4275;;; If the very first character typed in the buffer menu is a space, 4271;; If the very first character typed in the buffer menu is a space,
4276;;; this will select the buffer from which the buffer menu was 4272;; this will select the buffer from which the buffer menu was
4277;;; invoked. But this buffer is not displayed in the buffer list if 4273;; invoked. But this buffer is not displayed in the buffer list if
4278;;; it isn't a tree buffer. I therefore let the buffer menu command 4274;; it isn't a tree buffer. I therefore let the buffer menu command
4279;;; loop read the command `p' via `unread-command-char'. This command 4275;; loop read the command `p' via `unread-command-char'. This command
4280;;; has no effect since we are on the first line of the buffer. 4276;; has no effect since we are on the first line of the buffer.
4281 4277
4282(defvar electric-buffer-menu-mode-hook nil) 4278(defvar electric-buffer-menu-mode-hook nil)
4283 4279
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."
2465 obj) 2465 obj)
2466 (when (numberp pos) 2466 (when (numberp pos)
2467 (with-selected-window (posn-window posn) 2467 (with-selected-window (posn-window posn)
2468 (save-excursion 2468 (with-current-buffer (window-buffer (selected-window))
2469 (set-buffer (window-buffer (selected-window)))
2470 (goto-char pos) 2469 (goto-char pos)
2471 (dolist (overlay (overlays-in pos pos)) 2470 (dolist (overlay (overlays-in pos pos))
2472 (when (overlay-get overlay 'put-break) 2471 (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."
2831 (let ((proc (get-buffer-process gud-comint-buffer))) 2831 (let ((proc (get-buffer-process gud-comint-buffer)))
2832 (or proc (error "Current buffer has no process")) 2832 (or proc (error "Current buffer has no process"))
2833 ;; Arrange for the current prompt to get deleted. 2833 ;; Arrange for the current prompt to get deleted.
2834 (save-excursion 2834 (with-current-buffer gud-comint-buffer
2835 (set-buffer gud-comint-buffer)
2836 (save-restriction 2835 (save-restriction
2837 (widen) 2836 (widen)
2838 (if (marker-position gud-delete-prompt-marker) 2837 (if (marker-position gud-delete-prompt-marker)
@@ -3062,8 +3061,7 @@ class of the file (using s to separate nested class ids)."
3062 ;; symbols until 'topmost-intro is reached to find out if 3061 ;; symbols until 'topmost-intro is reached to find out if
3063 ;; point is within a nested class 3062 ;; point is within a nested class
3064 (if (and fbuffer (equal (symbol-file 'java-mode) "cc-mode")) 3063 (if (and fbuffer (equal (symbol-file 'java-mode) "cc-mode"))
3065 (save-excursion 3064 (with-current-buffer fbuffer
3066 (set-buffer fbuffer)
3067 (let ((nclass) (syntax)) 3065 (let ((nclass) (syntax))
3068 ;; While the c-syntactic information does not start 3066 ;; While the c-syntactic information does not start
3069 ;; with the 'topmost-intro symbol, there may be 3067 ;; with the 'topmost-intro symbol, there may be
@@ -3327,8 +3325,7 @@ only tooltips in the buffer containing the overlay arrow."
3327 (remove-hook 'post-command-hook 3325 (remove-hook 'post-command-hook
3328 'gud-tooltip-activate-mouse-motions-if-enabled) 3326 'gud-tooltip-activate-mouse-motions-if-enabled)
3329 (dolist (buffer (buffer-list)) 3327 (dolist (buffer (buffer-list))
3330 (save-excursion 3328 (with-current-buffer buffer
3331 (set-buffer buffer)
3332 (if (and gud-tooltip-mode 3329 (if (and gud-tooltip-mode
3333 (memq major-mode gud-tooltip-modes)) 3330 (memq major-mode gud-tooltip-modes))
3334 (gud-tooltip-activate-mouse-motions t) 3331 (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."
807(defun idlwave-help-get-special-help (name type class keyword) 807(defun idlwave-help-get-special-help (name type class keyword)
808 "Call the function given by `idlwave-extra-help-function'." 808 "Call the function given by `idlwave-extra-help-function'."
809 (let* ((cw (selected-window)) 809 (let* ((cw (selected-window))
810 (help-pos (save-excursion 810 (help-pos (with-current-buffer (idlwave-help-get-help-buffer)
811 (set-buffer (idlwave-help-get-help-buffer))
812 (let ((buffer-read-only nil)) 811 (let ((buffer-read-only nil))
813 (funcall idlwave-extra-help-function 812 (funcall idlwave-extra-help-function
814 name type class keyword))))) 813 name type class keyword)))))
@@ -1224,8 +1223,7 @@ Useful when source code is displayed as help. See the option
1224 (if buf 1223 (if buf
1225 nil 1224 nil
1226 (setq buf (get-buffer-create "*IDLWAVE Help*")) 1225 (setq buf (get-buffer-create "*IDLWAVE Help*"))
1227 (save-excursion 1226 (with-current-buffer buf
1228 (set-buffer buf)
1229 (idlwave-help-mode))) 1227 (idlwave-help-mode)))
1230 buf)) 1228 buf))
1231 1229
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."
1541 (concat idlwave-shell-accumulation string))) 1541 (concat idlwave-shell-accumulation string)))
1542 1542
1543 1543
1544;;; Test/Debug code 1544 ;; ;; Test/Debug code
1545 ;(with-current-buffer 1545 ;;(with-current-buffer
1546 ; (get-buffer-create "*idlwave-shell-output*") 1546 ;; (get-buffer-create "*idlwave-shell-output*")
1547 ; (goto-char (point-max)) 1547 ;; (goto-char (point-max))
1548 ; (insert "\nReceived STRING\n===>\n" string "\n<====\n")) 1548 ;; (insert "\nReceived STRING\n===>\n" string "\n<====\n"))
1549 1549
1550 ;; Check for prompt in current accumulating output 1550 ;; Check for prompt in current accumulating output
1551 (when (setq idlwave-shell-ready 1551 (when (setq idlwave-shell-ready
@@ -1553,8 +1553,7 @@ and then calls `idlwave-shell-send-command' for any pending commands."
1553 idlwave-shell-accumulation)) 1553 idlwave-shell-accumulation))
1554 ;; Gather the command output 1554 ;; Gather the command output
1555 (if idlwave-shell-hide-output 1555 (if idlwave-shell-hide-output
1556 (save-excursion 1556 (with-current-buffer idlwave-shell-hidden-output-buffer
1557 (set-buffer idlwave-shell-hidden-output-buffer)
1558 (setq full-output (buffer-string)) 1557 (setq full-output (buffer-string))
1559 (goto-char (point-max)) 1558 (goto-char (point-max))
1560 (re-search-backward idlwave-shell-prompt-pattern nil t) 1559 (re-search-backward idlwave-shell-prompt-pattern nil t)
@@ -1618,8 +1617,7 @@ and then calls `idlwave-shell-send-command' for any pending commands."
1618 (let* ((buf (idlwave-shell-buffer)) 1617 (let* ((buf (idlwave-shell-buffer))
1619 (win (get-buffer-window buf))) 1618 (win (get-buffer-window buf)))
1620 (when (get-buffer buf) 1619 (when (get-buffer buf)
1621 (save-excursion 1620 (with-current-buffer (idlwave-shell-buffer)
1622 (set-buffer (idlwave-shell-buffer))
1623 (goto-char (point-max)) 1621 (goto-char (point-max))
1624 (insert (format "\n\n Process %s %s" process event)) 1622 (insert (format "\n\n Process %s %s" process event))
1625 (if (and idlwave-shell-save-command-history 1623 (if (and idlwave-shell-save-command-history
@@ -1639,8 +1637,7 @@ and then calls `idlwave-shell-send-command' for any pending commands."
1639 (idlwave-shell-cleanup) 1637 (idlwave-shell-cleanup)
1640 ;; Run the hook, if possible in the shell buffer. 1638 ;; Run the hook, if possible in the shell buffer.
1641 (if (get-buffer buf) 1639 (if (get-buffer buf)
1642 (save-excursion 1640 (with-current-buffer buf
1643 (set-buffer buf)
1644 (run-hooks 'idlwave-shell-sentinel-hook)) 1641 (run-hooks 'idlwave-shell-sentinel-hook))
1645 (run-hooks 'idlwave-shell-sentinel-hook)))) 1642 (run-hooks 'idlwave-shell-sentinel-hook))))
1646 1643
@@ -2088,13 +2085,12 @@ HEAP_GC, /VERBOSE"
2088(defun idlwave-shell-filter-directory () 2085(defun idlwave-shell-filter-directory ()
2089 "Get the current directory from `idlwave-shell-command-output'. 2086 "Get the current directory from `idlwave-shell-command-output'.
2090Change the default directory for the process buffer to concur." 2087Change the default directory for the process buffer to concur."
2091 (save-excursion 2088 (with-current-buffer (idlwave-shell-buffer)
2092 (set-buffer (idlwave-shell-buffer))
2093 (if (string-match ",___cur[\n\r ]+\\([^\n\r]+\\)[\n\r]" 2089 (if (string-match ",___cur[\n\r ]+\\([^\n\r]+\\)[\n\r]"
2094 idlwave-shell-command-output) 2090 idlwave-shell-command-output)
2095 (let ((dir (substring idlwave-shell-command-output 2091 (let ((dir (substring idlwave-shell-command-output
2096 (match-beginning 1) (match-end 1)))) 2092 (match-beginning 1) (match-end 1))))
2097; (message "Setting Emacs working dir to %s" dir) 2093 ;; (message "Setting Emacs working dir to %s" dir)
2098 (setq idlwave-shell-default-directory dir) 2094 (setq idlwave-shell-default-directory dir)
2099 (setq default-directory (file-name-as-directory dir)))))) 2095 (setq default-directory (file-name-as-directory dir))))))
2100 2096
@@ -2363,10 +2359,10 @@ matter what the settings of that variable."
2363 ;; fixme: errors are dangerous in shell filters. but i think i 2359 ;; fixme: errors are dangerous in shell filters. but i think i
2364 ;; have never encountered this one. 2360 ;; have never encountered this one.
2365 (error "invalid frame - unable to access file: %s" (car frame)) 2361 (error "invalid frame - unable to access file: %s" (car frame))
2366;;; 2362 ;;
2367;;; buffer : the buffer to display a line in. 2363 ;; buffer : the buffer to display a line in.
2368;;; select-shell: current buffer is the shell. 2364 ;; select-shell: current buffer is the shell.
2369;;; 2365 ;;
2370 (setq idlwave-shell-mode-line-info 2366 (setq idlwave-shell-mode-line-info
2371 (if (nth 2 frame) 2367 (if (nth 2 frame)
2372 (format "[%d:%s]" 2368 (format "[%d:%s]"
@@ -2385,8 +2381,7 @@ matter what the settings of that variable."
2385 nil (idlwave-shell-source-frame))) 2381 nil (idlwave-shell-source-frame)))
2386 2382
2387 ;; enter the buffer and mark the line 2383 ;; enter the buffer and mark the line
2388 (save-excursion 2384 (with-current-buffer buffer
2389 (set-buffer buffer)
2390 (save-restriction 2385 (save-restriction
2391 (widen) 2386 (widen)
2392 (goto-char (point-min)) 2387 (goto-char (point-min))
@@ -2713,8 +2708,7 @@ Assumes that `idlwave-shell-sources-alist' contains an entry for that module."
2713 (message "The source file for module %s is probably not compiled" 2708 (message "The source file for module %s is probably not compiled"
2714 module) 2709 module)
2715 (beep)) 2710 (beep))
2716 (save-excursion 2711 (with-current-buffer buf
2717 (set-buffer buf)
2718 (save-excursion 2712 (save-excursion
2719 (goto-char (point-min)) 2713 (goto-char (point-min))
2720 (let ((case-fold-search t)) 2714 (let ((case-fold-search t))
@@ -2822,8 +2816,8 @@ Runs to the last statement and then steps 1 statement. Use the .out command."
2822 (idlwave-shell-print (if (idlwave-region-active-p) '(4) nil) 2816 (idlwave-shell-print (if (idlwave-region-active-p) '(4) nil)
2823 ,help ,ev)))) 2817 ,help ,ev))))
2824 2818
2825;;; Begin terrible hack section -- XEmacs tests for button2 explicitly 2819;; Begin terrible hack section -- XEmacs tests for button2 explicitly
2826;;; on drag events, calling drag-n-drop code if detected. Ughhh... 2820;; on drag events, calling drag-n-drop code if detected. Ughhh...
2827(defun idlwave-default-mouse-track-event-is-with-button (event n) 2821(defun idlwave-default-mouse-track-event-is-with-button (event n)
2828 t) 2822 t)
2829 2823
@@ -3035,8 +3029,7 @@ from `idlwave-shell-examine-alist' via mini-buffer shortcut key."
3035(defun idlwave-shell-examine-display () 3029(defun idlwave-shell-examine-display ()
3036 "View the examine command output in a separate buffer." 3030 "View the examine command output in a separate buffer."
3037 (let (win cur-beg cur-end) 3031 (let (win cur-beg cur-end)
3038 (save-excursion 3032 (with-current-buffer (get-buffer-create "*Examine*")
3039 (set-buffer (get-buffer-create "*Examine*"))
3040 (use-local-map idlwave-shell-examine-map) 3033 (use-local-map idlwave-shell-examine-map)
3041 (setq buffer-read-only nil) 3034 (setq buffer-read-only nil)
3042 (goto-char (point-max)) 3035 (goto-char (point-max))
@@ -3121,13 +3114,11 @@ from `idlwave-shell-examine-alist' via mini-buffer shortcut key."
3121 3114
3122(defun idlwave-shell-examine-display-clear () 3115(defun idlwave-shell-examine-display-clear ()
3123 (interactive) 3116 (interactive)
3124 (save-excursion 3117 (let ((buf (get-buffer "*Examine*")))
3125 (let ((buf (get-buffer "*Examine*"))) 3118 (when (bufferp buf)
3126 (when (bufferp buf) 3119 (with-current-buffer buf
3127 (set-buffer buf) 3120 (let ((inhibit-read-only t))
3128 (setq buffer-read-only nil) 3121 (erase-buffer))))))
3129 (erase-buffer)
3130 (setq buffer-read-only t)))))
3131 3122
3132(defun idlwave-retrieve-expression-from-level (expr level) 3123(defun idlwave-retrieve-expression-from-level (expr level)
3133 "Return IDL command to print the expression EXPR from stack level LEVEL. 3124 "Return IDL command to print the expression EXPR from stack level LEVEL.
@@ -3222,8 +3213,7 @@ size(___,/DIMENSIONS)"
3222 (process (get-buffer-process buffer)) 3213 (process (get-buffer-process buffer))
3223 (process-mark (if process (process-mark process))) 3214 (process-mark (if process (process-mark process)))
3224 output-begin output-end) 3215 output-begin output-end)
3225 (save-excursion 3216 (with-current-buffer buffer
3226 (set-buffer buffer)
3227 (goto-char process-mark) 3217 (goto-char process-mark)
3228 (beginning-of-line) 3218 (beginning-of-line)
3229 (setq output-end (point)) 3219 (setq output-end (point))
@@ -3295,9 +3285,8 @@ An END statement is appended to the region if necessary.
3295If there is a prefix argument, display IDL process." 3285If there is a prefix argument, display IDL process."
3296 (interactive "r\nP") 3286 (interactive "r\nP")
3297 (let ((oldbuf (current-buffer))) 3287 (let ((oldbuf (current-buffer)))
3298 (save-excursion 3288 (with-current-buffer (idlwave-find-file-noselect
3299 (set-buffer (idlwave-find-file-noselect 3289 (idlwave-shell-temp-file 'pro) 'tmp)
3300 (idlwave-shell-temp-file 'pro) 'tmp))
3301 (set (make-local-variable 'comment-start-skip) ";+[ \t]*") 3290 (set (make-local-variable 'comment-start-skip) ";+[ \t]*")
3302 (set (make-local-variable 'comment-start) ";") 3291 (set (make-local-variable 'comment-start) ";")
3303 (erase-buffer) 3292 (erase-buffer)
@@ -3410,8 +3399,7 @@ of 'count, 'cmd and 'condition. Defaults to 'index."
3410Create `idlwave-shell-bp-alist' updating breakpoint count and command 3399Create `idlwave-shell-bp-alist' updating breakpoint count and command
3411data from previous breakpoint list. If NO-SHOW is set, don't update 3400data from previous breakpoint list. If NO-SHOW is set, don't update
3412the breakpoint overlays." 3401the breakpoint overlays."
3413 (save-excursion 3402 (with-current-buffer (get-buffer-create idlwave-shell-bp-buffer)
3414 (set-buffer (get-buffer-create idlwave-shell-bp-buffer))
3415 (erase-buffer) 3403 (erase-buffer)
3416 (insert idlwave-shell-command-output) 3404 (insert idlwave-shell-command-output)
3417 (goto-char (point-min)) 3405 (goto-char (point-min))
@@ -3914,8 +3902,7 @@ handled by this command."
3914 (idlwave-shell-last-save-and-action-file 3902 (idlwave-shell-last-save-and-action-file
3915 (if (setq buf (idlwave-get-buffer-visiting 3903 (if (setq buf (idlwave-get-buffer-visiting
3916 idlwave-shell-last-save-and-action-file)) 3904 idlwave-shell-last-save-and-action-file))
3917 (save-excursion 3905 (with-current-buffer buf
3918 (set-buffer buf)
3919 (save-buffer)))) 3906 (save-buffer))))
3920 (t (setq idlwave-shell-last-save-and-action-file 3907 (t (setq idlwave-shell-last-save-and-action-file
3921 (read-file-name "File: "))))) 3908 (read-file-name "File: ")))))
@@ -3995,8 +3982,7 @@ Queries IDL using the string in `idlwave-shell-sources-query'."
3995Create `idlwave-shell-sources-alist' consisting of list elements 3982Create `idlwave-shell-sources-alist' consisting of list elements
3996of the form: 3983of the form:
3997 (module name . (source-file-truename idlwave-internal-filename))" 3984 (module name . (source-file-truename idlwave-internal-filename))"
3998 (save-excursion 3985 (with-current-buffer (get-buffer-create idlwave-shell-bp-buffer)
3999 (set-buffer (get-buffer-create idlwave-shell-bp-buffer))
4000 (erase-buffer) 3986 (erase-buffer)
4001 (insert idlwave-shell-command-output) 3987 (insert idlwave-shell-command-output)
4002 (goto-char (point-min)) 3988 (goto-char (point-min))
@@ -4068,8 +4054,7 @@ of the form:
4068 "Move point to next IDL syntax error." 4054 "Move point to next IDL syntax error."
4069 (interactive) 4055 (interactive)
4070 (let (frame col) 4056 (let (frame col)
4071 (save-excursion 4057 (with-current-buffer idlwave-shell-error-buffer
4072 (set-buffer idlwave-shell-error-buffer)
4073 (goto-char idlwave-shell-error-last) 4058 (goto-char idlwave-shell-error-last)
4074 (if (or 4059 (if (or
4075 (re-search-forward idlwave-shell-syntax-error nil t) 4060 (re-search-forward idlwave-shell-syntax-error nil t)
@@ -4526,14 +4511,13 @@ idlwave-shell-electric-debug-mode-map)
4526 (easy-menu-define 4511 (easy-menu-define
4527 idlwave-shell-mode-menu idlwave-shell-mode-map "IDL shell menus" 4512 idlwave-shell-mode-menu idlwave-shell-mode-map "IDL shell menus"
4528 idlwave-shell-menu-def) 4513 idlwave-shell-menu-def)
4529 (save-excursion 4514 (save-current-buffer
4530 (mapc (lambda (buf) 4515 (dolist (buf (buffer-list))
4531 (set-buffer buf) 4516 (set-buffer buf)
4532 (if (eq major-mode 'idlwave-mode) 4517 (if (eq major-mode 'idlwave-mode)
4533 (progn 4518 (progn
4534 (easy-menu-remove idlwave-mode-debug-menu) 4519 (easy-menu-remove idlwave-mode-debug-menu)
4535 (easy-menu-add idlwave-mode-debug-menu)))) 4520 (easy-menu-add idlwave-mode-debug-menu)))))))
4536 (buffer-list)))))
4537 4521
4538;; The Breakpoint Glyph ------------------------------------------------------- 4522;; The Breakpoint Glyph -------------------------------------------------------
4539 4523
@@ -4694,7 +4678,7 @@ static char * file[] = {
4694(provide 'idlw-shell) 4678(provide 'idlw-shell)
4695(provide 'idlwave-shell) 4679(provide 'idlwave-shell)
4696 4680
4697;;; Load the toolbar when wanted by the user. 4681;; Load the toolbar when wanted by the user.
4698 4682
4699(autoload 'idlwave-toolbar-toggle "idlw-toolbar" 4683(autoload 'idlwave-toolbar-toggle "idlw-toolbar"
4700 "Toggle the IDLWAVE toolbar.") 4684 "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.
5512 idlwave-path-alist path-alist ; for library-path instead 5512 idlwave-path-alist path-alist ; for library-path instead
5513 idlwave-true-path-alist nil) 5513 idlwave-true-path-alist nil)
5514 (if idlwave-auto-write-paths (idlwave-write-paths)) 5514 (if idlwave-auto-write-paths (idlwave-write-paths))
5515 (save-excursion 5515 (with-current-buffer (get-buffer-create "*idlwave-scan.pro*")
5516 (set-buffer (get-buffer-create "*idlwave-scan.pro*"))
5517 (idlwave-mode) 5516 (idlwave-mode)
5518 (setq dirs-alist (reverse path-alist)) 5517 (setq dirs-alist (reverse path-alist))
5519 (while (setq dir (pop dirs-alist)) 5518 (while (setq dir (pop dirs-alist))
@@ -5818,9 +5817,8 @@ end
5818(defun idlwave-shell-compile-helper-routines (&optional wait) 5817(defun idlwave-shell-compile-helper-routines (&optional wait)
5819 (unless (and idlwave-idlwave_routine_info-compiled 5818 (unless (and idlwave-idlwave_routine_info-compiled
5820 (file-readable-p (idlwave-shell-temp-file 'rinfo))) 5819 (file-readable-p (idlwave-shell-temp-file 'rinfo)))
5821 (save-excursion 5820 (with-current-buffer (idlwave-find-file-noselect
5822 (set-buffer (idlwave-find-file-noselect 5821 (idlwave-shell-temp-file 'pro))
5823 (idlwave-shell-temp-file 'pro)))
5824 (erase-buffer) 5822 (erase-buffer)
5825 (insert idlwave-routine-info.pro) 5823 (insert idlwave-routine-info.pro)
5826 (save-buffer 0)) 5824 (save-buffer 0))
@@ -7171,14 +7169,12 @@ If these don't exist, a letter in the string is automatically selected."
7171 7169
7172(defun idlwave-set-local (var value &optional buffer) 7170(defun idlwave-set-local (var value &optional buffer)
7173 "Set the buffer-local value of VAR in BUFFER to VALUE." 7171 "Set the buffer-local value of VAR in BUFFER to VALUE."
7174 (save-excursion 7172 (with-current-buffer (or buffer (current-buffer))
7175 (set-buffer (or buffer (current-buffer)))
7176 (set (make-local-variable var) value))) 7173 (set (make-local-variable var) value)))
7177 7174
7178(defun idlwave-local-value (var &optional buffer) 7175(defun idlwave-local-value (var &optional buffer)
7179 "Return the value of VAR in BUFFER, but only if VAR is local to BUFFER." 7176 "Return the value of VAR in BUFFER, but only if VAR is local to BUFFER."
7180 (save-excursion 7177 (with-current-buffer (or buffer (current-buffer))
7181 (set-buffer (or buffer (current-buffer)))
7182 (and (local-variable-p var (current-buffer)) 7178 (and (local-variable-p var (current-buffer))
7183 (symbol-value var)))) 7179 (symbol-value var))))
7184 7180
@@ -7194,8 +7190,7 @@ If these don't exist, a letter in the string is automatically selected."
7194 (apply 'display-completion-list list 7190 (apply 'display-completion-list list
7195 ':activate-callback 'idlwave-default-choose-completion 7191 ':activate-callback 'idlwave-default-choose-completion
7196 cl-args)) 7192 cl-args))
7197 (save-excursion 7193 (with-current-buffer "*Completions*"
7198 (set-buffer "*Completions*")
7199 (use-local-map 7194 (use-local-map
7200 (or idlwave-completion-map 7195 (or idlwave-completion-map
7201 (setq idlwave-completion-map 7196 (setq idlwave-completion-map
@@ -7222,8 +7217,7 @@ If these don't exist, a letter in the string is automatically selected."
7222 "Display completion list and install the choose wrappers." 7217 "Display completion list and install the choose wrappers."
7223 (with-output-to-temp-buffer "*Completions*" 7218 (with-output-to-temp-buffer "*Completions*"
7224 (display-completion-list list)) 7219 (display-completion-list list))
7225 (save-excursion 7220 (with-current-buffer "*Completions*"
7226 (set-buffer "*Completions*")
7227 (use-local-map 7221 (use-local-map
7228 (or idlwave-completion-map 7222 (or idlwave-completion-map
7229 (setq idlwave-completion-map 7223 (setq idlwave-completion-map
@@ -7837,8 +7831,7 @@ associated TAG, if any."
7837(defun idlwave-completion-fontify-classes () 7831(defun idlwave-completion-fontify-classes ()
7838 "Goto the *Completions* buffer and fontify the class info." 7832 "Goto the *Completions* buffer and fontify the class info."
7839 (when (featurep 'font-lock) 7833 (when (featurep 'font-lock)
7840 (save-excursion 7834 (with-current-buffer "*Completions*"
7841 (set-buffer "*Completions*")
7842 (save-excursion 7835 (save-excursion
7843 (goto-char (point-min)) 7836 (goto-char (point-min))
7844 (let ((buffer-read-only nil)) 7837 (let ((buffer-read-only nil))
@@ -8385,9 +8378,8 @@ If we do not know about MODULE, just return KEYWORD literally."
8385 ((null calling-seq) 8378 ((null calling-seq)
8386 (error "Calling sequence of %s %s not available" type name)) 8379 (error "Calling sequence of %s %s not available" type name))
8387 (t 8380 (t
8388 (save-excursion 8381 (move-marker idlwave-rinfo-marker (point))
8389 (move-marker idlwave-rinfo-marker (point)) 8382 (with-current-buffer (get-buffer-create "*Help*")
8390 (set-buffer (get-buffer-create "*Help*"))
8391 (use-local-map idlwave-rinfo-map) 8383 (use-local-map idlwave-rinfo-map)
8392 (setq buffer-read-only nil) 8384 (setq buffer-read-only nil)
8393 (erase-buffer) 8385 (erase-buffer)
@@ -8755,8 +8747,7 @@ can be used to detect possible name clashes during this process."
8755 (apply 'idlwave-do-find-module 8747 (apply 'idlwave-do-find-module
8756 (get-text-property (point) 'find-args)))) 8748 (get-text-property (point) 'find-args))))
8757 (message "Compiling list...( 0%%)") 8749 (message "Compiling list...( 0%%)")
8758 (save-excursion 8750 (with-current-buffer (get-buffer-create "*Shadows*")
8759 (set-buffer (get-buffer-create "*Shadows*"))
8760 (setq buffer-read-only nil) 8751 (setq buffer-read-only nil)
8761 (erase-buffer) 8752 (erase-buffer)
8762 (while (setq routine (pop routines)) 8753 (while (setq routine (pop routines))
@@ -9358,8 +9349,7 @@ This function was written since `list-abbrevs' looks terrible for IDLWAVE mode."
9358 (princ (format fmt str rpl func))) 9349 (princ (format fmt str rpl func)))
9359 abbrevs))) 9350 abbrevs)))
9360 ;; Make sure each abbreviation uses only one display line 9351 ;; Make sure each abbreviation uses only one display line
9361 (save-excursion 9352 (with-current-buffer "*Help*"
9362 (set-buffer "*Help*")
9363 (setq truncate-lines t))) 9353 (setq truncate-lines t)))
9364 9354
9365;; Add .pro files to speedbar for support, if it's loaded 9355;; 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'."
178 (get-buffer-create buffer) 178 (get-buffer-create buffer)
179 (if (comint-check-proc buffer) 179 (if (comint-check-proc buffer)
180 () 180 ()
181 (save-excursion 181 (with-current-buffer buffer
182 (set-buffer buffer)
183 (comint-mode) 182 (comint-mode)
184 (inferior-octave-startup) 183 (inferior-octave-startup)
185 (inferior-octave-mode))) 184 (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."
2654 ;; Add in number of lines for leading '##' comments: 2654 ;; Add in number of lines for leading '##' comments:
2655 (setq lineno 2655 (setq lineno
2656 (+ lineno 2656 (+ lineno
2657 (save-excursion 2657 (with-current-buffer funcbuffer
2658 (set-buffer funcbuffer)
2659 (if (equal (point-min)(point-max)) 2658 (if (equal (point-min)(point-max))
2660 0 2659 0
2661 (count-lines 2660 (count-lines
@@ -2683,13 +2682,12 @@ problem."
2683 (while (and buffers (not got)) 2682 (while (and buffers (not got))
2684 (setq buf (car buffers) 2683 (setq buf (car buffers)
2685 buffers (cdr buffers)) 2684 buffers (cdr buffers))
2686 (if (and (save-excursion (set-buffer buf) 2685 (if (and (with-current-buffer buf
2687 (string= major-mode "python-mode")) 2686 (string= major-mode "python-mode"))
2688 (or (string-match funcname (buffer-name buf)) 2687 (or (string-match funcname (buffer-name buf))
2689 (string-match (concat "^\\s-*\\(def\\|class\\)\\s-+" 2688 (string-match (concat "^\\s-*\\(def\\|class\\)\\s-+"
2690 funcname "\\s-*(") 2689 funcname "\\s-*(")
2691 (save-excursion 2690 (with-current-buffer buf
2692 (set-buffer buf)
2693 (buffer-substring (point-min) 2691 (buffer-substring (point-min)
2694 (point-max)))))) 2692 (point-max))))))
2695 (setq got buf))) 2693 (setq got buf)))
@@ -2747,8 +2745,7 @@ comint believe the user typed this string so that
2747 ;; add some comment, so that we can filter it out of history 2745 ;; add some comment, so that we can filter it out of history
2748 (cmd (format "execfile(r'%s') # PYTHON-MODE\n" filename))) 2746 (cmd (format "execfile(r'%s') # PYTHON-MODE\n" filename)))
2749 (unwind-protect 2747 (unwind-protect
2750 (save-excursion 2748 (with-current-buffer procbuf
2751 (set-buffer procbuf)
2752 (goto-char (point-max)) 2749 (goto-char (point-max))
2753 (move-marker (process-mark proc) (point)) 2750 (move-marker (process-mark proc) (point))
2754 (funcall (process-filter proc) proc msg)) 2751 (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."
2978;; 2978;;
2979;; (defun what-i-learned (list) 2979;; (defun what-i-learned (list)
2980;; (let ((p list)) 2980;; (let ((p list))
2981;; (save-excursion 2981;; (with-current-buffer "*scratch*"
2982;; (set-buffer "*scratch*")
2983;; (goto-char (point-max)) 2982;; (goto-char (point-max))
2984;; (insert "(setq\n") 2983;; (insert "(setq\n")
2985;; (while p 2984;; (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."
7137 uses-delayed) ;; Found signal/rvalue; push if not function 7137 uses-delayed) ;; Found signal/rvalue; push if not function
7138 (search-forward ")") 7138 (search-forward ")")
7139 (verilog-read-always-signals-recurse nil nil nil) 7139 (verilog-read-always-signals-recurse nil nil nil)
7140 ;;(if dbg (save-excursion (set-buffer (get-buffer-create "*vl-dbg*")) (delete-region (point-min) (point-max)) (insert dbg) (setq dbg ""))) 7140 ;;(if dbg (with-current-buffer (get-buffer-create "*vl-dbg*")
7141 ;; (delete-region (point-min) (point-max))
7142 ;; (insert dbg)
7143 ;; (setq dbg "")))
7141 ;; Return what was found 7144 ;; Return what was found
7142 (list sigs-out nil sigs-in uses-delayed)))) 7145 (list sigs-out nil sigs-in uses-delayed))))
7143 7146
@@ -7249,8 +7252,7 @@ list of ( (signal_name connection_name)... )."
7249(defun verilog-set-define (defname defvalue &optional buffer enumname) 7252(defun verilog-set-define (defname defvalue &optional buffer enumname)
7250 "Set the definition DEFNAME to the DEFVALUE in the given BUFFER. 7253 "Set the definition DEFNAME to the DEFVALUE in the given BUFFER.
7251Optionally associate it with the specified enumeration ENUMNAME." 7254Optionally associate it with the specified enumeration ENUMNAME."
7252 (save-excursion 7255 (with-current-buffer (or buffer (current-buffer))
7253 (set-buffer (or buffer (current-buffer)))
7254 (let ((mac (intern (concat "vh-" defname)))) 7256 (let ((mac (intern (concat "vh-" defname))))
7255 ;;(message "Define %s=%s" defname defvalue) (sleep-for 1) 7257 ;;(message "Define %s=%s" defname defvalue) (sleep-for 1)
7256 ;; Need to define to a constant if no value given 7258 ;; 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."
7497 (forward-line 1) 7499 (forward-line 1)
7498 (when (string-match "//" line) 7500 (when (string-match "//" line)
7499 (setq line (substring line 0 (match-beginning 0)))) 7501 (setq line (substring line 0 (match-beginning 0))))
7500 (save-excursion 7502 ;; Variables are buffer-local, so need right context.
7501 (set-buffer orig-buffer) ; Variables are buffer-local, so need right context. 7503 (with-current-buffer orig-buffer
7502 (verilog-getopt line)))))) 7504 (verilog-getopt line))))))
7503 7505
7504(defun verilog-getopt-flags () 7506(defun verilog-getopt-flags ()
@@ -7599,11 +7601,11 @@ Allows version control to check out the file if need be."
7599 (and (fboundp 'vc-backend) 7601 (and (fboundp 'vc-backend)
7600 (vc-backend filename))) 7602 (vc-backend filename)))
7601 (let (pt) 7603 (let (pt)
7602 (save-excursion 7604 (with-current-buffer (find-file-noselect filename)
7603 (set-buffer (find-file-noselect filename))
7604 (goto-char (point-min)) 7605 (goto-char (point-min))
7605 (while (and 7606 (while (and
7606 ;; It may be tempting to look for verilog-defun-re, don't, it slows things down a lot! 7607 ;; It may be tempting to look for verilog-defun-re,
7608 ;; don't, it slows things down a lot!
7607 (verilog-re-search-forward-quick "\\<module\\>" nil t) 7609 (verilog-re-search-forward-quick "\\<module\\>" nil t)
7608 (verilog-re-search-forward-quick "[(;]" nil t)) 7610 (verilog-re-search-forward-quick "[(;]" nil t))
7609 (if (equal module (verilog-read-module-name)) 7611 (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."
264 (setq-default xscheme-buffer-name buffer-name) 264 (setq-default xscheme-buffer-name buffer-name)
265 (setq-default xscheme-process-name process-name) 265 (setq-default xscheme-process-name process-name)
266 (setq-default xscheme-runlight-string 266 (setq-default xscheme-runlight-string
267 (save-excursion (set-buffer buffer-name) 267 (with-current-buffer buffer-name
268 xscheme-runlight-string)) 268 xscheme-runlight-string))
269 (setq-default xscheme-runlight 269 (setq-default xscheme-runlight
270 (if (eq (process-status process-name) 'run) 270 (if (eq (process-status process-name) 'run)
271 default-xscheme-runlight 271 default-xscheme-runlight
@@ -283,8 +283,8 @@ With argument, asks for a command line."
283 (make-local-variable 'xscheme-process-name) 283 (make-local-variable 'xscheme-process-name)
284 (setq xscheme-process-name process-name) 284 (setq xscheme-process-name process-name)
285 (make-local-variable 'xscheme-runlight) 285 (make-local-variable 'xscheme-runlight)
286 (setq xscheme-runlight (save-excursion (set-buffer buffer-name) 286 (setq xscheme-runlight (with-current-buffer buffer-name
287 xscheme-runlight)))) 287 xscheme-runlight))))
288 288
289(defun local-clear-scheme-interaction-buffer () 289(defun local-clear-scheme-interaction-buffer ()
290 "Make the current buffer use the default scheme interaction buffer." 290 "Make the current buffer use the default scheme interaction buffer."
@@ -305,8 +305,7 @@ With argument, asks for a command line."
305 ((not process) 305 ((not process)
306 (error "Buffer `%s' is not a scheme interaction buffer" buffer-name)) 306 (error "Buffer `%s' is not a scheme interaction buffer" buffer-name))
307 (t 307 (t
308 (save-excursion 308 (with-current-buffer buffer
309 (set-buffer buffer)
310 (if (not (xscheme-process-buffer-current-p)) 309 (if (not (xscheme-process-buffer-current-p))
311 (error "Buffer `%s' is not a scheme interaction buffer" 310 (error "Buffer `%s' is not a scheme interaction buffer"
312 buffer-name))) 311 buffer-name)))
@@ -469,8 +468,7 @@ with no args, if that value is non-nil.
469 (scheme-interaction-mode-commands scheme-interaction-mode-map))) 468 (scheme-interaction-mode-commands scheme-interaction-mode-map)))
470 469
471(defun xscheme-enter-interaction-mode () 470(defun xscheme-enter-interaction-mode ()
472 (save-excursion 471 (with-current-buffer (xscheme-process-buffer)
473 (set-buffer (xscheme-process-buffer))
474 (if (not (eq major-mode 'scheme-interaction-mode)) 472 (if (not (eq major-mode 'scheme-interaction-mode))
475 (if (eq major-mode 'scheme-debugger-mode) 473 (if (eq major-mode 'scheme-debugger-mode)
476 (scheme-interaction-mode-initialize) 474 (scheme-interaction-mode-initialize)
@@ -519,8 +517,7 @@ Commands:
519 (xscheme-send-char last-command-event)) 517 (xscheme-send-char last-command-event))
520 518
521(defun xscheme-enter-debugger-mode (prompt-string) 519(defun xscheme-enter-debugger-mode (prompt-string)
522 (save-excursion 520 (with-current-buffer (xscheme-process-buffer)
523 (set-buffer (xscheme-process-buffer))
524 (if (not (eq major-mode 'scheme-debugger-mode)) 521 (if (not (eq major-mode 'scheme-debugger-mode))
525 (progn 522 (progn
526 (if (not (eq major-mode 'scheme-interaction-mode)) 523 (if (not (eq major-mode 'scheme-interaction-mode))
@@ -530,8 +527,7 @@ Commands:
530(defun xscheme-debugger-mode-p () 527(defun xscheme-debugger-mode-p ()
531 (let ((buffer (xscheme-process-buffer))) 528 (let ((buffer (xscheme-process-buffer)))
532 (and buffer 529 (and buffer
533 (save-excursion 530 (with-current-buffer buffer
534 (set-buffer buffer)
535 (eq major-mode 'scheme-debugger-mode))))) 531 (eq major-mode 'scheme-debugger-mode)))))
536 532
537;;;; Evaluation Commands 533;;;; Evaluation Commands
@@ -765,13 +761,11 @@ Control returns to the top level rep loop."
765 (let ((inhibit-quit t)) 761 (let ((inhibit-quit t))
766 (cond ((not xscheme-control-g-synchronization-p) 762 (cond ((not xscheme-control-g-synchronization-p)
767 (interrupt-process xscheme-process-name)) 763 (interrupt-process xscheme-process-name))
768 ((save-excursion 764 ((with-current-buffer xscheme-buffer-name
769 (set-buffer xscheme-buffer-name)
770 xscheme-control-g-disabled-p) 765 xscheme-control-g-disabled-p)
771 (message "Relax...")) 766 (message "Relax..."))
772 (t 767 (t
773 (save-excursion 768 (with-current-buffer xscheme-buffer-name
774 (set-buffer xscheme-buffer-name)
775 (setq xscheme-control-g-disabled-p t)) 769 (setq xscheme-control-g-disabled-p t))
776 (message xscheme-control-g-message-string) 770 (message xscheme-control-g-message-string)
777 (interrupt-process xscheme-process-name) 771 (interrupt-process xscheme-process-name)
@@ -807,8 +801,7 @@ Control returns to the top level rep loop."
807(defun xscheme-start-process (command-line the-process the-buffer) 801(defun xscheme-start-process (command-line the-process the-buffer)
808 (let ((buffer (get-buffer-create the-buffer))) 802 (let ((buffer (get-buffer-create the-buffer)))
809 (let ((process (get-buffer-process buffer))) 803 (let ((process (get-buffer-process buffer)))
810 (save-excursion 804 (with-current-buffer buffer
811 (set-buffer buffer)
812 (if (and process (memq (process-status process) '(run stop))) 805 (if (and process (memq (process-status process) '(run stop)))
813 (set-marker (process-mark process) (point-max)) 806 (set-marker (process-mark process) (point-max))
814 (progn (if process (delete-process process)) 807 (progn (if process (delete-process process))
@@ -944,8 +937,7 @@ the remaining input.")
944(defun xscheme-process-sentinel (proc reason) 937(defun xscheme-process-sentinel (proc reason)
945 (let* ((buffer (process-buffer proc)) 938 (let* ((buffer (process-buffer proc))
946 (name (buffer-name buffer))) 939 (name (buffer-name buffer)))
947 (save-excursion 940 (with-current-buffer buffer
948 (set-buffer buffer)
949 (xscheme-process-filter-initialize (eq reason 'run)) 941 (xscheme-process-filter-initialize (eq reason 'run))
950 (if (not (eq reason 'run)) 942 (if (not (eq reason 'run))
951 (progn 943 (progn
@@ -983,8 +975,7 @@ the remaining input.")
983 (call-noexcursion nil)) 975 (call-noexcursion nil))
984 (while xscheme-filter-input 976 (while xscheme-filter-input
985 (setq call-noexcursion nil) 977 (setq call-noexcursion nil)
986 (save-excursion 978 (with-current-buffer (process-buffer proc)
987 (set-buffer (process-buffer proc))
988 (cond ((eq xscheme-process-filter-state 'idle) 979 (cond ((eq xscheme-process-filter-state 'idle)
989 (let ((start (string-match "\e" xscheme-filter-input))) 980 (let ((start (string-match "\e" xscheme-filter-input)))
990 (if start 981 (if start
@@ -1193,8 +1184,7 @@ the remaining input.")
1193 string)) 1184 string))
1194 1185
1195(defun xscheme-cd (directory-string) 1186(defun xscheme-cd (directory-string)
1196 (save-excursion 1187 (with-current-buffer (xscheme-process-buffer)
1197 (set-buffer (xscheme-process-buffer))
1198 (cd directory-string))) 1188 (cd directory-string)))
1199 1189
1200(defun xscheme-prompt-for-confirmation (prompt-string) 1190(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."
1801 1801
1802(defun artist-clear-buffer (buf) 1802(defun artist-clear-buffer (buf)
1803 "Clear contents of buffer BUF." 1803 "Clear contents of buffer BUF."
1804 (save-excursion 1804 (with-current-buffer buf
1805 (set-buffer buf)
1806 (goto-char (point-min)) 1805 (goto-char (point-min))
1807 (delete-char (- (point-max) (point-min)) nil))) 1806 (delete-char (- (point-max) (point-min)) nil)))
1808 1807
@@ -1848,10 +1847,8 @@ Return a list (RETURN-CODE STDOUT STDERR)."
1848 1847
1849 ;; the return value 1848 ;; the return value
1850 (list res 1849 (list res
1851 (save-excursion 1850 (with-current-buffer tmp-stdout-buffer
1852 (set-buffer tmp-stdout-buffer) 1851 (buffer-substring (point-min) (point-max)))
1853 (copy-sequence (buffer-substring (point-min)
1854 (point-max))))
1855 (artist-file-to-string tmp-stderr-file-name))) 1852 (artist-file-to-string tmp-stderr-file-name)))
1856 1853
1857 ;; Unwind: remove temporary files and buffers 1854 ;; 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'."
228 228
229(defun bib-capitalize-title (s) 229(defun bib-capitalize-title (s)
230 "Like `capitalize', but don't capitalize stop words, except the first." 230 "Like `capitalize', but don't capitalize stop words, except the first."
231 (save-excursion 231 (with-current-buffer (get-buffer-create "$$$Scratch$$$")
232 (set-buffer (get-buffer-create "$$$Scratch$$$")) 232 (erase-buffer)
233 (erase-buffer) 233 (insert s)
234 (insert s) 234 (bib-capitalize-title-region (point-min) (point-max))
235 (bib-capitalize-title-region (point-min) (point-max)) 235 (buffer-string)))
236 (buffer-string)))
237 236
238(provide 'bib-mode) 237(provide 'bib-mode)
239 238
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."
3863 buffer-key-list current-buf current-keys error-list) 3863 buffer-key-list current-buf current-keys error-list)
3864 ;; Check for duplicate keys within BibTeX buffer 3864 ;; Check for duplicate keys within BibTeX buffer
3865 (dolist (buffer buffer-list) 3865 (dolist (buffer buffer-list)
3866 (save-excursion 3866 (with-current-buffer buffer
3867 (set-buffer buffer)
3868 (let (entry-type key key-list) 3867 (let (entry-type key key-list)
3869 (goto-char (point-min)) 3868 (goto-char (point-min))
3870 (while (re-search-forward bibtex-entry-head nil t) 3869 (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."
580 ;; `standard-output' to the buffer named as its first argument, 580 ;; `standard-output' to the buffer named as its first argument,
581 ;; but does not switch to that buffer. 581 ;; but does not switch to that buffer.
582 (with-output-to-temp-buffer pages-directory-buffer 582 (with-output-to-temp-buffer pages-directory-buffer
583 (save-excursion 583 (with-current-buffer standard-output
584 (set-buffer standard-output)
585 (pages-directory-mode) 584 (pages-directory-mode)
586 (insert 585 (insert
587 "==== Pages Directory: use `C-c C-c' to go to page under cursor. ====" ?\n) 586 "==== 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."
736(defun pages-directory-goto-with-mouse (event) 735(defun pages-directory-goto-with-mouse (event)
737 "Go to the corresponding line under the mouse pointer in the pages buffer." 736 "Go to the corresponding line under the mouse pointer in the pages buffer."
738 (interactive "e") 737 (interactive "e")
739 (save-excursion 738 (with-current-buffer (window-buffer (posn-window (event-end event)))
740 (set-buffer (window-buffer (posn-window (event-end event))))
741 (save-excursion 739 (save-excursion
742 (goto-char (posn-point (event-end event))) 740 (goto-char (posn-point (event-end event)))
743 (pages-directory-goto)))) 741 (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'.")
170 170
171(defun r2b-capitalize-title (s) 171(defun r2b-capitalize-title (s)
172 "Like `capitalize', but don't capitalize stop words, except the first." 172 "Like `capitalize', but don't capitalize stop words, except the first."
173 (save-excursion 173 (with-current-buffer (get-buffer-create "$$$Scratch$$$")
174 (set-buffer (get-buffer-create "$$$Scratch$$$")) 174 (erase-buffer)
175 (erase-buffer) 175 (insert s)
176 (insert s) 176 (r2b-capitalize-title-region (point-min) (point-max))
177 (r2b-capitalize-title-region (point-min) (point-max)) 177 (buffer-string)))
178 (buffer-string)))
179 178
180;********************************************************* 179;*********************************************************
181(defun r2b-reset () 180(defun r2b-reset ()
@@ -681,22 +680,19 @@ Do `\\[r2b-help]' for more info."
681 680
682 681
683(defun r2b-convert-buffer (output) 682(defun r2b-convert-buffer (output)
684 "Transform current buffer and append to buffer OUTPUT. 683 "Transform current buffer and append to buffer OUTPUT.
685Do `\\[r2b-help]' for more info." 684Do `\\[r2b-help]' for more info."
686 (interactive 685 (interactive
687 (list (read-string "Output to buffer: " r2b-out-buf-name))) 686 (list (read-string "Output to buffer: " r2b-out-buf-name)))
688 (save-excursion 687 (with-current-buffer (setq r2b-log (get-buffer-create r2b-log-name))
689 (setq r2b-log (get-buffer-create r2b-log-name)) 688 (erase-buffer))
690 (set-buffer r2b-log) 689 (widen)
691 (erase-buffer)) 690 (goto-char (point-min))
692 (widen) 691 (message "Working, please be patient...")
693 (goto-char (point-min)) 692 (sit-for 0)
694 (message "Working, please be patient...") 693 (while (r2b-convert-record output) t)
695 (sit-for 0) 694 (message "Done, results in %s, errors in %s"
696 (while (r2b-convert-record output) t) 695 r2b-out-buf-name r2b-log-name))
697 (message "Done, results in %s, errors in %s"
698 r2b-out-buf-name r2b-log-name)
699 )
700 696
701(defvar r2b-help-message 697(defvar r2b-help-message
702" Refer to Bibtex Bibliography Conversion 698" Refer to Bibtex Bibliography Conversion
@@ -740,13 +736,12 @@ Please send bug reports and suggestions to
740 736
741 737
742(defun r2b-help () 738(defun r2b-help ()
743 "Print help describing the `refbib' package." 739 "Print help describing the `refbib' package."
744 (interactive) 740 (interactive)
745 (with-output-to-temp-buffer "*Help*" 741 (with-output-to-temp-buffer "*Help*"
746 (princ r2b-help-message) 742 (princ r2b-help-message)
747 (save-excursion 743 (with-current-buffer standard-output
748 (set-buffer standard-output) 744 (help-mode))))
749 (help-mode))))
750 745
751(provide 'refbib) 746(provide 'refbib)
752(provide 'refer-to-bibtex) 747(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 @@
356 (error "No such file %s" file)) 356 (error "No such file %s" file))
357 (message "Scanning thebibliography environment in %s" file) 357 (message "Scanning thebibliography environment in %s" file)
358 358
359 (save-excursion 359 (with-current-buffer buf
360 (set-buffer buf)
361 (save-restriction 360 (save-restriction
362 (widen) 361 (widen)
363 (goto-char (point-min)) 362 (goto-char (point-min))
@@ -1076,8 +1075,7 @@ While entering the regexp, completion on knows citation keys is possible.
1076 bibfile-list item bibtype) 1075 bibfile-list item bibtype)
1077 1076
1078 (catch 'exit 1077 (catch 'exit
1079 (save-excursion 1078 (with-current-buffer reftex-call-back-to-this-buffer
1080 (set-buffer reftex-call-back-to-this-buffer)
1081 (setq bibtype (reftex-bib-or-thebib)) 1079 (setq bibtype (reftex-bib-or-thebib))
1082 (cond 1080 (cond
1083 ((eq bibtype 'bib) 1081 ((eq bibtype 'bib)
@@ -1109,7 +1107,7 @@ While entering the regexp, completion on knows citation keys is possible.
1109(defun reftex-all-used-citation-keys () 1107(defun reftex-all-used-citation-keys ()
1110 (reftex-access-scan-info) 1108 (reftex-access-scan-info)
1111 (let ((files (reftex-all-document-files)) file keys kk k) 1109 (let ((files (reftex-all-document-files)) file keys kk k)
1112 (save-excursion 1110 (save-current-buffer
1113 (while (setq file (pop files)) 1111 (while (setq file (pop files))
1114 (set-buffer (reftex-get-file-buffer-force file 'mark)) 1112 (set-buffer (reftex-get-file-buffer-force file 'mark))
1115 (save-excursion 1113 (save-excursion
@@ -1137,7 +1135,7 @@ The sequence in the new file is the same as it was in the old database."
1137 (let ((keys (reftex-all-used-citation-keys)) 1135 (let ((keys (reftex-all-used-citation-keys))
1138 (files (reftex-get-bibfile-list)) 1136 (files (reftex-get-bibfile-list))
1139 file key entries beg end entry) 1137 file key entries beg end entry)
1140 (save-excursion 1138 (save-current-buffer
1141 (while (setq file (pop files)) 1139 (while (setq file (pop files))
1142 (set-buffer (reftex-get-file-buffer-force file 'mark)) 1140 (set-buffer (reftex-get-file-buffer-force file 'mark))
1143 (reftex-with-special-syntax-for-bib 1141 (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."
276 (message "ref(%s): %s" (nth 1 entry) (nth 2 entry))) 276 (message "ref(%s): %s" (nth 1 entry) (nth 2 entry)))
277 (let ((buf (get-buffer " *Echo Area*"))) 277 (let ((buf (get-buffer " *Echo Area*")))
278 (when buf 278 (when buf
279 (save-excursion 279 (with-current-buffer buf
280 (set-buffer buf)
281 (run-hooks 'reftex-display-copied-context-hook))))))) 280 (run-hooks 'reftex-display-copied-context-hook)))))))
282 281
283(defun reftex-echo-cite (key files item) 282(defun reftex-echo-cite (key files item)
@@ -313,8 +312,7 @@ With argument, actually select the window showing the cross reference."
313 (unless (or (null string) (equal string "")) 312 (unless (or (null string) (equal string ""))
314 (message "cite: %s" string)) 313 (message "cite: %s" string))
315 (when (setq buf (get-buffer " *Echo Area*")) 314 (when (setq buf (get-buffer " *Echo Area*"))
316 (save-excursion 315 (with-current-buffer buf
317 (set-buffer buf)
318 (run-hooks 'reftex-display-copied-context-hook))))) 316 (run-hooks 'reftex-display-copied-context-hook)))))
319 317
320(defvar reftex-use-itimer-in-xemacs nil 318(defvar reftex-use-itimer-in-xemacs nil
@@ -373,7 +371,7 @@ Calling this function several times find successive citation locations."
373 ;; Establish connection to reference buffer 371 ;; Establish connection to reference buffer
374 (unless ref-buffer 372 (unless ref-buffer
375 (setq ref-buffer 373 (setq ref-buffer
376 (save-excursion 374 (save-current-buffer
377 (completing-read 375 (completing-read
378 "Reference buffer: " 376 "Reference buffer: "
379 (delq nil 377 (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'."
40 (files (reftex-all-document-files)) 40 (files (reftex-all-document-files))
41 (cmd (format "etags %s" (mapconcat 'shell-quote-argument 41 (cmd (format "etags %s" (mapconcat 'shell-quote-argument
42 files " ")))) 42 files " "))))
43 (save-excursion 43 (with-current-buffer (reftex-get-file-buffer-force master)
44 (set-buffer (reftex-get-file-buffer-force master))
45 (message "Running etags to create TAGS file...") 44 (message "Running etags to create TAGS file...")
46 (shell-command cmd) 45 (shell-command cmd)
47 (visit-tags-table "TAGS")))) 46 (visit-tags-table "TAGS"))))
@@ -314,7 +313,7 @@ labels."
314 (interactive) 313 (interactive)
315 (let ((files (reftex-all-document-files)) 314 (let ((files (reftex-all-document-files))
316 file buffer) 315 file buffer)
317 (save-excursion 316 (save-current-buffer
318 (while (setq file (pop files)) 317 (while (setq file (pop files))
319 (setq buffer (reftex-get-buffer-visiting file)) 318 (setq buffer (reftex-get-buffer-visiting file))
320 (when buffer 319 (when buffer
@@ -335,8 +334,7 @@ Also checks if buffers visiting the files are in read-only mode."
335 (or (y-or-n-p (format "No write access to %s. Continue? " file)) 334 (or (y-or-n-p (format "No write access to %s. Continue? " file))
336 (error "Abort"))) 335 (error "Abort")))
337 (when (and (setq buf (reftex-get-buffer-visiting file)) 336 (when (and (setq buf (reftex-get-buffer-visiting file))
338 (save-excursion 337 (with-current-buffer buf
339 (set-buffer buf)
340 buffer-read-only)) 338 buffer-read-only))
341 (ding) 339 (ding)
342 (or (y-or-n-p (format "Buffer %s is read-only. Continue? " 340 (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."
345 343
346;;; Multi-file RefTeX Isearch 344;;; Multi-file RefTeX Isearch
347 345
348;;; `reftex-isearch-wrap-function', `reftex-isearch-push-state-function', 346;; `reftex-isearch-wrap-function', `reftex-isearch-push-state-function',
349;;; `reftex-isearch-pop-state-function', `reftex-isearch-isearch-search' 347;; `reftex-isearch-pop-state-function', `reftex-isearch-isearch-search'
350;;; functions remain here only for backward-compatibility with Emacs 22 348;; functions remain here only for backward-compatibility with Emacs 22
351;;; and are obsolete since Emacs 23 that supports a single function 349;; and are obsolete since Emacs 23 that supports a single function
352;;; variable `multi-isearch-next-buffer-function'. 350;; variable `multi-isearch-next-buffer-function'.
353 351
354(defun reftex-isearch-wrap-function () 352(defun reftex-isearch-wrap-function ()
355 (if (not isearch-word) 353 (if (not isearch-word)
@@ -402,14 +400,14 @@ Also checks if buffers visiting the files are in read-only mode."
402 (point)) 400 (point))
403 (error nil)))))) 401 (error nil))))))
404 402
405;;; This function is called when isearch reaches the end of a 403;; This function is called when isearch reaches the end of a
406;;; buffer. For reftex what we want to do is not wrap to the 404;; buffer. For reftex what we want to do is not wrap to the
407;;; beginning, but switch to the next buffer in the logical order of 405;; beginning, but switch to the next buffer in the logical order of
408;;; the document. This function looks through list of files in the 406;; the document. This function looks through list of files in the
409;;; document (reftex-all-document-files), searches for the current 407;; document (reftex-all-document-files), searches for the current
410;;; buffer and switches to the next/previous one in the logical order 408;; buffer and switches to the next/previous one in the logical order
411;;; of the document. If WRAPP is true then wrap the search to the 409;; of the document. If WRAPP is true then wrap the search to the
412;;; beginning/end of the file list, depending of the search direction. 410;; beginning/end of the file list, depending of the search direction.
413(defun reftex-isearch-switch-to-next-file (crt-buf &optional wrapp) 411(defun reftex-isearch-switch-to-next-file (crt-buf &optional wrapp)
414 (reftex-access-scan-info) 412 (reftex-access-scan-info)
415 (let ((cb (buffer-file-name crt-buf)) 413 (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."
1012 (setq beg (match-beginning 0) end (match-end 0)) 1012 (setq beg (match-beginning 0) end (match-end 0))
1013 (setq old (nth 2 data)) 1013 (setq old (nth 2 data))
1014 (and (equal old new) (error "Entry unchanged")) 1014 (and (equal old new) (error "Entry unchanged"))
1015 (save-excursion 1015 (with-current-buffer (get-file-buffer (nth 3 data))
1016 (set-buffer (get-file-buffer (nth 3 data)))
1017 (goto-char beg) 1016 (goto-char beg)
1018 (unless (looking-at (regexp-quote old)) 1017 (unless (looking-at (regexp-quote old))
1019 (error "This should not happen (reftex-index-change-entry)")) 1018 (error "This should not happen (reftex-index-change-entry)"))
@@ -1594,7 +1593,7 @@ this function repeatedly."
1594 (while (re-search-forward re2 nil t) 1593 (while (re-search-forward re2 nil t)
1595 (push (cons (count-lines 1 (point)) (match-string 1)) superphrases) 1594 (push (cons (count-lines 1 (point)) (match-string 1)) superphrases)
1596 (incf ntimes2)))) 1595 (incf ntimes2))))
1597 (save-excursion 1596 (save-current-buffer
1598 (while (setq file (pop files)) 1597 (while (setq file (pop files))
1599 (setq buf (reftex-get-file-buffer-force file)) 1598 (setq buf (reftex-get-file-buffer-force file))
1600 (when buf 1599 (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."
78 file (not (eq t reftex-keep-temporary-buffers))))) 78 file (not (eq t reftex-keep-temporary-buffers)))))
79 (if (not buf) 79 (if (not buf)
80 (list label typekey "" file comment "LOST LABEL. RESCAN TO FIX.") 80 (list label typekey "" file comment "LOST LABEL. RESCAN TO FIX.")
81 (save-excursion 81 (with-current-buffer buf
82 (set-buffer buf)
83 (save-restriction 82 (save-restriction
84 (widen) 83 (widen)
85 (goto-char 1) 84 (goto-char 1)
@@ -538,8 +537,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
538 reftex-latex-syntax-table (syntax-table)) 537 reftex-latex-syntax-table (syntax-table))
539 (if reftex-use-multiple-selection-buffers 538 (if reftex-use-multiple-selection-buffers
540 (switch-to-buffer-other-window 539 (switch-to-buffer-other-window
541 (save-excursion 540 (with-current-buffer buf
542 (set-buffer buf)
543 (reftex-make-selection-buffer-name typekey))) 541 (reftex-make-selection-buffer-name typekey)))
544 (switch-to-buffer-other-window "*RefTeX Select*") 542 (switch-to-buffer-other-window "*RefTeX Select*")
545 (reftex-erase-buffer)) 543 (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.
90 ;; We do not set a local map - reftex-select-item does this. 90 ;; We do not set a local map - reftex-select-item does this.
91 (run-hooks 'reftex-select-bib-mode-hook)) 91 (run-hooks 'reftex-select-bib-mode-hook))
92 92
93;;; (defun reftex-get-offset (buf here-am-I &optional typekey toc index file) 93;; (defun reftex-get-offset (buf here-am-I &optional typekey toc index file)
94;;; ;; Find the correct offset data, like insert-docstruct would, but faster. 94;; ;; Find the correct offset data, like insert-docstruct would, but faster.
95;;; ;; Buffer BUF knows the correct docstruct to use. 95;; ;; Buffer BUF knows the correct docstruct to use.
96;;; ;; Basically this finds the first docstruct entry after HERE-I-AM which 96;; ;; Basically this finds the first docstruct entry after HERE-I-AM which
97;;; ;; is of allowed type. The optional arguments specify what is allowed. 97;; ;; is of allowed type. The optional arguments specify what is allowed.
98;;; (catch 'exit 98;; (catch 'exit
99;;; (save-excursion 99;; (with-current-buffer buf
100;;; (set-buffer buf) 100;; (reftex-access-scan-info)
101;;; (reftex-access-scan-info) 101;; (let* ((rest (memq here-am-I (symbol-value reftex-docstruct-symbol)))
102;;; (let* ((rest (memq here-am-I (symbol-value reftex-docstruct-symbol))) 102;; entry)
103;;; entry) 103;; (while (setq entry (pop rest))
104;;; (while (setq entry (pop rest)) 104;; (if (or (and typekey
105;;; (if (or (and typekey 105;; (stringp (car entry))
106;;; (stringp (car entry)) 106;; (or (equal typekey " ")
107;;; (or (equal typekey " ") 107;; (equal typekey (nth 1 entry))))
108;;; (equal typekey (nth 1 entry)))) 108;; (and toc (eq (car entry) 'toc))
109;;; (and toc (eq (car entry) 'toc)) 109;; (and index (eq (car entry) 'index))
110;;; (and index (eq (car entry) 'index)) 110;; (and file
111;;; (and file 111;; (memq (car entry) '(bof eof file-error))))
112;;; (memq (car entry) '(bof eof file-error)))) 112;; (throw 'exit entry)))
113;;; (throw 'exit entry))) 113;; nil))))
114;;; nil))))
115 114
116(defun reftex-get-offset (buf here-am-I &optional typekey toc index file) 115(defun reftex-get-offset (buf here-am-I &optional typekey toc index file)
117 ;; Find the correct offset data, like insert-docstruct would, but faster. 116 ;; Find the correct offset data, like insert-docstruct would, but faster.
@@ -119,8 +118,7 @@ During a selection process, these are the local bindings.
119 ;; Basically this finds the first docstruct entry before HERE-I-AM which 118 ;; Basically this finds the first docstruct entry before HERE-I-AM which
120 ;; is of allowed type. The optional arguments specify what is allowed. 119 ;; is of allowed type. The optional arguments specify what is allowed.
121 (catch 'exit 120 (catch 'exit
122 (save-excursion 121 (with-current-buffer buf
123 (set-buffer buf)
124 (reftex-access-scan-info) 122 (reftex-access-scan-info)
125 (let* ((rest (symbol-value reftex-docstruct-symbol)) 123 (let* ((rest (symbol-value reftex-docstruct-symbol))
126 lastentry entry) 124 lastentry entry)
@@ -178,8 +176,7 @@ During a selection process, these are the local bindings.
178 prev-inserted offset from to index-tag docstruct-symbol) 176 prev-inserted offset from to index-tag docstruct-symbol)
179 177
180 ;; Pop to buffer buf to get the correct buffer-local variables 178 ;; Pop to buffer buf to get the correct buffer-local variables
181 (save-excursion 179 (with-current-buffer buf
182 (set-buffer buf)
183 180
184 ;; Ensure access to scanning info 181 ;; Ensure access to scanning info
185 (reftex-access-scan-info) 182 (reftex-access-scan-info)
@@ -413,8 +410,7 @@ During a selection process, these are the local bindings.
413 (recursive-edit)) 410 (recursive-edit))
414 411
415 (set-marker reftex-recursive-edit-marker nil) 412 (set-marker reftex-recursive-edit-marker nil)
416 (save-excursion 413 (with-current-buffer selection-buffer
417 (set-buffer selection-buffer)
418 (use-local-map nil) 414 (use-local-map nil)
419 (remove-hook 'pre-command-hook 'reftex-select-pre-command-hook t) 415 (remove-hook 'pre-command-hook 'reftex-select-pre-command-hook t)
420 (remove-hook 'post-command-hook 416 (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."
708 (name (nth 1 x)) 708 (name (nth 1 x))
709 (newname (nth 2 x)) 709 (newname (nth 2 x))
710 (marker (nth 4 data))) 710 (marker (nth 4 data)))
711 (save-excursion 711 (with-current-buffer (marker-buffer marker)
712 (set-buffer (marker-buffer marker))
713 (goto-char (marker-position marker)) 712 (goto-char (marker-position marker))
714 (if (looking-at (concat "\\([ \t]*\\\\\\)" (regexp-quote name))) 713 (if (looking-at (concat "\\([ \t]*\\\\\\)" (regexp-quote name)))
715 (replace-match (concat "\\1" newname)) 714 (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."
1822 (let ((buffer-read-only nil)) (erase-buffer))) 1822 (let ((buffer-read-only nil)) (erase-buffer)))
1823 ((setq buffer (get-buffer buffer)) 1823 ((setq buffer (get-buffer buffer))
1824 ;; buffer exists 1824 ;; buffer exists
1825 (save-excursion 1825 (with-current-buffer buffer
1826 (set-buffer buffer) 1826 (let ((inhibit-read-only t)) (erase-buffer))))))
1827 (let ((buffer-read-only nil)) (erase-buffer))))))
1828 1827
1829(defun reftex-this-word (&optional class) 1828(defun reftex-this-word (&optional class)
1830 ;; Grab the word around point. 1829 ;; Grab the word around point.
@@ -2072,8 +2071,7 @@ When DIE is non-nil, throw an error if file not found."
2072 2071
2073 ;; Is there a hook to run? 2072 ;; Is there a hook to run?
2074 (when (listp reftex-initialize-temporary-buffers) 2073 (when (listp reftex-initialize-temporary-buffers)
2075 (save-excursion 2074 (with-current-buffer buf
2076 (set-buffer buf)
2077 (run-hooks 'reftex-initialize-temporary-buffers)))) 2075 (run-hooks 'reftex-initialize-temporary-buffers))))
2078 2076
2079 ;; Lets see if we got a license to kill :-| 2077 ;; 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."
2100 (and (buffer-modified-p buffer) 2098 (and (buffer-modified-p buffer)
2101 (y-or-n-p (format "Save file %s? " 2099 (y-or-n-p (format "Save file %s? "
2102 (buffer-file-name buffer))) 2100 (buffer-file-name buffer)))
2103 (save-excursion 2101 (with-current-buffer buffer
2104 (set-buffer buffer)
2105 (save-buffer))) 2102 (save-buffer)))
2106 (kill-buffer buffer)) 2103 (kill-buffer buffer))
2107 (pop reftex-buffers-to-kill))))) 2104 (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\"."
93 (interactive "r") 93 (interactive "r")
94 (let ((filter spell-filter) 94 (let ((filter spell-filter)
95 (buf (get-buffer-create " *temp*"))) 95 (buf (get-buffer-create " *temp*")))
96 (save-excursion 96 (with-current-buffer buf
97 (set-buffer buf)
98 (widen) 97 (widen)
99 (erase-buffer)) 98 (erase-buffer))
100 (message "Checking spelling of %s..." (or description "region")) 99 (message "Checking spelling of %s..." (or description "region"))
@@ -104,41 +103,37 @@ for example, \"word\"."
104 (call-process-region start end shell-file-name 103 (call-process-region start end shell-file-name
105 nil buf nil "-c" spell-command)) 104 nil buf nil "-c" spell-command))
106 (let ((oldbuf (current-buffer))) 105 (let ((oldbuf (current-buffer)))
107 (save-excursion 106 (with-current-buffer buf
108 (set-buffer buf) 107 (insert-buffer-substring oldbuf start end)
109 (insert-buffer-substring oldbuf start end) 108 (or (bolp) (insert ?\n))
110 (or (bolp) (insert ?\n)) 109 (if filter (funcall filter))
111 (if filter (funcall filter)) 110 (if (string= "spell" spell-command)
112 (if (string= "spell" spell-command) 111 (call-process-region (point-min) (point-max) "spell" t buf)
113 (call-process-region (point-min) (point-max) "spell" t buf) 112 (call-process-region (point-min) (point-max) shell-file-name
114 (call-process-region (point-min) (point-max) shell-file-name 113 t buf nil "-c" spell-command)))))
115 t buf nil "-c" spell-command)))))
116 (message "Checking spelling of %s...%s" 114 (message "Checking spelling of %s...%s"
117 (or description "region") 115 (or description "region")
118 (if (save-excursion 116 (if (with-current-buffer buf
119 (set-buffer buf) 117 (> (buffer-size) 0))
120 (> (buffer-size) 0))
121 "not correct" 118 "not correct"
122 "correct")) 119 "correct"))
123 (let (word newword 120 (let (word newword
124 (case-fold-search t) 121 (case-fold-search t)
125 (case-replace t)) 122 (case-replace t))
126 (while (save-excursion 123 (while (with-current-buffer buf
127 (set-buffer buf) 124 (> (buffer-size) 0))
128 (> (buffer-size) 0)) 125 (with-current-buffer buf
129 (save-excursion 126 (goto-char (point-min))
130 (set-buffer buf) 127 (setq word (downcase
131 (goto-char (point-min)) 128 (buffer-substring (point)
132 (setq word (downcase 129 (progn (end-of-line) (point)))))
133 (buffer-substring (point) 130 (forward-char 1)
134 (progn (end-of-line) (point))))) 131 (delete-region (point-min) (point))
135 (forward-char 1) 132 (setq newword
136 (delete-region (point-min) (point)) 133 (read-string (concat "`" word
137 (setq newword 134 "' not recognized; edit a replacement: ")
138 (read-string (concat "`" word 135 word))
139 "' not recognized; edit a replacement: ") 136 (flush-lines (concat "^" (regexp-quote word) "$")))
140 word))
141 (flush-lines (concat "^" (regexp-quote word) "$")))
142 (if (not (equal word newword)) 137 (if (not (equal word newword))
143 (progn 138 (progn
144 (goto-char (point-min)) 139 (goto-char (point-min))
@@ -152,22 +147,21 @@ for example, \"word\"."
152 "Check spelling of string supplied as argument." 147 "Check spelling of string supplied as argument."
153 (interactive "sSpell string: ") 148 (interactive "sSpell string: ")
154 (let ((buf (get-buffer-create " *temp*"))) 149 (let ((buf (get-buffer-create " *temp*")))
155 (save-excursion 150 (with-current-buffer buf
156 (set-buffer buf) 151 (widen)
157 (widen) 152 (erase-buffer)
158 (erase-buffer) 153 (insert string "\n")
159 (insert string "\n") 154 (if (string= "spell" spell-command)
160 (if (string= "spell" spell-command) 155 (call-process-region (point-min) (point-max) "spell"
161 (call-process-region (point-min) (point-max) "spell" 156 t t)
162 t t) 157 (call-process-region (point-min) (point-max) shell-file-name
163 (call-process-region (point-min) (point-max) shell-file-name 158 t t nil "-c" spell-command))
164 t t nil "-c" spell-command)) 159 (if (= 0 (buffer-size))
165 (if (= 0 (buffer-size)) 160 (message "%s is correct" string)
166 (message "%s is correct" string) 161 (goto-char (point-min))
167 (goto-char (point-min)) 162 (while (search-forward "\n" nil t)
168 (while (search-forward "\n" nil t) 163 (replace-match " "))
169 (replace-match " ")) 164 (message "%sincorrect" (buffer-substring 1 (point-max)))))))
170 (message "%sincorrect" (buffer-substring 1 (point-max)))))))
171;;;###autoload 165;;;###autoload
172(make-obsolete 'spell-string "The `spell' package is obsolete - use `ispell'." 166(make-obsolete 'spell-string "The `spell' package is obsolete - use `ispell'."
173 "23.1") 167 "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'."
1700 (setq directory (file-name-as-directory (expand-file-name directory))) 1700 (setq directory (file-name-as-directory (expand-file-name directory)))
1701 (if (not (file-directory-p directory)) 1701 (if (not (file-directory-p directory))
1702 (error "%s is not a directory" directory) 1702 (error "%s is not a directory" directory)
1703 (save-excursion 1703 (with-current-buffer buffer
1704 (set-buffer buffer)
1705 (setq default-directory directory)))) 1704 (setq default-directory directory))))
1706 1705
1707(defvar tex-send-command-modified-tick 0) 1706(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."
1723 "Return a list of the included files in OUTER-FILE." 1723 "Return a list of the included files in OUTER-FILE."
1724 (let ((included-file-list (list outer-file)) 1724 (let ((included-file-list (list outer-file))
1725 start) 1725 start)
1726 (save-excursion 1726 (with-current-buffer (find-file-noselect outer-file)
1727 (set-buffer (find-file-noselect outer-file))
1728 (widen) 1727 (widen)
1729 (goto-char (point-min)) 1728 (goto-char (point-min))
1730 (while (re-search-forward "^@include" nil t) 1729 (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
407 (if (y-or-n-p (concat "Overwrite associated buffer `" 407 (if (y-or-n-p (concat "Overwrite associated buffer `"
408 (buffer-name (2C-other)) 408 (buffer-name (2C-other))
409 "'? ")) 409 "'? "))
410 (save-excursion 410 (with-current-buffer (2C-other)
411 (set-buffer (2C-other))
412 (erase-buffer)) 411 (erase-buffer))
413 (signal 'quit nil))) 412 (signal 'quit nil)))
414 (let ((point (point)) 413 (let ((point (point))