changeset 105813:df4934f25eef

* textmodes/two-column.el (2C-split): * textmodes/texnfo-upd.el (texinfo-multi-file-included-list): * textmodes/tex-mode.el (tex-set-buffer-directory): * textmodes/spell.el (spell-region, spell-string): * textmodes/reftex.el (reftex-erase-buffer): (reftex-get-file-buffer-force, reftex-kill-temporary-buffers): * textmodes/reftex-toc.el (reftex-toc-promote-action): * textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct) (reftex-select-item): * textmodes/reftex-ref.el (reftex-label-info-update) (reftex-offer-label-menu): * textmodes/reftex-index.el (reftex-index-change-entry) (reftex-index-phrases-info): * textmodes/reftex-global.el (reftex-create-tags-file) (reftex-save-all-document-buffers, reftex-ensure-write-access): * textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite) (reftex-view-crossref-from-bibtex): * textmodes/reftex-cite.el (reftex-bibtex-selection-callback) (reftex-extract-bib-entries-from-thebibliography) (reftex-all-used-citation-keys, reftex-create-bibtex-file): * textmodes/refbib.el (r2b-capitalize-title): (r2b-convert-buffer, r2b-help): * textmodes/page-ext.el (pages-directory) (pages-directory-goto-with-mouse): * textmodes/bibtex.el (bibtex-validate-globally): * textmodes/bib-mode.el (bib-capitalize-title): * textmodes/artist.el (artist-clear-buffer, artist-system): * progmodes/xscheme.el (global-set-scheme-interaction-buffer): (local-set-scheme-interaction-buffer, xscheme-process-filter) (verify-xscheme-buffer, xscheme-enter-interaction-mode) (xscheme-enter-debugger-mode, xscheme-debugger-mode-p) (xscheme-send-control-g-interrupt, xscheme-start-process) (xscheme-process-sentinel, xscheme-cd): * progmodes/verilog-mode.el (verilog-read-always-signals) (verilog-set-define, verilog-getopt-file) (verilog-module-inside-filename-p): * progmodes/sh-script.el: * progmodes/python.el (python-pdbtrack-get-source-buffer) (python-pdbtrack-grub-for-buffer, python-execute-file): * progmodes/octave-inf.el (inferior-octave): * progmodes/idlwave.el (idlwave-scan-user-lib-files) (idlwave-shell-compile-helper-routines, idlwave-set-local) (idlwave-display-completion-list-xemacs, idlwave-list-abbrevs) (idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows) (idlwave-completion-fontify-classes, idlwave-display-calling-sequence): * progmodes/idlw-shell.el (idlwave-shell-examine-display-clear) (idlwave-shell-filter, idlwave-shell-examine-highlight) (idlwave-shell-sentinel, idlwave-shell-filter-directory) (idlwave-shell-display-line, idlwave-shell-set-bp-in-module) (idlwave-shell-examine-display, idlwave-shell-run-region) (idlwave-shell-filter-bp, idlwave-shell-save-and-action) (idlwave-shell-sources-filter, idlwave-shell-goto-next-error): * progmodes/idlw-help.el (idlwave-help-get-special-help) (idlwave-help-get-help-buffer): * progmodes/gud.el (gud-basic-call, gud-find-class) (gud-tooltip-activate-mouse-motions-if-enabled): * progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe): * progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as) (ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file) (ebrowse-tags-next-file): * progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps) (ebnf-eps-production-list, ebnf-begin-file, ebnf-log) (ebnf-eps-finish-and-write): * progmodes/cpp.el (cpp-edit-save): * progmodes/cperl-mode.el (cperl-pod-to-manpage): * progmodes/cc-defs.el (c-emacs-features): * progmodes/antlr-mode.el (antlr-invalidate-context-cache) (antlr-directory-dependencies): * progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name) (ada-run-application, ada-find-in-src-path, ada-goto-parent) (ada-find-any-references, ada-make-filename-from-adaname) (ada-make-body-gnatstub): * obsolete/rnews.el (news-list-news-groups): * obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file): * obsolete/iso-acc.el (iso-acc-minibuf-setup): * net/rcirc.el (rcirc-debug): * net/newst-treeview.el (newsticker--treeview-list-add-item) (newsticker--treeview-list-clear, newsticker-treeview-browse-url) (newsticker--treeview-list-update-faces, newsticker-treeview-save) (newsticker--treeview-item-show-text, newsticker--treeview-item-show) (newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init) (newsticker-treeview-show-item, newsticker--treeview-unfold-node) (newsticker--treeview-list-clear-highlight) (newsticker--treeview-list-update-highlight) (newsticker--treeview-list-highlight-start) (newsticker--treeview-tree-update-highlight) (newsticker--treeview-get-selected-item) (newsticker-treeview-mark-list-items-old) (newsticker--treeview-set-current-node): * net/newst-plainview.el (newsticker--buffer-set-uptodate): * net/newst-backend.el (newsticker--get-news-by-funcall) (newsticker--get-news-by-wget, newsticker--image-get) (newsticker--image-sentinel): * net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field): * net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session): (eudc-ph-close-session): * net/eudc.el (eudc-save-options): * language/thai-word.el (thai-update-word-table): * language/japan-util.el (japanese-string-conversion): * international/titdic-cnv.el (tsang-quick-converter) (ziranma-converter, ctlau-converter): * international/mule-cmds.el (describe-language-environment): * international/ja-dic-cnv.el (skkdic-convert-okuri-ari) (skkdic-convert-postfix, skkdic-convert-prefix): (skkdic-convert-okuri-nasi, skkdic-convert): * emacs-lisp/re-builder.el (reb-update-overlays): * emacs-lisp/pp.el (pp-to-string, pp-display-expression): * emacs-lisp/gulp.el (gulp-send-requests): * emacs-lisp/find-gc.el (trace-call-tree): * emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class) (eieio-describe-generic): * emacs-lisp/eieio-base.el (eieio-persistent-read): * emacs-lisp/edebug.el (edebug-outside-excursion): * emacs-lisp/debug.el (debugger-make-xrefs): * emacs-lisp/cust-print.el (custom-prin1-to-string): * emacs-lisp/chart.el (chart-new-buffer): * emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log): Use with-current-buffer. * textmodes/artist.el (artist-system): Don't call copy-sequence on a fresh string. * progmodes/idlw-shell.el (easymenu setup): Use dolist.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 31 Oct 2009 02:38:34 +0000
parents 68937a278ce7
children d3531eb1d0d5
files lisp/ChangeLog lisp/emacs-lisp/authors.el lisp/emacs-lisp/chart.el lisp/emacs-lisp/cust-print.el lisp/emacs-lisp/debug.el lisp/emacs-lisp/edebug.el lisp/emacs-lisp/eieio-base.el lisp/emacs-lisp/eieio-opt.el lisp/emacs-lisp/find-gc.el lisp/emacs-lisp/gulp.el lisp/emacs-lisp/pp.el lisp/emacs-lisp/re-builder.el lisp/international/ja-dic-cnv.el lisp/international/mule-cmds.el lisp/international/titdic-cnv.el lisp/language/japan-util.el lisp/language/thai-word.el lisp/net/eudc.el lisp/net/eudcb-ph.el lisp/net/mairix.el lisp/net/newst-backend.el lisp/net/newst-plainview.el lisp/net/newst-treeview.el lisp/net/rcirc.el lisp/obsolete/iso-acc.el lisp/obsolete/resume.el lisp/obsolete/rnews.el lisp/progmodes/ada-xref.el lisp/progmodes/antlr-mode.el lisp/progmodes/cc-defs.el lisp/progmodes/cperl-mode.el lisp/progmodes/cpp.el lisp/progmodes/ebnf2ps.el lisp/progmodes/ebrowse.el lisp/progmodes/gdb-mi.el lisp/progmodes/gud.el lisp/progmodes/idlw-help.el lisp/progmodes/idlw-shell.el lisp/progmodes/idlwave.el lisp/progmodes/octave-inf.el lisp/progmodes/python.el lisp/progmodes/sh-script.el lisp/progmodes/verilog-mode.el lisp/progmodes/xscheme.el lisp/textmodes/artist.el lisp/textmodes/bib-mode.el lisp/textmodes/bibtex.el lisp/textmodes/page-ext.el lisp/textmodes/refbib.el lisp/textmodes/reftex-cite.el lisp/textmodes/reftex-dcr.el lisp/textmodes/reftex-global.el lisp/textmodes/reftex-index.el lisp/textmodes/reftex-ref.el lisp/textmodes/reftex-sel.el lisp/textmodes/reftex-toc.el lisp/textmodes/reftex.el lisp/textmodes/spell.el lisp/textmodes/tex-mode.el lisp/textmodes/texnfo-upd.el lisp/textmodes/two-column.el
diffstat 61 files changed, 462 insertions(+), 516 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/ChangeLog	Sat Oct 31 02:38:34 2009 +0000
@@ -1,3 +1,127 @@
+2009-10-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* textmodes/two-column.el (2C-split):
+	* textmodes/texnfo-upd.el (texinfo-multi-file-included-list):
+	* textmodes/tex-mode.el (tex-set-buffer-directory):
+	* textmodes/spell.el (spell-region, spell-string):
+	* textmodes/reftex.el (reftex-erase-buffer):
+	(reftex-get-file-buffer-force, reftex-kill-temporary-buffers):
+	* textmodes/reftex-toc.el (reftex-toc-promote-action):
+	* textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct)
+	(reftex-select-item):
+	* textmodes/reftex-ref.el (reftex-label-info-update)
+	(reftex-offer-label-menu):
+	* textmodes/reftex-index.el (reftex-index-change-entry)
+	(reftex-index-phrases-info):
+	* textmodes/reftex-global.el (reftex-create-tags-file)
+	(reftex-save-all-document-buffers, reftex-ensure-write-access):
+	* textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite)
+	(reftex-view-crossref-from-bibtex):
+	* textmodes/reftex-cite.el (reftex-bibtex-selection-callback)
+	(reftex-extract-bib-entries-from-thebibliography)
+	(reftex-all-used-citation-keys, reftex-create-bibtex-file):
+	* textmodes/refbib.el (r2b-capitalize-title):
+	(r2b-convert-buffer, r2b-help):
+	* textmodes/page-ext.el (pages-directory)
+	(pages-directory-goto-with-mouse):
+	* textmodes/bibtex.el (bibtex-validate-globally):
+	* textmodes/bib-mode.el (bib-capitalize-title):
+	* textmodes/artist.el (artist-clear-buffer, artist-system):
+	* progmodes/xscheme.el (global-set-scheme-interaction-buffer):
+	(local-set-scheme-interaction-buffer, xscheme-process-filter)
+	(verify-xscheme-buffer, xscheme-enter-interaction-mode)
+	(xscheme-enter-debugger-mode, xscheme-debugger-mode-p)
+	(xscheme-send-control-g-interrupt, xscheme-start-process)
+	(xscheme-process-sentinel, xscheme-cd):
+	* progmodes/verilog-mode.el (verilog-read-always-signals)
+	(verilog-set-define, verilog-getopt-file)
+	(verilog-module-inside-filename-p):
+	* progmodes/sh-script.el:
+	* progmodes/python.el (python-pdbtrack-get-source-buffer)
+	(python-pdbtrack-grub-for-buffer, python-execute-file):
+	* progmodes/octave-inf.el (inferior-octave):
+	* progmodes/idlwave.el (idlwave-scan-user-lib-files)
+	(idlwave-shell-compile-helper-routines, idlwave-set-local)
+	(idlwave-display-completion-list-xemacs, idlwave-list-abbrevs)
+	(idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows)
+	(idlwave-completion-fontify-classes, idlwave-display-calling-sequence):
+	* progmodes/idlw-shell.el (idlwave-shell-examine-display-clear)
+	(idlwave-shell-filter, idlwave-shell-examine-highlight)
+	(idlwave-shell-sentinel, idlwave-shell-filter-directory)
+	(idlwave-shell-display-line, idlwave-shell-set-bp-in-module)
+	(idlwave-shell-examine-display, idlwave-shell-run-region)
+	(idlwave-shell-filter-bp, idlwave-shell-save-and-action)
+	(idlwave-shell-sources-filter, idlwave-shell-goto-next-error):
+	* progmodes/idlw-help.el (idlwave-help-get-special-help)
+	(idlwave-help-get-help-buffer):
+	* progmodes/gud.el (gud-basic-call, gud-find-class)
+	(gud-tooltip-activate-mouse-motions-if-enabled):
+	* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
+	* progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as)
+	(ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file)
+	(ebrowse-tags-next-file):
+	* progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps)
+	(ebnf-eps-production-list, ebnf-begin-file, ebnf-log)
+	(ebnf-eps-finish-and-write):
+	* progmodes/cpp.el (cpp-edit-save):
+	* progmodes/cperl-mode.el (cperl-pod-to-manpage):
+	* progmodes/cc-defs.el (c-emacs-features):
+	* progmodes/antlr-mode.el (antlr-invalidate-context-cache)
+	(antlr-directory-dependencies):
+	* progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name)
+	(ada-run-application, ada-find-in-src-path, ada-goto-parent)
+	(ada-find-any-references, ada-make-filename-from-adaname)
+	(ada-make-body-gnatstub):
+	* obsolete/rnews.el (news-list-news-groups):
+	* obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file):
+	* obsolete/iso-acc.el (iso-acc-minibuf-setup):
+	* net/rcirc.el (rcirc-debug):
+	* net/newst-treeview.el (newsticker--treeview-list-add-item)
+	(newsticker--treeview-list-clear, newsticker-treeview-browse-url)
+	(newsticker--treeview-list-update-faces, newsticker-treeview-save)
+	(newsticker--treeview-item-show-text, newsticker--treeview-item-show)
+	(newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init)
+	(newsticker-treeview-show-item, newsticker--treeview-unfold-node)
+	(newsticker--treeview-list-clear-highlight)
+	(newsticker--treeview-list-update-highlight)
+	(newsticker--treeview-list-highlight-start)
+	(newsticker--treeview-tree-update-highlight)
+	(newsticker--treeview-get-selected-item)
+	(newsticker-treeview-mark-list-items-old)
+	(newsticker--treeview-set-current-node):
+	* net/newst-plainview.el (newsticker--buffer-set-uptodate):
+	* net/newst-backend.el (newsticker--get-news-by-funcall)
+	(newsticker--get-news-by-wget, newsticker--image-get)
+	(newsticker--image-sentinel):
+	* net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field):
+	* net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session):
+	(eudc-ph-close-session):
+	* net/eudc.el (eudc-save-options):
+	* language/thai-word.el (thai-update-word-table):
+	* language/japan-util.el (japanese-string-conversion):
+	* international/titdic-cnv.el (tsang-quick-converter)
+	(ziranma-converter, ctlau-converter):
+	* international/mule-cmds.el (describe-language-environment):
+	* international/ja-dic-cnv.el (skkdic-convert-okuri-ari)
+	(skkdic-convert-postfix, skkdic-convert-prefix):
+	(skkdic-convert-okuri-nasi, skkdic-convert):
+	* emacs-lisp/re-builder.el (reb-update-overlays):
+	* emacs-lisp/pp.el (pp-to-string, pp-display-expression):
+	* emacs-lisp/gulp.el (gulp-send-requests):
+	* emacs-lisp/find-gc.el (trace-call-tree):
+	* emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class)
+	(eieio-describe-generic):
+	* emacs-lisp/eieio-base.el (eieio-persistent-read):
+	* emacs-lisp/edebug.el (edebug-outside-excursion):
+	* emacs-lisp/debug.el (debugger-make-xrefs):
+	* emacs-lisp/cust-print.el (custom-prin1-to-string):
+	* emacs-lisp/chart.el (chart-new-buffer):
+	* emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log):
+	Use with-current-buffer.
+	* textmodes/artist.el (artist-system): Don't call
+	copy-sequence on a fresh string.
+	* progmodes/idlw-shell.el (easymenu setup): Use dolist.
+
 2009-10-31  Stephen Berman  <stephen.berman@gmx.net>
 
 	* calendar/todo-mode.el (todo-edit-item): Signal an error if there
--- a/lisp/emacs-lisp/authors.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/emacs-lisp/authors.el	Sat Oct 31 02:38:34 2009 +0000
@@ -706,8 +706,7 @@
 	 (existing-buffer (get-file-buffer log-file))
 	 (buffer (find-file-noselect log-file))
 	 authors file pos)
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (save-restriction
 	(widen)
 	(goto-char (point-min))
@@ -758,8 +757,7 @@
 	 (enable-local-eval nil)
 	 (buffer (find-file-noselect file)))
     (setq file (file-name-nondirectory file))
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (save-restriction
 	(widen)
 	(goto-char (point-min))
--- a/lisp/emacs-lisp/chart.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/emacs-lisp/chart.el	Sat Oct 31 02:38:34 2009 +0000
@@ -134,8 +134,7 @@
 (defun chart-new-buffer (obj)
   "Create a new buffer NAME in which the chart OBJ is displayed.
 Returns the newly created buffer."
-  (save-excursion
-    (set-buffer (get-buffer-create (format "*%s*" (oref obj title))))
+  (with-current-buffer (get-buffer-create (format "*%s*" (oref obj title)))
     (chart-mode)
     (setq chart-local-object obj)
     (current-buffer)))
--- a/lisp/emacs-lisp/cust-print.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/emacs-lisp/cust-print.el	Sat Oct 31 02:38:34 2009 +0000
@@ -332,15 +332,13 @@
   (let ((buf (get-buffer-create " *custom-print-temp*")))
     ;; We must erase the buffer before printing in case an error
     ;; occurred during the last prin1-to-string and we are in debugger.
-    (save-excursion
-      (set-buffer buf)
+    (with-current-buffer buf
       (erase-buffer))
     ;; We must be in the current-buffer when the print occurs.
     (if noescape
 	(custom-princ object buf)
       (custom-prin1 object buf))
-    (save-excursion
-      (set-buffer buf)
+    (with-current-buffer buf
       (buffer-string)
       ;; We could erase the buffer again, but why bother?
       )))
--- a/lisp/emacs-lisp/debug.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/emacs-lisp/debug.el	Sat Oct 31 02:38:34 2009 +0000
@@ -329,8 +329,7 @@
 (defun debugger-make-xrefs (&optional buffer)
   "Attach cross-references to function names in the `*Backtrace*' buffer."
   (interactive "b")
-  (save-excursion
-    (set-buffer (or buffer (current-buffer)))
+  (with-current-buffer (or buffer (current-buffer))
     (setq buffer (current-buffer))
     (let ((inhibit-read-only t)
 	  (old-end (point-min)) (new-end (point-min)))
--- a/lisp/emacs-lisp/edebug.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/emacs-lisp/edebug.el	Sat Oct 31 02:38:34 2009 +0000
@@ -3605,8 +3605,7 @@
 	   )
        (setq-default cursor-in-non-selected-windows edebug-outside-d-c-i-n-s-w)
        (unwind-protect
-	   (save-excursion		; of edebug-buffer
-	     (set-buffer edebug-outside-buffer)
+	   (with-current-buffer edebug-outside-buffer ; of edebug-buffer
 	     (goto-char edebug-outside-point)
 	     (if (marker-buffer (edebug-mark-marker))
 		 (set-marker (edebug-mark-marker) edebug-outside-mark))
--- a/lisp/emacs-lisp/eieio-base.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/emacs-lisp/eieio-base.el	Sat Oct 31 02:38:34 2009 +0000
@@ -230,8 +230,7 @@
 	(buffstr nil))
     (unwind-protect
 	(progn
-	  (save-excursion
-	    (set-buffer (get-buffer-create " *tmp eieio read*"))
+	  (with-current-buffer (get-buffer-create " *tmp eieio read*")
 	    (insert-file-contents filename nil nil nil t)
 	    (goto-char (point-min))
 	    (setq buffstr (buffer-string)))
--- a/lisp/emacs-lisp/eieio-opt.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/emacs-lisp/eieio-opt.el	Sat Oct 31 02:38:34 2009 +0000
@@ -43,8 +43,7 @@
   (if (not root-class) (setq root-class 'eieio-default-superclass))
   (if (not (class-p root-class)) (signal 'wrong-type-argument (list 'class-p root-class)))
   (display-buffer (get-buffer-create "*EIEIO OBJECT BROWSE*") t)
-  (save-excursion
-    (set-buffer (get-buffer "*EIEIO OBJECT BROWSE*"))
+  (with-current-buffer (get-buffer "*EIEIO OBJECT BROWSE*")
     (erase-buffer)
     (goto-char 0)
     (eieio-browse-tree root-class "" "")
@@ -161,8 +160,7 @@
 	    (terpri)
 	    (terpri))
 	  (setq methods (cdr methods))))))
-  (save-excursion
-    (set-buffer (help-buffer))
+  (with-current-buffer (help-buffer)
     (buffer-string)))
 
 (defun eieio-describe-class-slots (class)
@@ -376,8 +374,7 @@
 	    (terpri)
 	    (terpri)))
 	(setq i (1+ i)))))
-  (save-excursion
-    (set-buffer (help-buffer))
+  (with-current-buffer (help-buffer)
     (buffer-string)))
 
 (defun eieio-lambda-arglist (func)
--- a/lisp/emacs-lisp/find-gc.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/emacs-lisp/find-gc.el	Sat Oct 31 02:38:34 2009 +0000
@@ -113,8 +113,7 @@
 	(call-process "csh" nil nil nil "-c"
 		      (format "ln -s %s/*.[ch] /tmp/esrc"
 			      find-gc-source-directory))))
-  (save-excursion
-    (set-buffer (get-buffer-create "*Trace Call Tree*"))
+  (with-current-buffer (get-buffer-create "*Trace Call Tree*")
     (setq find-gc-subrs-called nil)
     (let ((case-fold-search nil)
 	  (files find-gc-source-files)
--- a/lisp/emacs-lisp/gulp.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/emacs-lisp/gulp.el	Sat Oct 31 02:38:34 2009 +0000
@@ -91,8 +91,7 @@
 The list of addresses for which you decided not to send mail
 is left in the `*gulp*' buffer at the end."
   (interactive "DRequest updates for Lisp directory: \nP")
-  (save-excursion
-    (set-buffer (get-buffer-create gulp-tmp-buffer))
+  (with-current-buffer (get-buffer-create gulp-tmp-buffer)
     (let ((m-p-alist (gulp-create-m-p-alist
 		      (directory-files dir nil "^[^=].*\\.el$" t)
 		      dir))
--- a/lisp/emacs-lisp/pp.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/emacs-lisp/pp.el	Sat Oct 31 02:38:34 2009 +0000
@@ -42,8 +42,7 @@
   "Return a string containing the pretty-printed representation of OBJECT.
 OBJECT can be any Lisp object.  Quoting characters are used as needed
 to make output that `read' can handle, whenever this is possible."
-  (save-excursion
-    (set-buffer (generate-new-buffer " pp-to-string"))
+  (with-current-buffer (generate-new-buffer " pp-to-string")
     (unwind-protect
 	(progn
 	  (lisp-mode-variables nil)
@@ -105,8 +104,7 @@
 	 (temp-buffer-show-function
 	  (function
 	   (lambda (buf)
-	     (save-excursion
-	       (set-buffer buf)
+	     (with-current-buffer buf
 	       (goto-char (point-min))
 	       (end-of-line 1)
 	       (if (or (< (1+ (point)) (point-max))
--- a/lisp/emacs-lisp/re-builder.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/emacs-lisp/re-builder.el	Sat Oct 31 02:38:34 2009 +0000
@@ -658,8 +658,7 @@
 	 (matches 0)
 	 (submatches 0)
 	 firstmatch)
-    (save-excursion
-      (set-buffer reb-target-buffer)
+    (with-current-buffer reb-target-buffer
       (reb-delete-overlays)
       (goto-char (point-min))
       (while (and (not (eobp))
--- a/lisp/international/ja-dic-cnv.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/international/ja-dic-cnv.el	Sat Oct 31 02:38:34 2009 +0000
@@ -57,8 +57,7 @@
 (defun skkdic-convert-okuri-ari (skkbuf buf)
   (message "Processing OKURI-ARI entries ...")
   (goto-char (point-min))
-  (save-excursion
-    (set-buffer buf)
+  (with-current-buffer buf
     (insert ";; Setting okuri-ari entries.\n"
 	    "(skkdic-set-okuri-ari\n"))
   (while (not (eobp))
@@ -67,8 +66,7 @@
       (end-of-line)
       (setq to (point))
 
-      (save-excursion
-	(set-buffer buf)
+      (with-current-buffer buf
 	(insert-buffer-substring skkbuf from to)
 	(beginning-of-line)
 	(insert "\"")
@@ -81,8 +79,7 @@
 	(insert "\"\n"))
 
       (forward-line 1)))
-  (save-excursion
-    (set-buffer buf)
+  (with-current-buffer buf
     (insert ")\n\n")))
 
 (defconst skkdic-postfix-list '(skkdic-postfix-list))
@@ -111,15 +108,13 @@
 (defun skkdic-convert-postfix (skkbuf buf)
   (message "Processing POSTFIX entries ...")
   (goto-char (point-min))
-  (save-excursion
-    (set-buffer buf)
+  (with-current-buffer buf
     (insert ";; Setting postfix entries.\n"
 	    "(skkdic-set-postfix\n"))
 
   ;; Initialize SKKDIC-POSTFIX-LIST by predefined data
   ;; SKKDIC-POSTFIX-DATA.
-  (save-excursion
-    (set-buffer buf)
+  (with-current-buffer buf
     (let ((l skkdic-postfix-data)
 	  kana candidates entry)
       (while l
@@ -146,8 +141,7 @@
 	(if (not (member str candidates))
 	    (setq candidates (cons str candidates)))
 	(goto-char (match-end 1)))
-      (save-excursion
-	(set-buffer buf)
+      (with-current-buffer buf
 	(insert "\"" kana)
 	(while candidates
 	  (insert " " (car candidates))
@@ -160,8 +154,7 @@
 				skkdic-postfix-list)))
 	  (setq candidates (cdr candidates)))
 	(insert "\"\n"))))
-  (save-excursion
-    (set-buffer buf)
+  (with-current-buffer buf
     (insert ")\n\n")))
 
 (defconst skkdic-prefix-list '(skkdic-prefix-list))
@@ -169,8 +162,7 @@
 (defun skkdic-convert-prefix (skkbuf buf)
   (message "Processing PREFIX entries ...")
   (goto-char (point-min))
-  (save-excursion
-    (set-buffer buf)
+  (with-current-buffer buf
     (insert ";; Setting prefix entries.\n"
 	    "(skkdic-set-prefix\n"))
   (save-excursion
@@ -182,16 +174,14 @@
 	  (if (not (member str candidates))
 	      (setq candidates (cons str candidates)))
 	  (goto-char (match-end 1)))
-	(save-excursion
-	  (set-buffer buf)
+	(with-current-buffer buf
 	  (insert "\"" kana)
 	  (while candidates
 	    (insert " " (car candidates))
 	    (set-nested-alist (car candidates) kana skkdic-prefix-list)
 	    (setq candidates (cdr candidates)))
 	  (insert "\"\n")))))
-  (save-excursion
-    (set-buffer buf)
+  (with-current-buffer buf
     (insert ")\n\n")))
 
 ;; FROM and TO point the head and tail of "/J../J../.../".
@@ -315,8 +305,7 @@
 
 (defun skkdic-convert-okuri-nasi (skkbuf buf)
   (message "Processing OKURI-NASI entries ...")
-  (save-excursion
-    (set-buffer buf)
+  (with-current-buffer buf
     (insert ";; Setting okuri-nasi entries.\n"
 	    "(skkdic-set-okuri-nasi\n")
     (let ((l (nreverse skkdic-okuri-nasi-entries))
@@ -354,9 +343,8 @@
   (let* ((coding-system-for-read 'euc-japan)
 	 (skkbuf(find-file-noselect (expand-file-name filename)))
 	 (buf (get-buffer-create "*skkdic-work*")))
-    (save-excursion
-      ;; Setup and generate the header part of working buffer.
-      (set-buffer buf)
+    ;; Setup and generate the header part of working buffer.
+    (with-current-buffer buf
       (erase-buffer)
       (buffer-disable-undo)
       (insert ";;; ja-dic.el --- dictionary for Japanese input method"
@@ -415,8 +403,7 @@
 	(skkdic-convert-okuri-nasi skkbuf buf)
 
 	;; Postfix
-	(save-excursion
-	  (set-buffer buf)
+	(with-current-buffer buf
 	  (goto-char (point-max))
 	  (insert ";;\n(provide 'ja-dic)\n\n;;; ja-dic.el ends here\n")))
 
--- a/lisp/international/mule-cmds.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/international/mule-cmds.el	Sat Oct 31 02:38:34 2009 +0000
@@ -2070,8 +2070,7 @@
     (help-setup-xref (list #'describe-language-environment language-name)
 		     (called-interactively-p 'interactive))
     (with-output-to-temp-buffer (help-buffer)
-      (save-excursion
-	(set-buffer standard-output)
+      (with-current-buffer standard-output
 	(insert language-name " language environment\n\n")
 	(if (stringp doc)
 	    (insert doc "\n\n"))
--- a/lisp/international/titdic-cnv.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/international/titdic-cnv.el	Sat Oct 31 02:38:34 2009 +0000
@@ -775,8 +775,7 @@
    (\",\" . quail-prev-translation-block))
   nil nil)\n\n")
     (insert "(quail-define-rules\n")
-    (save-excursion
-      (set-buffer dicbuf)
+    (with-current-buffer dicbuf
       ;; Handle double CR line ends, which result when checking out of
       ;; CVS on MS-Windows.
       (goto-char (point-min))
@@ -931,8 +930,7 @@
 
 (defun ziranma-converter (dicbuf name title)
   (let (dic)
-    (save-excursion
-      (set-buffer dicbuf)
+    (with-current-buffer dicbuf
       (goto-char (point-min))
       (search-forward "\n%keyname end")
       (forward-line 1)
@@ -1052,8 +1050,7 @@
   (let (dicbuf-start dicbuf-end key-start key (pos (point)))
     ;; Find the dictionary, which starts below a horizontal rule and
     ;; ends at the second to last line in the HTML file.
-    (save-excursion
-      (set-buffer dicbuf)
+    (with-current-buffer dicbuf
       (goto-char (point-min))
       (re-search-forward "^#<hr>")
       (forward-line 1)
--- a/lisp/language/japan-util.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/language/japan-util.el	Sat Oct 31 02:38:34 2009 +0000
@@ -162,8 +162,7 @@
 ;; Convert string STR by FUNC and return a resulting string.
 (defun japanese-string-conversion (str func &rest args)
   (let ((buf (get-buffer-create " *Japanese work*")))
-    (save-excursion
-      (set-buffer buf)
+    (with-current-buffer buf
       (erase-buffer)
       (insert str)
       (apply func 1 (point) args)
--- a/lisp/language/thai-word.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/language/thai-word.el	Sat Oct 31 02:38:34 2009 +0000
@@ -10748,8 +10748,7 @@
 	(coding-system-for-read 'thai-tis620)
 	(table (if append thai-word-table (list 'thai-words))))
     (unwind-protect
-	(save-excursion
-	  (set-buffer buf)
+	(with-current-buffer buf
 	  (insert-file-contents file)
 	  (goto-char (point-min))
 	  (while (re-search-forward "\\ct+" nil t)
--- a/lisp/net/eudc.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/net/eudc.el	Sat Oct 31 02:38:34 2009 +0000
@@ -1036,8 +1036,7 @@
 (defun eudc-save-options ()
   "Save options to `eudc-options-file'."
   (interactive)
-  (save-excursion
-    (set-buffer (find-file-noselect eudc-options-file t))
+  (with-current-buffer (find-file-noselect eudc-options-file t)
     (goto-char (point-min))
     ;; delete the previous setq
     (let ((standard-output (current-buffer))
--- a/lisp/net/eudcb-ph.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/net/eudcb-ph.el	Sat Oct 31 02:38:34 2009 +0000
@@ -149,8 +149,7 @@
 	  (message "Contacting server...")
 	  (setq process (eudc-ph-open-session))
 	  (if process
-	      (save-excursion
-		(set-buffer (setq buffer (process-buffer process)))
+	      (with-current-buffer (setq buffer (process-buffer process))
 		(eudc-ph-send-command process request)
 		(message "Request sent, waiting for reply...")
 		(eudc-ph-read-response process))))
@@ -173,8 +172,7 @@
       (setq port (or (match-string 3 server)
 		     eudc-ph-default-server-port))
       (setq eudc-ph-process-buffer (get-buffer-create (format " *PH-%s*" host)))
-      (save-excursion
-	(set-buffer eudc-ph-process-buffer)
+      (with-current-buffer eudc-ph-process-buffer
 	(erase-buffer)
 	(setq eudc-ph-read-point (point))
 	(and (featurep 'xemacs) (featurep 'mule)
@@ -186,8 +184,7 @@
       process)))
 
 (defun eudc-ph-close-session (process)
-  (save-excursion
-    (set-buffer (process-buffer process))
+  (with-current-buffer (process-buffer process)
     (eudc-ph-send-command process "quit")
     (eudc-ph-read-response process)
     (run-at-time 2 nil 'delete-process process)))
--- a/lisp/net/mairix.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/net/mairix.el	Sat Oct 31 02:38:34 2009 +0000
@@ -260,8 +260,7 @@
   ;; At this point, we are in rmail mode, so the rmail funcs are loaded.
   (if (fboundp 'rmail-get-header)	; Emacs 23
       (rmail-get-header field)
-    (save-excursion
-      (set-buffer rmail-buffer)
+    (with-current-buffer rmail-buffer
       (save-restriction
 	;; Don't warn about this when compiling Emacs 23.
 	(with-no-warnings (rmail-narrow-to-non-pruned-header))
@@ -294,10 +293,9 @@
   "Get mail header FIELD for current message using Gnus."
   (unless (gnus-alive-p)
     (error "Gnus is not running"))
-  (save-excursion
-    (unless (gnus-buffer-exists-p gnus-article-buffer)
-      (error "No article buffer available"))
-    (set-buffer gnus-article-buffer)
+  (unless (gnus-buffer-exists-p gnus-article-buffer)
+    (error "No article buffer available"))
+  (with-current-buffer gnus-article-buffer
     (gnus-summary-toggle-header 1)
     (message-field-value field)))
 
--- a/lisp/net/newst-backend.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/net/newst-backend.el	Sat Oct 31 02:38:34 2009 +0000
@@ -726,8 +726,7 @@
   "Get news for the site FEED-NAME by calling FUNCTION.
 See `newsticker-get-news'."
   (let ((buffername (concat " *newsticker-funcall-" feed-name "*")))
-    (save-excursion
-      (set-buffer (get-buffer-create buffername))
+    (with-current-buffer (get-buffer-create buffername)
       (erase-buffer)
       (insert (string-to-multibyte (funcall function feed-name)))
       (newsticker--sentinel-work nil t feed-name function
@@ -777,8 +776,7 @@
 WGET-ARGUMENTS is a list of arguments for wget.
 See `newsticker-get-news'."
   (let ((buffername (concat " *newsticker-wget-" feed-name "*")))
-    (save-excursion
-      (set-buffer (get-buffer-create buffername))
+    (with-current-buffer (get-buffer-create buffername)
       (erase-buffer)
       ;; throw an error if there is an old wget-process around
       (if (get-process feed-name)
@@ -1756,8 +1754,7 @@
                         feed-name)))
              (wget-arguments (or (car (cdr (cdr (cdr (cdr item)))))
                                  newsticker-wget-arguments)))
-        (save-excursion
-          (set-buffer (get-buffer-create buffername))
+        (with-current-buffer (get-buffer-create buffername)
           (erase-buffer)
           ;; throw an error if there is an old wget-process around
           (if (get-process feed-name)
@@ -1785,8 +1782,7 @@
                  feed-name)
         (throw 'oops nil))
       (let (image-name)
-        (save-excursion
-          (set-buffer (process-buffer process))
+        (with-current-buffer (process-buffer process)
           (setq image-name (concat (newsticker--images-dir) feed-name))
           (set-buffer-file-coding-system 'no-conversion)
           ;; make sure the cache dir exists
--- a/lisp/net/newst-plainview.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/net/newst-plainview.el	Sat Oct 31 02:38:34 2009 +0000
@@ -1210,11 +1210,10 @@
   (setq newsticker--buffer-uptodate-p value)
   (let ((b (get-buffer "*newsticker*")))
     (when b
-      (save-excursion
-       (set-buffer b)
-       (if value
-           (setq mode-name "Newsticker -- up to date -- ")
-         (setq mode-name "Newsticker -- NEED UPDATE -- ")))
+      (with-current-buffer b
+        (setq mode-name (if value
+                            "Newsticker -- up to date -- "
+                          "Newsticker -- NEED UPDATE -- ")))
       (force-mode-line-update 0))))
 
 (defun newsticker--buffer-redraw ()
--- a/lisp/net/newst-treeview.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/net/newst-treeview.el	Sat Oct 31 02:38:34 2009 +0000
@@ -307,8 +307,7 @@
   "Add news ITEM for FEED to newsticker treeview list window.
 If string SHOW-FEED is non-nil it is shown in the item string."
   (setq newsticker--treeview-list-show-feed show-feed)
-  (save-excursion
-    (set-buffer (newsticker--treeview-list-buffer))
+  (with-current-buffer (newsticker--treeview-list-buffer)
     (let* ((inhibit-read-only t)
            pos1 pos2)
       (goto-char (point-max))
@@ -350,8 +349,7 @@
 
 (defun newsticker--treeview-list-clear ()
   "Clear the newsticker treeview list window."
-  (save-excursion
-    (set-buffer (newsticker--treeview-list-buffer))
+  (with-current-buffer (newsticker--treeview-list-buffer)
     (let ((inhibit-read-only t))
       (erase-buffer)
       (kill-all-local-variables)
@@ -549,8 +547,7 @@
 (defun newsticker--treeview-list-update-faces ()
   "Update faces in the treeview list buffer."
   (let (pos-sel)
-    (save-excursion
-      (set-buffer (newsticker--treeview-list-buffer))
+    (with-current-buffer (newsticker--treeview-list-buffer)
       (let ((inhibit-read-only t))
         (goto-char (point-min))
         (while (not (eobp))
@@ -582,8 +579,7 @@
 
 (defun newsticker--treeview-list-clear-highlight ()
   "Clear the highlight in the treeview list buffer."
-  (save-excursion
-    (set-buffer (newsticker--treeview-list-buffer))
+  (with-current-buffer (newsticker--treeview-list-buffer)
     (let ((inhibit-read-only t))
       (put-text-property (point-min) (point-max) :nt-selected nil))
     (newsticker--treeview-list-update-faces)))
@@ -592,8 +588,7 @@
   "Update the highlight in the treeview list buffer."
   (newsticker--treeview-list-clear-highlight)
     (let (pos num-lines)
-      (save-excursion
-        (set-buffer (newsticker--treeview-list-buffer))
+      (with-current-buffer (newsticker--treeview-list-buffer)
         (let ((inhibit-read-only t))
           (put-text-property (save-excursion (beginning-of-line) (point))
                              (save-excursion (end-of-line) (point))
@@ -602,8 +597,7 @@
 
 (defun newsticker--treeview-list-highlight-start ()
   "Return position of selection in treeview list buffer."
-  (save-excursion
-    (set-buffer (newsticker--treeview-list-buffer))
+  (with-current-buffer (newsticker--treeview-list-buffer)
     (goto-char (point-min))
     (next-single-property-change (point) :nt-selected)))
 
@@ -677,8 +671,7 @@
 ;; ======================================================================
 (defun newsticker--treeview-item-show-text (title description)
   "Show text in treeview item buffer consisting of TITLE and DESCRIPTION."
-  (save-excursion
-    (set-buffer (newsticker--treeview-item-buffer))
+  (with-current-buffer (newsticker--treeview-item-buffer)
     (when (fboundp 'w3m-process-stop)
       (w3m-process-stop (current-buffer)))
     (let ((inhibit-read-only t))
@@ -696,8 +689,7 @@
 (defun newsticker--treeview-item-show (item feed-name-symbol)
   "Show news ITEM coming from FEED-NAME-SYMBOL in treeview item buffer."
   (setq newsticker--treeview-current-feed (symbol-name feed-name-symbol))
-  (save-excursion
-    (set-buffer (newsticker--treeview-item-buffer))
+  (with-current-buffer (newsticker--treeview-item-buffer)
     (when (fboundp 'w3m-process-stop)
       (w3m-process-stop (current-buffer)))
     (let ((inhibit-read-only t)
@@ -1012,8 +1004,7 @@
         (let ((p (point))
               (notify (widget-get w :notify)))
           ;; FIXME: This moves point!!!!
-          (save-excursion
-            (set-buffer (newsticker--treeview-tree-buffer))
+          (with-current-buffer (newsticker--treeview-tree-buffer)
             (widget-value-set w (widget-value w)))
           (goto-char p))))))
 
@@ -1045,8 +1036,7 @@
                              (newsticker--treeview-get-current-node)
                                         :parent) :from)))
     (when (or (integerp pos) (and (markerp pos) (marker-position pos)))
-      (save-excursion
-        (set-buffer (newsticker--treeview-tree-buffer))
+      (with-current-buffer (newsticker--treeview-tree-buffer)
         (goto-char pos)
         (move-overlay newsticker--tree-selection-overlay
                       (save-excursion (beginning-of-line) (point))
@@ -1167,8 +1157,7 @@
 (defun newsticker-treeview-browse-url ()
   "Call `browse-url' for the link of the item at point."
   (interactive)
-  (save-excursion
-    (set-buffer (newsticker--treeview-list-buffer))
+  (with-current-buffer (newsticker--treeview-list-buffer)
     (let ((url (get-text-property (point) :nt-link)))
       (when url
         (browse-url url)
@@ -1186,15 +1175,13 @@
                (get-buffer-create "*Newsticker Item*") t)
 
   (unless newsticker--selection-overlay
-    (save-excursion
-      (set-buffer (newsticker--treeview-list-buffer))
+    (with-current-buffer (newsticker--treeview-list-buffer)
       (setq newsticker--selection-overlay (make-overlay (point-min)
                                                         (point-max)))
       (overlay-put newsticker--selection-overlay 'face
                    'newsticker-treeview-selection-face)))
   (unless newsticker--tree-selection-overlay
-    (save-excursion
-      (set-buffer (newsticker--treeview-tree-buffer))
+    (with-current-buffer (newsticker--treeview-tree-buffer)
       (setq newsticker--tree-selection-overlay (make-overlay (point-min)
                                                              (point-max)))
       (overlay-put newsticker--tree-selection-overlay 'face
@@ -1237,11 +1224,10 @@
 (defun newsticker-treeview-save ()
   "Save newsticker data including treeview settings."
   (interactive)
-  (save-excursion
-    (let ((coding-system-for-write 'utf-8)
-          (buf (find-file-noselect (concat newsticker-dir "/groups"))))
-      (when buf
-        (set-buffer buf)
+  (let ((coding-system-for-write 'utf-8)
+        (buf (find-file-noselect (concat newsticker-dir "/groups"))))
+    (when buf
+      (with-current-buffer buf
         (setq buffer-undo-list t)
         (erase-buffer)
         (insert ";; -*- coding: utf-8 -*-\n")
@@ -1287,8 +1273,7 @@
   (interactive)
   (newsticker--treeview-restore-layout)
   (newsticker--treeview-list-update-highlight)
-  (save-excursion
-    (set-buffer (newsticker--treeview-list-buffer))
+  (with-current-buffer (newsticker--treeview-list-buffer)
     (beginning-of-line)
     (let ((item (get-text-property (point) :nt-item))
           (feed (get-text-property (point) :nt-feed)))
@@ -1375,8 +1360,7 @@
 
 (defun newsticker--treeview-get-selected-item ()
   "Return item that is currently selected in list buffer."
-  (save-excursion
-    (set-buffer (newsticker--treeview-list-buffer))
+  (with-current-buffer (newsticker--treeview-list-buffer)
     (beginning-of-line)
     (get-text-property (point) :nt-item)))
 
@@ -1415,8 +1399,7 @@
   (interactive)
   (let ((current-feed (or newsticker--treeview-current-feed
                           newsticker--treeview-current-vfeed)))
-    (save-excursion
-      (set-buffer (newsticker--treeview-list-buffer))
+    (with-current-buffer (newsticker--treeview-list-buffer)
       (goto-char (point-min))
       (while (not (eobp))
         (let ((item (get-text-property (point) :nt-item)))
@@ -1443,8 +1426,7 @@
 
 (defun newsticker--treeview-set-current-node (node)
   "Make NODE the current node."
-  (save-excursion
-    (set-buffer (newsticker--treeview-tree-buffer))
+  (with-current-buffer (newsticker--treeview-tree-buffer)
     (setq newsticker--treeview-current-node-id
           (widget-get node :nt-id))
     (setq newsticker--treeview-current-feed (widget-get node :nt-feed))
@@ -1626,8 +1608,7 @@
         (newsticker--treeview-unfold-node group-name))
       (setq node (newsticker--treeview-get-node-of-feed feed-name)))
     (when node
-      (save-excursion
-        (set-buffer (newsticker--treeview-tree-buffer))
+      (with-current-buffer (newsticker--treeview-tree-buffer)
         (widget-put node :nt-selected t)
         (widget-apply-action node)
         (newsticker--treeview-set-current-node node)))))
--- a/lisp/net/rcirc.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/net/rcirc.el	Sat Oct 31 02:38:34 2009 +0000
@@ -564,8 +564,7 @@
 Debug text is written to `rcirc-debug-buffer' if `rcirc-debug-flag'
 is non-nil."
   (when rcirc-debug-flag
-    (save-excursion
-      (set-buffer (get-buffer-create rcirc-debug-buffer))
+    (with-current-buffer (get-buffer-create rcirc-debug-buffer)
       (goto-char (point-max))
       (insert (concat
 	       "["
--- a/lisp/obsolete/iso-acc.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/obsolete/iso-acc.el	Sat Oct 31 02:38:34 2009 +0000
@@ -482,8 +482,7 @@
 ;; if it was in use in the previous buffer.
 (defun iso-acc-minibuf-setup ()
   (setq iso-accents-mode
-	(save-excursion
-	  (set-buffer (window-buffer minibuffer-scroll-window))
+	(with-current-buffer (window-buffer minibuffer-scroll-window)
 	  iso-accents-mode)))
 
 (add-hook 'minibuffer-setup-hook 'iso-acc-minibuf-setup)
--- a/lisp/obsolete/resume.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/obsolete/resume.el	Sat Oct 31 02:38:34 2009 +0000
@@ -107,8 +107,7 @@
 ;;;###autoload
 (defun resume-suspend-hook ()
   "Clear out the file used for transmitting args when Emacs resumes."
-  (save-excursion
-    (set-buffer (get-buffer-create resume-emacs-args-buffer))
+  (with-current-buffer (get-buffer-create resume-emacs-args-buffer)
     (erase-buffer)
     (resume-write-buffer-to-file (current-buffer) resume-emacs-args-file)))
 
@@ -116,8 +115,7 @@
   "Writes the contents of BUFFER into FILE, if permissions allow."
   (if (not (file-writable-p file))
       (error "No permission to write file %s" file))
-  (save-excursion
-    (set-buffer buffer)
+  (with-current-buffer buffer
     (clear-visited-file-modtime)
     (save-restriction
       (widen)
--- a/lisp/obsolete/rnews.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/obsolete/rnews.el	Sat Oct 31 02:38:34 2009 +0000
@@ -453,8 +453,7 @@
   "Display all the news groups to which you belong."
   (interactive)
   (with-output-to-temp-buffer "*Newsgroups*"
-    (save-excursion
-      (set-buffer standard-output)
+    (with-current-buffer standard-output
       (insert
 	"News Group        Msg No.       News Group        Msg No.\n")
       (insert
--- a/lisp/progmodes/ada-xref.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/ada-xref.el	Sat Oct 31 02:38:34 2009 +0000
@@ -355,8 +355,7 @@
 GPR_FILE must be full path to file, normalized.
 src_dir, obj_dir will include compiler runtime.
 Assumes environment variable ADA_PROJECT_PATH is set properly."
-  (save-excursion
-    (set-buffer (get-buffer-create "*gnatls*"))
+  (with-current-buffer (get-buffer-create "*gnatls*")
     (erase-buffer)
 
     ;; this can take a long time; let the user know what's up
@@ -1041,16 +1040,14 @@
 	  (setq command (concat command " -p\"" ada-prj-default-project-file "\""))))
 
     (if (and append (get-buffer ada-gnatfind-buffer-name))
-	(save-excursion
-	  (set-buffer "*gnatfind*")
+	(with-current-buffer "*gnatfind*"
 	  (setq old-contents (buffer-string))))
 
     (let ((compilation-error "reference"))
       (compilation-start command 'compilation-mode (lambda (mode) ada-gnatfind-buffer-name)))
 
     ;;  Hide the "Compilation" menu
-    (save-excursion
-      (set-buffer ada-gnatfind-buffer-name)
+    (with-current-buffer ada-gnatfind-buffer-name
       (local-unset-key [menu-bar compilation-menu])
 
       (if old-contents
@@ -1318,8 +1315,7 @@
 					    command)))
 
     ;; Run the command
-    (save-excursion
-      (set-buffer (get-buffer-create "*run*"))
+    (with-current-buffer (get-buffer-create "*run*")
       (set 'buffer-read-only nil)
 
       (erase-buffer)
@@ -1547,8 +1543,7 @@
   ;;      the 'D' lines.  This is done repeatedly, in case the direct parent is
   ;;      also a separate.
 
-  (save-excursion
-    (set-buffer (get-file-buffer file))
+  (with-current-buffer (get-file-buffer file)
     (let ((short-ali-file-name
 	   (concat (file-name-sans-extension (file-name-nondirectory file))
 		   ".ali"))
@@ -2044,13 +2039,11 @@
 	choice
 	file)
 
-    (save-excursion
+    ;;  Do the grep in all the directories.  We do multiple shell
+    ;;  commands instead of one in case there is no .ali file in one
+    ;;  of the directory and the shell stops because of that.
 
-      ;;  Do the grep in all the directories.  We do multiple shell
-      ;;  commands instead of one in case there is no .ali file in one
-      ;;  of the directory and the shell stops because of that.
-
-      (set-buffer (get-buffer-create "*grep*"))
+    (with-current-buffer (get-buffer-create "*grep*")
       (while dirs
 	(insert (shell-command-to-string
 		 (concat
@@ -2234,8 +2227,7 @@
 	(unit-name nil)
 	(body-name nil)
 	(ali-name nil))
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (goto-char (point-min))
       (re-search-forward "^U \\([^ \t%]+\\)%[bs][ \t]+\\([^ \t]+\\)")
       (setq unit-name (match-string 1))
@@ -2280,8 +2272,7 @@
 This is a GNAT specific function that uses gnatkrunch."
   (let ((krunch-buf (generate-new-buffer "*gkrunch*"))
         (cross-prefix (plist-get (cdr (ada-xref-current-project)) 'cross_prefix)))
-    (save-excursion
-      (set-buffer krunch-buf)
+    (with-current-buffer krunch-buf
       ;; send adaname to external process `gnatkr'.
       ;; Add a dummy extension, since gnatkr versions have two different
       ;; behaviors depending on the version:
@@ -2340,8 +2331,7 @@
 				" " gnatstub-opts " " filename))
 	 (buffer        (get-buffer-create "*gnat stub*")))
 
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (compilation-minor-mode 1)
       (erase-buffer)
       (insert gnatstub-cmd)
--- a/lisp/progmodes/antlr-mode.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/antlr-mode.el	Sat Oct 31 02:38:34 2009 +0000
@@ -1087,8 +1087,7 @@
 ;; checkdoc-params: (dummies)
   "Invalidate context cache for syntactical context information."
   :XEMACS				; XEmacs bug workaround
-  (save-excursion
-    (set-buffer (get-buffer-create " ANTLR XEmacs bug workaround"))
+  (with-current-buffer (get-buffer-create " ANTLR XEmacs bug workaround")
     (buffer-syntactic-context-depth)
     nil)
   :EMACS
@@ -2182,8 +2181,7 @@
 				     "\\'"))
 	    classes dependencies)
 	(unwind-protect
-	    (save-excursion
-	      (set-buffer temp-buffer)
+	    (with-current-buffer temp-buffer
 	      (widen)			; just in case...
 	      (dolist (file grammar)
 		(when (and (file-regular-p file)
--- a/lisp/progmodes/cc-defs.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/cc-defs.el	Sat Oct 31 02:38:34 2009 +0000
@@ -1469,8 +1469,7 @@
 	  parse-sexp-lookup-properties
 	  parse-sexp-ignore-comments
 	  lookup-syntax-properties)
-      (save-excursion
-	(set-buffer buf)
+      (with-current-buffer buf
 	(set-syntax-table (make-syntax-table))
 
 	;; For some reason we have to set some of these after the
--- a/lisp/progmodes/cperl-mode.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/cperl-mode.el	Sat Oct 31 02:38:34 2009 +0000
@@ -8571,8 +8571,7 @@
   (let* ((pod2man-args (concat buffer-file-name " | nroff -man "))
 	 (bufname (concat "Man " buffer-file-name))
 	 (buffer (generate-new-buffer bufname)))
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (let ((process-environment (copy-sequence process-environment)))
         ;; Prevent any attempt to use display terminal fanciness.
         (setenv "TERM" "dumb")
--- a/lisp/progmodes/cpp.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/cpp.el	Sat Oct 31 02:38:34 2009 +0000
@@ -575,8 +575,7 @@
   "Save the current cpp configuration in a file."
   (interactive)
   (require 'pp)
-  (save-excursion
-    (set-buffer cpp-edit-buffer)
+  (with-current-buffer cpp-edit-buffer
     (let ((buffer (find-file-noselect cpp-config-file)))
       (set-buffer buffer)
       (erase-buffer)
--- a/lisp/progmodes/ebnf2ps.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/ebnf2ps.el	Sat Oct 31 02:38:34 2009 +0000
@@ -4565,8 +4565,7 @@
 		    horizontal  (memq (ebnf-node-action prod)
 				      ebnf-action-list))
 	      ;; generate production in EPS buffer
-	      (save-excursion
-		(set-buffer eps-buffer)
+	      (with-current-buffer eps-buffer
 		(setq ebnf-eps-upper-x    0.0
 		      ebnf-eps-upper-y    0.0
 		      ebnf-eps-max-width  prod-width
@@ -4581,8 +4580,7 @@
 		(ebnf-eps-finish-and-write eps-buffer
 					   (ebnf-eps-filename prod-name)))
 	      ;; prepare for next loop
-	      (save-excursion
-		(set-buffer eps-buffer)
+	      (with-current-buffer eps-buffer
 		(erase-buffer))
 	      (setq ebnf-tree (cdr ebnf-tree)))
 	    ;; write and kill temporary buffers
@@ -4617,8 +4615,7 @@
 					   prod-width prod-height eps-buffer)
   (while prod-list
     (add-to-list file-list-sym (car prod-list))
-    (save-excursion
-      (set-buffer (get-buffer-create (concat " *" (car prod-list) "*")))
+    (with-current-buffer (get-buffer-create (concat " *" (car prod-list) "*"))
       (goto-char (point-max))
       (cond
        ;; first production
@@ -5278,8 +5275,7 @@
 
 (defun ebnf-begin-file ()
   (ps-flush-output)
-  (save-excursion
-    (set-buffer ps-spool-buffer)
+  (with-current-buffer ps-spool-buffer
     (goto-char (point-min))
     (and (search-forward "%%Creator: " nil t)
 	 (not (search-forward "& ebnf2ps v"
@@ -5299,8 +5295,7 @@
 
 (defun ebnf-eps-finish-and-write (buffer filename)
   (when (buffer-modified-p buffer)
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (ebnf-eps-header-footer-set filename)
       (setq ebnf-eps-upper-x (max ebnf-eps-upper-x ebnf-eps-max-width)
 	    ebnf-eps-upper-y (if (zerop ebnf-eps-upper-y)
@@ -6349,8 +6344,7 @@
 
 (defun ebnf-log (format-str &rest args)
   (when ebnf-log
-    (save-excursion
-      (set-buffer (get-buffer-create "*Ebnf2ps Log*"))
+    (with-current-buffer (get-buffer-create "*Ebnf2ps Log*")
       (goto-char (point-max))
       (insert (apply 'format format-str args) "\n"))))
 
--- a/lisp/progmodes/ebrowse.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/ebrowse.el	Sat Oct 31 02:38:34 2009 +0000
@@ -1002,8 +1002,7 @@
     (loop for buffer in (ebrowse-browser-buffer-list)
 	  until (eq header (ebrowse-value-in-buffer 'ebrowse--header buffer))
 	  finally do
-	  (save-excursion
-	    (set-buffer buffer)
+	  (with-current-buffer buffer
 	    (ebrowse-fill-member-table))))
   (ebrowse-hs-member-table header))
 
@@ -1613,8 +1612,7 @@
 Restore frame configuration active before viewing the file,
 and possibly kill the viewed buffer."
   (let (exit-action original-frame-configuration)
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (setq original-frame-configuration ebrowse--frame-configuration
 	    exit-action ebrowse--view-exit-action))
     ;; Delete the frame in which we viewed.
@@ -3555,7 +3553,7 @@
   (interactive)
   (let* ((buffer (or (ebrowse-choose-from-browser-buffers)
 		     (error "No tree buffer")))
-	 (files (save-excursion (set-buffer buffer) (ebrowse-files-table)))
+	 (files (with-current-buffer buffer (ebrowse-files-table)))
 	 (file (completing-read "List members in file: " files nil t))
 	 (header (ebrowse-value-in-buffer 'ebrowse--header buffer))
 	 temp-buffer-setup-hook
@@ -3733,8 +3731,7 @@
   ;; on which tree (s)he wants to operate.
   (when initialize
     (let ((buffer (or tree-buffer (ebrowse-choose-from-browser-buffers))))
-      (save-excursion
-	(set-buffer buffer)
+      (with-current-buffer buffer
 	(setq ebrowse-tags-next-file-list
 	      (ebrowse-files-list (ebrowse-marked-classes-p))
 	      ebrowse-tags-loop-last-file
@@ -4124,8 +4121,7 @@
 	(header (copy-ebrowse-hs ebrowse--header))
 	(tree ebrowse--tree))
     (unwind-protect
-	(save-excursion
-	  (set-buffer (setq standard-output temp-buffer))
+	(with-current-buffer (setq standard-output temp-buffer)
 	  (erase-buffer)
 	  (setf (ebrowse-hs-member-table header) nil)
 	  (insert (prin1-to-string header) " ")
@@ -4210,8 +4206,8 @@
 
 ;;; Global key bindings
 
-;;; The following can be used to bind key sequences starting with
-;;; prefix `\C-c\C-m' to browse commands.
+;; The following can be used to bind key sequences starting with
+;; prefix `\C-c\C-m' to browse commands.
 
 (defvar ebrowse-global-map nil
   "*Keymap for Ebrowse commands.")
@@ -4270,14 +4266,14 @@
 
 ;;; Electric C++ browser buffer menu
 
-;;; Electric buffer menu customization to display only some buffers
-;;; (in this case Tree buffers).  There is only one problem with this:
-;;; If the very first character typed in the buffer menu is a space,
-;;; this will select the buffer from which the buffer menu was
-;;; invoked.  But this buffer is not displayed in the buffer list if
-;;; it isn't a tree buffer.  I therefore let the buffer menu command
-;;; loop read the command `p' via `unread-command-char'.  This command
-;;; has no effect since we are on the first line of the buffer.
+;; Electric buffer menu customization to display only some buffers
+;; (in this case Tree buffers).  There is only one problem with this:
+;; If the very first character typed in the buffer menu is a space,
+;; this will select the buffer from which the buffer menu was
+;; invoked.  But this buffer is not displayed in the buffer list if
+;; it isn't a tree buffer.  I therefore let the buffer menu command
+;; loop read the command `p' via `unread-command-char'.  This command
+;; has no effect since we are on the first line of the buffer.
 
 (defvar electric-buffer-menu-mode-hook nil)
 
--- a/lisp/progmodes/gdb-mi.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/gdb-mi.el	Sat Oct 31 02:38:34 2009 +0000
@@ -2465,8 +2465,7 @@
 	 obj)
     (when (numberp pos)
       (with-selected-window (posn-window posn)
-	(save-excursion
-	  (set-buffer (window-buffer (selected-window)))
+	(with-current-buffer (window-buffer (selected-window))
 	  (goto-char pos)
 	  (dolist (overlay (overlays-in pos pos))
 	    (when (overlay-get overlay 'put-break)
--- a/lisp/progmodes/gud.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/gud.el	Sat Oct 31 02:38:34 2009 +0000
@@ -2831,8 +2831,7 @@
   (let ((proc (get-buffer-process gud-comint-buffer)))
     (or proc (error "Current buffer has no process"))
     ;; Arrange for the current prompt to get deleted.
-    (save-excursion
-      (set-buffer gud-comint-buffer)
+    (with-current-buffer gud-comint-buffer
       (save-restriction
 	(widen)
 	(if (marker-position gud-delete-prompt-marker)
@@ -3062,8 +3061,7 @@
           ;; symbols until 'topmost-intro is reached to find out if
           ;; point is within a nested class
           (if (and fbuffer (equal (symbol-file 'java-mode) "cc-mode"))
-              (save-excursion
-                (set-buffer fbuffer)
+              (with-current-buffer fbuffer
                 (let ((nclass) (syntax))
                   ;; While the c-syntactic information does not start
                   ;; with the 'topmost-intro symbol, there may be
@@ -3327,8 +3325,7 @@
   (remove-hook 'post-command-hook
 	       'gud-tooltip-activate-mouse-motions-if-enabled)
   (dolist (buffer (buffer-list))
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (if (and gud-tooltip-mode
 	       (memq major-mode gud-tooltip-modes))
 	  (gud-tooltip-activate-mouse-motions t)
--- a/lisp/progmodes/idlw-help.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/idlw-help.el	Sat Oct 31 02:38:34 2009 +0000
@@ -807,8 +807,7 @@
 (defun idlwave-help-get-special-help (name type class keyword)
   "Call the function given by `idlwave-extra-help-function'."
   (let* ((cw (selected-window))
-	 (help-pos (save-excursion
-		     (set-buffer (idlwave-help-get-help-buffer))
+	 (help-pos (with-current-buffer (idlwave-help-get-help-buffer)
 		     (let ((buffer-read-only nil))
 		       (funcall idlwave-extra-help-function
 				name type class keyword)))))
@@ -1224,8 +1223,7 @@
     (if buf
 	nil
       (setq buf (get-buffer-create "*IDLWAVE Help*"))
-      (save-excursion
-	(set-buffer buf)
+      (with-current-buffer buf
 	(idlwave-help-mode)))
     buf))
 
--- a/lisp/progmodes/idlw-shell.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/idlw-shell.el	Sat Oct 31 02:38:34 2009 +0000
@@ -1541,11 +1541,11 @@
 		      (concat idlwave-shell-accumulation string)))
 
 
-;;; Test/Debug code
-	      ;(with-current-buffer
-	      ;	  (get-buffer-create "*idlwave-shell-output*")
-	      ;	(goto-char (point-max))
-	      ;	(insert "\nReceived STRING\n===>\n" string "\n<====\n"))
+              ;; ;; Test/Debug code
+	      ;;(with-current-buffer
+	      ;;    (get-buffer-create "*idlwave-shell-output*")
+	      ;;  (goto-char (point-max))
+	      ;;  (insert "\nReceived STRING\n===>\n" string "\n<====\n"))
 
 	      ;; Check for prompt in current accumulating output
 	      (when (setq idlwave-shell-ready
@@ -1553,8 +1553,7 @@
 					idlwave-shell-accumulation))
 		;; Gather the command output
 		(if idlwave-shell-hide-output
-		    (save-excursion
-		      (set-buffer idlwave-shell-hidden-output-buffer)
+		    (with-current-buffer idlwave-shell-hidden-output-buffer
 		      (setq full-output (buffer-string))
 		      (goto-char (point-max))
 		      (re-search-backward idlwave-shell-prompt-pattern nil t)
@@ -1618,8 +1617,7 @@
   (let* ((buf (idlwave-shell-buffer))
 	 (win (get-buffer-window buf)))
     (when (get-buffer buf)
-      (save-excursion
-	(set-buffer (idlwave-shell-buffer))
+      (with-current-buffer (idlwave-shell-buffer)
 	(goto-char (point-max))
 	(insert (format "\n\n  Process %s %s" process event))
 	(if (and idlwave-shell-save-command-history
@@ -1639,8 +1637,7 @@
     (idlwave-shell-cleanup)
     ;; Run the hook, if possible in the shell buffer.
     (if (get-buffer buf)
-	(save-excursion
-	  (set-buffer buf)
+	(with-current-buffer buf
 	  (run-hooks 'idlwave-shell-sentinel-hook))
       (run-hooks 'idlwave-shell-sentinel-hook))))
 
@@ -2088,13 +2085,12 @@
 (defun idlwave-shell-filter-directory ()
   "Get the current directory from `idlwave-shell-command-output'.
 Change the default directory for the process buffer to concur."
-  (save-excursion
-    (set-buffer (idlwave-shell-buffer))
+  (with-current-buffer (idlwave-shell-buffer)
     (if (string-match ",___cur[\n\r ]+\\([^\n\r]+\\)[\n\r]"
 		      idlwave-shell-command-output)
 	(let ((dir (substring idlwave-shell-command-output
 			      (match-beginning 1) (match-end 1))))
-;	  (message "Setting Emacs working dir to %s" dir)
+          ;; (message "Setting Emacs working dir to %s" dir)
 	  (setq idlwave-shell-default-directory dir)
 	  (setq default-directory (file-name-as-directory dir))))))
 
@@ -2363,10 +2359,10 @@
 	;; fixme: errors are dangerous in shell filters.  but i think i
 	;; have never encountered this one.
         (error "invalid frame - unable to access file: %s" (car frame))
-;;;
-;;; buffer : the buffer to display a line in.
-;;; select-shell: current buffer is the shell.
-;;;
+      ;;
+      ;; buffer : the buffer to display a line in.
+      ;; select-shell: current buffer is the shell.
+      ;;
       (setq idlwave-shell-mode-line-info
 	    (if (nth 2 frame)
 		(format "[%d:%s]"
@@ -2385,8 +2381,7 @@
 					     nil (idlwave-shell-source-frame)))
 
 	;; enter the buffer and mark the line
-        (save-excursion
-          (set-buffer buffer)
+        (with-current-buffer buffer
           (save-restriction
             (widen)
             (goto-char (point-min))
@@ -2713,8 +2708,7 @@
 	  (message "The source file for module %s is probably not compiled"
 		   module)
 	  (beep))
-      (save-excursion
-	(set-buffer buf)
+      (with-current-buffer buf
 	(save-excursion
 	  (goto-char (point-min))
 	  (let ((case-fold-search t))
@@ -2822,8 +2816,8 @@
        (idlwave-shell-print (if (idlwave-region-active-p) '(4) nil)
 			    ,help ,ev))))
 
-;;; Begin terrible hack section -- XEmacs tests for button2 explicitly
-;;; on drag events, calling drag-n-drop code if detected.  Ughhh...
+;; Begin terrible hack section -- XEmacs tests for button2 explicitly
+;; on drag events, calling drag-n-drop code if detected.  Ughhh...
 (defun idlwave-default-mouse-track-event-is-with-button (event n)
   t)
 
@@ -3035,8 +3029,7 @@
 (defun idlwave-shell-examine-display ()
   "View the examine command output in a separate buffer."
   (let (win cur-beg cur-end)
-    (save-excursion
-      (set-buffer (get-buffer-create "*Examine*"))
+    (with-current-buffer (get-buffer-create "*Examine*")
       (use-local-map idlwave-shell-examine-map)
       (setq buffer-read-only nil)
       (goto-char (point-max))
@@ -3121,13 +3114,11 @@
 
 (defun idlwave-shell-examine-display-clear ()
   (interactive)
-  (save-excursion
-    (let ((buf (get-buffer "*Examine*")))
-      (when (bufferp buf)
-	(set-buffer buf)
-	(setq buffer-read-only nil)
-	(erase-buffer)
-	(setq buffer-read-only t)))))
+  (let ((buf (get-buffer "*Examine*")))
+    (when (bufferp buf)
+      (with-current-buffer buf
+	(let ((inhibit-read-only t))
+          (erase-buffer))))))
 
 (defun idlwave-retrieve-expression-from-level (expr level)
   "Return IDL command to print the expression EXPR from stack level LEVEL.
@@ -3222,8 +3213,7 @@
 	 (process (get-buffer-process buffer))
 	 (process-mark (if process (process-mark process)))
 	 output-begin output-end)
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (goto-char process-mark)
       (beginning-of-line)
       (setq output-end (point))
@@ -3295,9 +3285,8 @@
 If there is a prefix argument, display IDL process."
   (interactive "r\nP")
   (let ((oldbuf (current-buffer)))
-    (save-excursion
-      (set-buffer (idlwave-find-file-noselect
-		   (idlwave-shell-temp-file 'pro) 'tmp))
+    (with-current-buffer (idlwave-find-file-noselect
+                          (idlwave-shell-temp-file 'pro) 'tmp)
       (set (make-local-variable 'comment-start-skip) ";+[ \t]*")
       (set (make-local-variable 'comment-start) ";")
       (erase-buffer)
@@ -3410,8 +3399,7 @@
 Create `idlwave-shell-bp-alist' updating breakpoint count and command
 data from previous breakpoint list.  If NO-SHOW is set, don't update
 the breakpoint overlays."
-  (save-excursion
-    (set-buffer (get-buffer-create idlwave-shell-bp-buffer))
+  (with-current-buffer (get-buffer-create idlwave-shell-bp-buffer)
     (erase-buffer)
     (insert idlwave-shell-command-output)
     (goto-char (point-min))
@@ -3914,8 +3902,7 @@
      (idlwave-shell-last-save-and-action-file
       (if (setq buf (idlwave-get-buffer-visiting
 		     idlwave-shell-last-save-and-action-file))
-	  (save-excursion
-	    (set-buffer buf)
+	  (with-current-buffer buf
 	    (save-buffer))))
      (t (setq idlwave-shell-last-save-and-action-file
 	      (read-file-name "File: ")))))
@@ -3995,8 +3982,7 @@
 Create `idlwave-shell-sources-alist' consisting of list elements
 of the form:
  (module name . (source-file-truename idlwave-internal-filename))"
-  (save-excursion
-    (set-buffer (get-buffer-create idlwave-shell-bp-buffer))
+  (with-current-buffer (get-buffer-create idlwave-shell-bp-buffer)
     (erase-buffer)
     (insert idlwave-shell-command-output)
     (goto-char (point-min))
@@ -4068,8 +4054,7 @@
   "Move point to next IDL syntax error."
   (interactive)
   (let (frame col)
-    (save-excursion
-      (set-buffer idlwave-shell-error-buffer)
+    (with-current-buffer idlwave-shell-error-buffer
       (goto-char idlwave-shell-error-last)
       (if (or
 	   (re-search-forward idlwave-shell-syntax-error nil t)
@@ -4526,14 +4511,13 @@
       (easy-menu-define
        idlwave-shell-mode-menu idlwave-shell-mode-map "IDL shell menus"
        idlwave-shell-menu-def)
-      (save-excursion
-	(mapc (lambda (buf)
-		(set-buffer buf)
-		(if (eq major-mode 'idlwave-mode)
-		    (progn
-		      (easy-menu-remove idlwave-mode-debug-menu)
-		      (easy-menu-add idlwave-mode-debug-menu))))
-	      (buffer-list)))))
+      (save-current-buffer
+	(dolist (buf (buffer-list))
+          (set-buffer buf)
+          (if (eq major-mode 'idlwave-mode)
+              (progn
+                (easy-menu-remove idlwave-mode-debug-menu)
+                (easy-menu-add idlwave-mode-debug-menu)))))))
 
 ;; The Breakpoint Glyph -------------------------------------------------------
 
@@ -4694,7 +4678,7 @@
 (provide 'idlw-shell)
 (provide 'idlwave-shell)
 
-;;; Load the toolbar when wanted by the user.
+;; Load the toolbar when wanted by the user.
 
 (autoload 'idlwave-toolbar-toggle "idlw-toolbar"
   "Toggle the IDLWAVE toolbar.")
--- a/lisp/progmodes/idlwave.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/idlwave.el	Sat Oct 31 02:38:34 2009 +0000
@@ -5512,8 +5512,7 @@
 	  idlwave-path-alist path-alist ; for library-path instead
 	  idlwave-true-path-alist nil)
     (if idlwave-auto-write-paths (idlwave-write-paths))
-    (save-excursion
-      (set-buffer (get-buffer-create "*idlwave-scan.pro*"))
+    (with-current-buffer (get-buffer-create "*idlwave-scan.pro*")
       (idlwave-mode)
       (setq dirs-alist (reverse path-alist))
       (while (setq dir (pop dirs-alist))
@@ -5818,9 +5817,8 @@
 (defun idlwave-shell-compile-helper-routines (&optional wait)
   (unless (and idlwave-idlwave_routine_info-compiled
 	       (file-readable-p (idlwave-shell-temp-file 'rinfo)))
-    (save-excursion
-      (set-buffer (idlwave-find-file-noselect
-		   (idlwave-shell-temp-file 'pro)))
+    (with-current-buffer (idlwave-find-file-noselect
+                          (idlwave-shell-temp-file 'pro))
       (erase-buffer)
       (insert idlwave-routine-info.pro)
       (save-buffer 0))
@@ -7171,14 +7169,12 @@
 
 (defun idlwave-set-local (var value &optional buffer)
   "Set the buffer-local value of VAR in BUFFER to VALUE."
-  (save-excursion
-    (set-buffer (or buffer (current-buffer)))
+  (with-current-buffer (or buffer (current-buffer))
     (set (make-local-variable var) value)))
 
 (defun idlwave-local-value (var &optional buffer)
   "Return the value of VAR in BUFFER, but only if VAR is local to BUFFER."
-  (save-excursion
-    (set-buffer (or buffer (current-buffer)))
+  (with-current-buffer (or buffer (current-buffer))
     (and (local-variable-p var (current-buffer))
 	 (symbol-value var))))
 
@@ -7194,8 +7190,7 @@
     (apply 'display-completion-list list
 	   ':activate-callback 'idlwave-default-choose-completion
 	   cl-args))
-  (save-excursion
-    (set-buffer "*Completions*")
+  (with-current-buffer "*Completions*"
     (use-local-map
      (or idlwave-completion-map
 	 (setq idlwave-completion-map
@@ -7222,8 +7217,7 @@
   "Display completion list and install the choose wrappers."
   (with-output-to-temp-buffer "*Completions*"
     (display-completion-list list))
-  (save-excursion
-    (set-buffer "*Completions*")
+  (with-current-buffer "*Completions*"
     (use-local-map
      (or idlwave-completion-map
 	 (setq idlwave-completion-map
@@ -7837,8 +7831,7 @@
 (defun idlwave-completion-fontify-classes ()
   "Goto the *Completions* buffer and fontify the class info."
   (when (featurep 'font-lock)
-    (save-excursion
-      (set-buffer "*Completions*")
+    (with-current-buffer "*Completions*"
       (save-excursion
 	(goto-char (point-min))
 	(let ((buffer-read-only nil))
@@ -8385,9 +8378,8 @@
      ((null calling-seq)
       (error "Calling sequence of %s %s not available" type name))
      (t
-      (save-excursion
-	(move-marker idlwave-rinfo-marker (point))
-	(set-buffer (get-buffer-create "*Help*"))
+      (move-marker idlwave-rinfo-marker (point))
+      (with-current-buffer (get-buffer-create "*Help*")
 	(use-local-map idlwave-rinfo-map)
 	(setq buffer-read-only nil)
 	(erase-buffer)
@@ -8755,8 +8747,7 @@
 	(apply 'idlwave-do-find-module
 	       (get-text-property (point) 'find-args))))
     (message "Compiling list...( 0%%)")
-    (save-excursion
-      (set-buffer (get-buffer-create "*Shadows*"))
+    (with-current-buffer (get-buffer-create "*Shadows*")
       (setq buffer-read-only nil)
       (erase-buffer)
       (while (setq routine (pop routines))
@@ -9358,8 +9349,7 @@
 	 (princ (format fmt str rpl func)))
        abbrevs)))
   ;; Make sure each abbreviation uses only one display line
-  (save-excursion
-    (set-buffer "*Help*")
+  (with-current-buffer "*Help*"
     (setq truncate-lines t)))
 
 ;; Add .pro files to speedbar for support, if it's loaded
--- a/lisp/progmodes/octave-inf.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/octave-inf.el	Sat Oct 31 02:38:34 2009 +0000
@@ -178,8 +178,7 @@
     (get-buffer-create buffer)
     (if (comint-check-proc buffer)
 	()
-      (save-excursion
-	(set-buffer buffer)
+      (with-current-buffer buffer
 	(comint-mode)
 	(inferior-octave-startup)
 	(inferior-octave-mode)))
--- a/lisp/progmodes/python.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/python.el	Sat Oct 31 02:38:34 2009 +0000
@@ -2654,8 +2654,7 @@
                  ;; Add in number of lines for leading '##' comments:
                  (setq lineno
                        (+ lineno
-                          (save-excursion
-                            (set-buffer funcbuffer)
+                          (with-current-buffer funcbuffer
                             (if (equal (point-min)(point-max))
                                 0
                               (count-lines
@@ -2683,13 +2682,12 @@
     (while (and buffers (not got))
       (setq buf (car buffers)
             buffers (cdr buffers))
-      (if (and (save-excursion (set-buffer buf)
-                               (string= major-mode "python-mode"))
+      (if (and (with-current-buffer buf
+                 (string= major-mode "python-mode"))
                (or (string-match funcname (buffer-name buf))
                    (string-match (concat "^\\s-*\\(def\\|class\\)\\s-+"
                                          funcname "\\s-*(")
-                                 (save-excursion
-                                   (set-buffer buf)
+                                 (with-current-buffer buf
                                    (buffer-substring (point-min)
                                                      (point-max))))))
           (setq got buf)))
@@ -2747,8 +2745,7 @@
         ;; add some comment, so that we can filter it out of history
 	(cmd (format "execfile(r'%s') # PYTHON-MODE\n" filename)))
     (unwind-protect
-	(save-excursion
-	  (set-buffer procbuf)
+	(with-current-buffer procbuf
 	  (goto-char (point-max))
 	  (move-marker (process-mark proc) (point))
 	  (funcall (process-filter proc) proc msg))
--- a/lisp/progmodes/sh-script.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/sh-script.el	Sat Oct 31 02:38:34 2009 +0000
@@ -2978,8 +2978,7 @@
 ;;
 ;; (defun what-i-learned (list)
 ;;   (let ((p list))
-;;     (save-excursion
-;;       (set-buffer "*scratch*")
+;;     (with-current-buffer "*scratch*"
 ;;       (goto-char (point-max))
 ;;       (insert "(setq\n")
 ;;       (while p
--- a/lisp/progmodes/verilog-mode.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/verilog-mode.el	Sat Oct 31 02:38:34 2009 +0000
@@ -7137,7 +7137,10 @@
 	   uses-delayed)	;; Found signal/rvalue; push if not function
       (search-forward ")")
       (verilog-read-always-signals-recurse nil nil nil)
-      ;;(if dbg (save-excursion (set-buffer (get-buffer-create "*vl-dbg*")) (delete-region (point-min) (point-max)) (insert dbg) (setq dbg "")))
+      ;;(if dbg (with-current-buffer (get-buffer-create "*vl-dbg*")
+      ;;          (delete-region (point-min) (point-max))
+      ;;          (insert dbg)
+      ;;          (setq dbg "")))
       ;; Return what was found
       (list sigs-out nil sigs-in uses-delayed))))
 
@@ -7249,8 +7252,7 @@
 (defun verilog-set-define (defname defvalue &optional buffer enumname)
   "Set the definition DEFNAME to the DEFVALUE in the given BUFFER.
 Optionally associate it with the specified enumeration ENUMNAME."
-  (save-excursion
-    (set-buffer (or buffer (current-buffer)))
+  (with-current-buffer (or buffer (current-buffer))
     (let ((mac (intern (concat "vh-" defname))))
       ;;(message "Define %s=%s" defname defvalue) (sleep-for 1)
       ;; Need to define to a constant if no value given
@@ -7497,8 +7499,8 @@
 	(forward-line 1)
 	(when (string-match "//" line)
 	  (setq line (substring line 0 (match-beginning 0))))
-	(save-excursion
-	  (set-buffer orig-buffer)  ; Variables are buffer-local, so need right context.
+        ;; Variables are buffer-local, so need right context.
+	(with-current-buffer orig-buffer
 	  (verilog-getopt line))))))
 
 (defun verilog-getopt-flags ()
@@ -7599,11 +7601,11 @@
 	   (and (fboundp 'vc-backend)
 		(vc-backend filename)))
        (let (pt)
-	 (save-excursion
-	   (set-buffer (find-file-noselect filename))
+	 (with-current-buffer (find-file-noselect filename)
 	   (goto-char (point-min))
 	   (while (and
-		   ;; It may be tempting to look for verilog-defun-re, don't, it slows things down a lot!
+		   ;; It may be tempting to look for verilog-defun-re,
+		   ;; don't, it slows things down a lot!
 		   (verilog-re-search-forward-quick "\\<module\\>" nil t)
 		   (verilog-re-search-forward-quick "[(;]" nil t))
 	     (if (equal module (verilog-read-module-name))
--- a/lisp/progmodes/xscheme.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/progmodes/xscheme.el	Sat Oct 31 02:38:34 2009 +0000
@@ -264,8 +264,8 @@
     (setq-default xscheme-buffer-name buffer-name)
     (setq-default xscheme-process-name process-name)
     (setq-default xscheme-runlight-string
-		  (save-excursion (set-buffer buffer-name)
-				  xscheme-runlight-string))
+		  (with-current-buffer buffer-name
+                    xscheme-runlight-string))
     (setq-default xscheme-runlight
 		  (if (eq (process-status process-name) 'run)
 		      default-xscheme-runlight
@@ -283,8 +283,8 @@
     (make-local-variable 'xscheme-process-name)
     (setq xscheme-process-name process-name)
     (make-local-variable 'xscheme-runlight)
-    (setq xscheme-runlight (save-excursion (set-buffer buffer-name)
-					   xscheme-runlight))))
+    (setq xscheme-runlight (with-current-buffer buffer-name
+                             xscheme-runlight))))
 
 (defun local-clear-scheme-interaction-buffer ()
   "Make the current buffer use the default scheme interaction buffer."
@@ -305,8 +305,7 @@
 	  ((not process)
 	   (error "Buffer `%s' is not a scheme interaction buffer" buffer-name))
 	  (t
-	   (save-excursion
-	     (set-buffer buffer)
+	   (with-current-buffer buffer
 	     (if (not (xscheme-process-buffer-current-p))
 		 (error "Buffer `%s' is not a scheme interaction buffer"
 			buffer-name)))
@@ -469,8 +468,7 @@
       (scheme-interaction-mode-commands scheme-interaction-mode-map)))
 
 (defun xscheme-enter-interaction-mode ()
-  (save-excursion
-    (set-buffer (xscheme-process-buffer))
+  (with-current-buffer (xscheme-process-buffer)
     (if (not (eq major-mode 'scheme-interaction-mode))
 	(if (eq major-mode 'scheme-debugger-mode)
 	    (scheme-interaction-mode-initialize)
@@ -519,8 +517,7 @@
   (xscheme-send-char last-command-event))
 
 (defun xscheme-enter-debugger-mode (prompt-string)
-  (save-excursion
-    (set-buffer (xscheme-process-buffer))
+  (with-current-buffer (xscheme-process-buffer)
     (if (not (eq major-mode 'scheme-debugger-mode))
 	(progn
 	  (if (not (eq major-mode 'scheme-interaction-mode))
@@ -530,8 +527,7 @@
 (defun xscheme-debugger-mode-p ()
   (let ((buffer (xscheme-process-buffer)))
     (and buffer
-	 (save-excursion
-	   (set-buffer buffer)
+	 (with-current-buffer buffer
 	   (eq major-mode 'scheme-debugger-mode)))))
 
 ;;;; Evaluation Commands
@@ -765,13 +761,11 @@
   (let ((inhibit-quit t))
     (cond ((not xscheme-control-g-synchronization-p)
 	   (interrupt-process xscheme-process-name))
-	  ((save-excursion
-	     (set-buffer xscheme-buffer-name)
+	  ((with-current-buffer xscheme-buffer-name
 	     xscheme-control-g-disabled-p)
 	   (message "Relax..."))
 	  (t
-	   (save-excursion
-	     (set-buffer xscheme-buffer-name)
+	   (with-current-buffer xscheme-buffer-name
 	     (setq xscheme-control-g-disabled-p t))
 	   (message xscheme-control-g-message-string)
 	   (interrupt-process xscheme-process-name)
@@ -807,8 +801,7 @@
 (defun xscheme-start-process (command-line the-process the-buffer)
   (let ((buffer (get-buffer-create the-buffer)))
     (let ((process (get-buffer-process buffer)))
-      (save-excursion
-	(set-buffer buffer)
+      (with-current-buffer buffer
 	(if (and process (memq (process-status process) '(run stop)))
 	    (set-marker (process-mark process) (point-max))
 	    (progn (if process (delete-process process))
@@ -944,8 +937,7 @@
 (defun xscheme-process-sentinel (proc reason)
   (let* ((buffer (process-buffer proc))
 	 (name (buffer-name buffer)))
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (xscheme-process-filter-initialize (eq reason 'run))
       (if (not (eq reason 'run))
 	  (progn
@@ -983,8 +975,7 @@
 	(call-noexcursion nil))
     (while xscheme-filter-input
       (setq call-noexcursion nil)
-      (save-excursion
-	(set-buffer (process-buffer proc))
+      (with-current-buffer (process-buffer proc)
 	(cond ((eq xscheme-process-filter-state 'idle)
 	       (let ((start (string-match "\e" xscheme-filter-input)))
 		 (if start
@@ -1193,8 +1184,7 @@
       string))
 
 (defun xscheme-cd (directory-string)
-  (save-excursion
-    (set-buffer (xscheme-process-buffer))
+  (with-current-buffer (xscheme-process-buffer)
     (cd directory-string)))
 
 (defun xscheme-prompt-for-confirmation (prompt-string)
--- a/lisp/textmodes/artist.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/artist.el	Sat Oct 31 02:38:34 2009 +0000
@@ -1801,8 +1801,7 @@
 
 (defun artist-clear-buffer (buf)
   "Clear contents of buffer BUF."
-  (save-excursion
-    (set-buffer buf)
+  (with-current-buffer buf
     (goto-char (point-min))
     (delete-char (- (point-max) (point-min)) nil)))
 
@@ -1848,10 +1847,8 @@
 
 	    ;; the return value
 	    (list res
-		  (save-excursion
-		    (set-buffer tmp-stdout-buffer)
-		    (copy-sequence (buffer-substring (point-min)
-						     (point-max))))
+		  (with-current-buffer tmp-stdout-buffer
+                    (buffer-substring (point-min) (point-max)))
 		  (artist-file-to-string tmp-stderr-file-name)))
 
 	;; Unwind: remove temporary files and buffers
--- a/lisp/textmodes/bib-mode.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/bib-mode.el	Sat Oct 31 02:38:34 2009 +0000
@@ -228,12 +228,11 @@
 
 (defun bib-capitalize-title (s)
    "Like `capitalize', but don't capitalize stop words, except the first."
-   (save-excursion
-      (set-buffer (get-buffer-create "$$$Scratch$$$"))
-      (erase-buffer)
-      (insert s)
-      (bib-capitalize-title-region (point-min) (point-max))
-      (buffer-string)))
+   (with-current-buffer (get-buffer-create "$$$Scratch$$$")
+     (erase-buffer)
+     (insert s)
+     (bib-capitalize-title-region (point-min) (point-max))
+     (buffer-string)))
 
 (provide 'bib-mode)
 
--- a/lisp/textmodes/bibtex.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/bibtex.el	Sat Oct 31 02:38:34 2009 +0000
@@ -3863,8 +3863,7 @@
         buffer-key-list current-buf current-keys error-list)
     ;; Check for duplicate keys within BibTeX buffer
     (dolist (buffer buffer-list)
-      (save-excursion
-        (set-buffer buffer)
+      (with-current-buffer buffer
         (let (entry-type key key-list)
           (goto-char (point-min))
           (while (re-search-forward bibtex-entry-head nil t)
--- a/lisp/textmodes/page-ext.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/page-ext.el	Sat Oct 31 02:38:34 2009 +0000
@@ -580,8 +580,7 @@
     ;; `standard-output' to the buffer named as its first argument,
     ;; but does not switch to that buffer.
     (with-output-to-temp-buffer pages-directory-buffer
-      (save-excursion
-        (set-buffer standard-output)
+      (with-current-buffer standard-output
         (pages-directory-mode)
         (insert
          "==== Pages Directory: use `C-c C-c' to go to page under cursor. ====" ?\n)
@@ -736,8 +735,7 @@
 (defun pages-directory-goto-with-mouse  (event)
   "Go to the corresponding line under the mouse pointer in the pages buffer."
   (interactive "e")
-  (save-excursion
-    (set-buffer (window-buffer (posn-window (event-end event))))
+  (with-current-buffer (window-buffer (posn-window (event-end event)))
     (save-excursion
       (goto-char (posn-point (event-end event)))
       (pages-directory-goto))))
--- a/lisp/textmodes/refbib.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/refbib.el	Sat Oct 31 02:38:34 2009 +0000
@@ -170,12 +170,11 @@
 
 (defun r2b-capitalize-title (s)
    "Like `capitalize', but don't capitalize stop words, except the first."
-   (save-excursion
-      (set-buffer (get-buffer-create "$$$Scratch$$$"))
-      (erase-buffer)
-      (insert s)
-      (r2b-capitalize-title-region (point-min) (point-max))
-      (buffer-string)))
+   (with-current-buffer (get-buffer-create "$$$Scratch$$$")
+     (erase-buffer)
+     (insert s)
+     (r2b-capitalize-title-region (point-min) (point-max))
+     (buffer-string)))
 
 ;*********************************************************
 (defun r2b-reset ()
@@ -681,22 +680,19 @@
 
 
 (defun r2b-convert-buffer (output)
-   "Transform current buffer and append to buffer OUTPUT.
+  "Transform current buffer and append to buffer OUTPUT.
 Do `\\[r2b-help]' for more info."
-   (interactive
-      (list (read-string "Output to buffer: " r2b-out-buf-name)))
-   (save-excursion
-      (setq r2b-log (get-buffer-create r2b-log-name))
-      (set-buffer r2b-log)
-      (erase-buffer))
-   (widen)
-   (goto-char (point-min))
-   (message "Working, please be patient...")
-   (sit-for 0)
-   (while (r2b-convert-record output) t)
-   (message "Done, results in %s, errors in %s"
-      r2b-out-buf-name r2b-log-name)
-   )
+  (interactive
+   (list (read-string "Output to buffer: " r2b-out-buf-name)))
+  (with-current-buffer (setq r2b-log (get-buffer-create r2b-log-name))
+    (erase-buffer))
+  (widen)
+  (goto-char (point-min))
+  (message "Working, please be patient...")
+  (sit-for 0)
+  (while (r2b-convert-record output) t)
+  (message "Done, results in %s, errors in %s"
+           r2b-out-buf-name r2b-log-name))
 
 (defvar r2b-help-message
 "                   Refer to Bibtex Bibliography Conversion
@@ -740,13 +736,12 @@
 
 
 (defun r2b-help ()
-   "Print help describing the `refbib' package."
-   (interactive)
-   (with-output-to-temp-buffer "*Help*"
-      (princ r2b-help-message)
-      (save-excursion
-	(set-buffer standard-output)
-	(help-mode))))
+  "Print help describing the `refbib' package."
+  (interactive)
+  (with-output-to-temp-buffer "*Help*"
+    (princ r2b-help-message)
+    (with-current-buffer standard-output
+      (help-mode))))
 
 (provide 'refbib)
 (provide 'refer-to-bibtex)
--- a/lisp/textmodes/reftex-cite.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/reftex-cite.el	Sat Oct 31 02:38:34 2009 +0000
@@ -356,8 +356,7 @@
         (error "No such file %s" file))
       (message "Scanning thebibliography environment in %s" file)
 
-      (save-excursion
-        (set-buffer buf)
+      (with-current-buffer buf
         (save-restriction
           (widen)
           (goto-char (point-min))
@@ -1076,8 +1075,7 @@
         bibfile-list item bibtype)
 
     (catch 'exit
-      (save-excursion
-        (set-buffer reftex-call-back-to-this-buffer)
+      (with-current-buffer reftex-call-back-to-this-buffer
         (setq bibtype (reftex-bib-or-thebib))
         (cond
          ((eq bibtype 'bib)
@@ -1109,7 +1107,7 @@
 (defun reftex-all-used-citation-keys ()
   (reftex-access-scan-info)
   (let ((files (reftex-all-document-files)) file keys kk k)
-    (save-excursion
+    (save-current-buffer
       (while (setq file (pop files))
         (set-buffer (reftex-get-file-buffer-force file 'mark))
         (save-excursion
@@ -1137,7 +1135,7 @@
   (let ((keys (reftex-all-used-citation-keys))
         (files (reftex-get-bibfile-list))
         file key entries beg end entry)
-    (save-excursion
+    (save-current-buffer
       (while (setq file (pop files))
         (set-buffer (reftex-get-file-buffer-force file 'mark))
         (reftex-with-special-syntax-for-bib
--- a/lisp/textmodes/reftex-dcr.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/reftex-dcr.el	Sat Oct 31 02:38:34 2009 +0000
@@ -276,8 +276,7 @@
       (message "ref(%s): %s" (nth 1 entry) (nth 2 entry)))
     (let ((buf (get-buffer " *Echo Area*")))
       (when buf
-        (save-excursion
-          (set-buffer buf)
+        (with-current-buffer buf
           (run-hooks 'reftex-display-copied-context-hook)))))))
 
 (defun reftex-echo-cite (key files item)
@@ -313,8 +312,7 @@
     (unless (or (null string) (equal string ""))
       (message "cite: %s" string))
     (when (setq buf (get-buffer " *Echo Area*"))
-      (save-excursion
-        (set-buffer buf)
+      (with-current-buffer buf
         (run-hooks 'reftex-display-copied-context-hook)))))
 
 (defvar reftex-use-itimer-in-xemacs nil
@@ -373,7 +371,7 @@
     ;; Establish connection to reference buffer
     (unless ref-buffer
       (setq ref-buffer
-            (save-excursion
+            (save-current-buffer
               (completing-read 
                "Reference buffer: "
                (delq nil
--- a/lisp/textmodes/reftex-global.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/reftex-global.el	Sat Oct 31 02:38:34 2009 +0000
@@ -40,8 +40,7 @@
          (files  (reftex-all-document-files))
          (cmd    (format "etags %s" (mapconcat 'shell-quote-argument
 					       files " "))))
-    (save-excursion
-      (set-buffer (reftex-get-file-buffer-force master))
+    (with-current-buffer (reftex-get-file-buffer-force master)
       (message "Running etags to create TAGS file...")
       (shell-command cmd)
       (visit-tags-table "TAGS"))))
@@ -314,7 +313,7 @@
   (interactive)
   (let ((files (reftex-all-document-files))
         file buffer)
-    (save-excursion
+    (save-current-buffer
       (while (setq file (pop files))
         (setq buffer (reftex-get-buffer-visiting file))
         (when buffer
@@ -335,8 +334,7 @@
         (or (y-or-n-p (format "No write access to %s. Continue? " file))
             (error "Abort")))
       (when (and (setq buf (reftex-get-buffer-visiting file))
-                 (save-excursion
-                   (set-buffer buf)
+                 (with-current-buffer buf
                    buffer-read-only))
         (ding)
         (or (y-or-n-p (format "Buffer %s is read-only. Continue? "
@@ -345,11 +343,11 @@
 
 ;;; Multi-file RefTeX Isearch
 
-;;; `reftex-isearch-wrap-function', `reftex-isearch-push-state-function',
-;;; `reftex-isearch-pop-state-function', `reftex-isearch-isearch-search'
-;;; functions remain here only for backward-compatibility with Emacs 22
-;;; and are obsolete since Emacs 23 that supports a single function
-;;; variable `multi-isearch-next-buffer-function'.
+;; `reftex-isearch-wrap-function', `reftex-isearch-push-state-function',
+;; `reftex-isearch-pop-state-function', `reftex-isearch-isearch-search'
+;; functions remain here only for backward-compatibility with Emacs 22
+;; and are obsolete since Emacs 23 that supports a single function
+;; variable `multi-isearch-next-buffer-function'.
 
 (defun reftex-isearch-wrap-function ()
   (if (not isearch-word)
@@ -402,14 +400,14 @@
 	     (point))
 	 (error nil))))))
 
-;;; This function is called when isearch reaches the end of a
-;;; buffer. For reftex what we want to do is not wrap to the
-;;; beginning, but switch to the next buffer in the logical order of
-;;; the document.  This function looks through list of files in the
-;;; document (reftex-all-document-files), searches for the current
-;;; buffer and switches to the next/previous one in the logical order
-;;; of the document.  If WRAPP is true then wrap the search to the
-;;; beginning/end of the file list, depending of the search direction.
+;; This function is called when isearch reaches the end of a
+;; buffer. For reftex what we want to do is not wrap to the
+;; beginning, but switch to the next buffer in the logical order of
+;; the document.  This function looks through list of files in the
+;; document (reftex-all-document-files), searches for the current
+;; buffer and switches to the next/previous one in the logical order
+;; of the document.  If WRAPP is true then wrap the search to the
+;; beginning/end of the file list, depending of the search direction.
 (defun reftex-isearch-switch-to-next-file (crt-buf &optional wrapp)
   (reftex-access-scan-info)
   (let ((cb (buffer-file-name crt-buf))
--- a/lisp/textmodes/reftex-index.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/reftex-index.el	Sat Oct 31 02:38:34 2009 +0000
@@ -1012,8 +1012,7 @@
     (setq beg (match-beginning 0) end (match-end 0))
     (setq old (nth 2 data))
     (and (equal old new) (error "Entry unchanged"))
-    (save-excursion
-      (set-buffer (get-file-buffer (nth 3 data)))
+    (with-current-buffer (get-file-buffer (nth 3 data))
       (goto-char beg)
       (unless (looking-at (regexp-quote old))
         (error "This should not happen (reftex-index-change-entry)"))
@@ -1594,7 +1593,7 @@
           (while (re-search-forward re2 nil t)
             (push (cons (count-lines 1 (point)) (match-string 1)) superphrases)
             (incf ntimes2))))
-      (save-excursion
+      (save-current-buffer
         (while (setq file (pop files))
           (setq buf (reftex-get-file-buffer-force file))
           (when buf
--- a/lisp/textmodes/reftex-ref.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/reftex-ref.el	Sat Oct 31 02:38:34 2009 +0000
@@ -78,8 +78,7 @@
                file (not (eq t reftex-keep-temporary-buffers)))))
     (if (not buf)
         (list label typekey "" file comment "LOST LABEL.  RESCAN TO FIX.")
-      (save-excursion
-        (set-buffer buf)
+      (with-current-buffer buf
         (save-restriction
           (widen)
           (goto-char 1)
@@ -538,8 +537,7 @@
                     reftex-latex-syntax-table (syntax-table))
               (if reftex-use-multiple-selection-buffers
                   (switch-to-buffer-other-window
-                   (save-excursion
-                     (set-buffer buf)
+                   (with-current-buffer buf
                      (reftex-make-selection-buffer-name typekey)))
                 (switch-to-buffer-other-window "*RefTeX Select*")
                 (reftex-erase-buffer))
--- a/lisp/textmodes/reftex-sel.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/reftex-sel.el	Sat Oct 31 02:38:34 2009 +0000
@@ -90,28 +90,27 @@
   ;; We do not set a local map - reftex-select-item does this.
   (run-hooks 'reftex-select-bib-mode-hook))
 
-;;; (defun reftex-get-offset (buf here-am-I &optional typekey toc index file)
-;;;   ;; Find the correct offset data, like insert-docstruct would, but faster.
-;;;   ;; Buffer BUF knows the correct docstruct to use.
-;;;   ;; Basically this finds the first docstruct entry after HERE-I-AM which
-;;;   ;; is of allowed type.  The optional arguments specify what is allowed.
-;;;   (catch 'exit
-;;;     (save-excursion
-;;;       (set-buffer buf)
-;;;       (reftex-access-scan-info)
-;;;       (let* ((rest (memq here-am-I (symbol-value reftex-docstruct-symbol)))
-;;;          entry)
-;;;     (while (setq entry (pop rest))
-;;;       (if (or (and typekey
-;;;                    (stringp (car entry))
-;;;                    (or (equal typekey " ")
-;;;                        (equal typekey (nth 1 entry))))
-;;;               (and toc (eq (car entry) 'toc))
-;;;               (and index (eq (car entry) 'index))
-;;;               (and file
-;;;                    (memq (car entry) '(bof eof file-error))))
-;;;           (throw 'exit entry)))
-;;;     nil))))
+;; (defun reftex-get-offset (buf here-am-I &optional typekey toc index file)
+;;   ;; Find the correct offset data, like insert-docstruct would, but faster.
+;;   ;; Buffer BUF knows the correct docstruct to use.
+;;   ;; Basically this finds the first docstruct entry after HERE-I-AM which
+;;   ;; is of allowed type.  The optional arguments specify what is allowed.
+;;   (catch 'exit
+;;     (with-current-buffer buf
+;;       (reftex-access-scan-info)
+;;       (let* ((rest (memq here-am-I (symbol-value reftex-docstruct-symbol)))
+;;          entry)
+;;     (while (setq entry (pop rest))
+;;       (if (or (and typekey
+;;                    (stringp (car entry))
+;;                    (or (equal typekey " ")
+;;                        (equal typekey (nth 1 entry))))
+;;               (and toc (eq (car entry) 'toc))
+;;               (and index (eq (car entry) 'index))
+;;               (and file
+;;                    (memq (car entry) '(bof eof file-error))))
+;;           (throw 'exit entry)))
+;;     nil))))
 
 (defun reftex-get-offset (buf here-am-I &optional typekey toc index file)
   ;; Find the correct offset data, like insert-docstruct would, but faster.
@@ -119,8 +118,7 @@
   ;; Basically this finds the first docstruct entry before HERE-I-AM which
   ;; is of allowed type.  The optional arguments specify what is allowed.
   (catch 'exit
-    (save-excursion
-      (set-buffer buf)
+    (with-current-buffer buf
       (reftex-access-scan-info)
       (let* ((rest (symbol-value reftex-docstruct-symbol))
              lastentry entry)
@@ -178,8 +176,7 @@
          prev-inserted offset from to index-tag docstruct-symbol)
 
     ;; Pop to buffer buf to get the correct buffer-local variables
-    (save-excursion
-      (set-buffer buf)
+    (with-current-buffer buf
 
       ;; Ensure access to scanning info
       (reftex-access-scan-info)
@@ -413,8 +410,7 @@
             (recursive-edit))
 
         (set-marker reftex-recursive-edit-marker nil)
-        (save-excursion
-          (set-buffer selection-buffer)
+        (with-current-buffer selection-buffer
           (use-local-map nil)
           (remove-hook 'pre-command-hook 'reftex-select-pre-command-hook t)
           (remove-hook 'post-command-hook
--- a/lisp/textmodes/reftex-toc.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/reftex-toc.el	Sat Oct 31 02:38:34 2009 +0000
@@ -708,8 +708,7 @@
          (name (nth 1 x))
          (newname (nth 2 x))
          (marker (nth 4 data)))
-    (save-excursion
-      (set-buffer (marker-buffer marker))
+    (with-current-buffer (marker-buffer marker)
       (goto-char (marker-position marker))
       (if (looking-at (concat "\\([ \t]*\\\\\\)" (regexp-quote name)))
           (replace-match (concat "\\1" newname))
--- a/lisp/textmodes/reftex.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/reftex.el	Sat Oct 31 02:38:34 2009 +0000
@@ -1822,9 +1822,8 @@
     (let ((buffer-read-only nil)) (erase-buffer)))
    ((setq buffer (get-buffer buffer))
     ;; buffer exists
-    (save-excursion
-      (set-buffer buffer)
-      (let ((buffer-read-only nil)) (erase-buffer))))))
+    (with-current-buffer buffer
+      (let ((inhibit-read-only t)) (erase-buffer))))))
 
 (defun reftex-this-word (&optional class)
   ;; Grab the word around point.
@@ -2072,8 +2071,7 @@
 
              ;; Is there a hook to run?
              (when (listp reftex-initialize-temporary-buffers)
-               (save-excursion
-                 (set-buffer buf)
+               (with-current-buffer buf
                  (run-hooks 'reftex-initialize-temporary-buffers))))
 
            ;; Lets see if we got a license to kill :-|
@@ -2100,8 +2098,7 @@
         (and (buffer-modified-p buffer)
              (y-or-n-p (format "Save file %s? "
                                (buffer-file-name buffer)))
-             (save-excursion
-               (set-buffer buffer)
+             (with-current-buffer buffer
                (save-buffer)))
         (kill-buffer buffer))
       (pop reftex-buffers-to-kill)))))
--- a/lisp/textmodes/spell.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/spell.el	Sat Oct 31 02:38:34 2009 +0000
@@ -93,8 +93,7 @@
   (interactive "r")
   (let ((filter spell-filter)
 	(buf (get-buffer-create " *temp*")))
-    (save-excursion
-     (set-buffer buf)
+    (with-current-buffer buf
      (widen)
      (erase-buffer))
     (message "Checking spelling of %s..." (or description "region"))
@@ -104,41 +103,37 @@
 	  (call-process-region start end shell-file-name
 			       nil buf nil "-c" spell-command))
       (let ((oldbuf (current-buffer)))
-	(save-excursion
-	 (set-buffer buf)
-	 (insert-buffer-substring oldbuf start end)
-	 (or (bolp) (insert ?\n))
-	 (if filter (funcall filter))
-	 (if (string= "spell" spell-command)
-	     (call-process-region (point-min) (point-max) "spell" t buf)
-	   (call-process-region (point-min) (point-max) shell-file-name
-				t buf nil "-c" spell-command)))))
+	(with-current-buffer buf
+          (insert-buffer-substring oldbuf start end)
+          (or (bolp) (insert ?\n))
+          (if filter (funcall filter))
+          (if (string= "spell" spell-command)
+              (call-process-region (point-min) (point-max) "spell" t buf)
+            (call-process-region (point-min) (point-max) shell-file-name
+                                 t buf nil "-c" spell-command)))))
     (message "Checking spelling of %s...%s"
 	     (or description "region")
-	     (if (save-excursion
-		  (set-buffer buf)
-		  (> (buffer-size) 0))
+	     (if (with-current-buffer buf
+                   (> (buffer-size) 0))
 		 "not correct"
 	       "correct"))
     (let (word newword
 	  (case-fold-search t)
 	  (case-replace t))
-      (while (save-excursion
-	      (set-buffer buf)
-	      (> (buffer-size) 0))
-	(save-excursion
-	 (set-buffer buf)
-	 (goto-char (point-min))
-	 (setq word (downcase
-		     (buffer-substring (point)
-				       (progn (end-of-line) (point)))))
-	 (forward-char 1)
-	 (delete-region (point-min) (point))
-	 (setq newword
-	       (read-string (concat "`" word
-                                    "' not recognized; edit a replacement: ")
-                            word))
-	 (flush-lines (concat "^" (regexp-quote word) "$")))
+      (while (with-current-buffer buf
+               (> (buffer-size) 0))
+	(with-current-buffer buf
+          (goto-char (point-min))
+          (setq word (downcase
+                      (buffer-substring (point)
+                                        (progn (end-of-line) (point)))))
+          (forward-char 1)
+          (delete-region (point-min) (point))
+          (setq newword
+                (read-string (concat "`" word
+                                     "' not recognized; edit a replacement: ")
+                             word))
+          (flush-lines (concat "^" (regexp-quote word) "$")))
 	(if (not (equal word newword))
 	    (progn
 	     (goto-char (point-min))
@@ -152,22 +147,21 @@
   "Check spelling of string supplied as argument."
   (interactive "sSpell string: ")
   (let ((buf (get-buffer-create " *temp*")))
-    (save-excursion
-     (set-buffer buf)
-     (widen)
-     (erase-buffer)
-     (insert string "\n")
-     (if (string= "spell" spell-command)
-	 (call-process-region (point-min) (point-max) "spell"
-			      t t)
-       (call-process-region (point-min) (point-max) shell-file-name
-			    t t nil "-c" spell-command))
-     (if (= 0 (buffer-size))
-	 (message "%s is correct" string)
-       (goto-char (point-min))
-       (while (search-forward "\n" nil t)
-	 (replace-match " "))
-       (message "%sincorrect" (buffer-substring 1 (point-max)))))))
+    (with-current-buffer buf
+      (widen)
+      (erase-buffer)
+      (insert string "\n")
+      (if (string= "spell" spell-command)
+          (call-process-region (point-min) (point-max) "spell"
+                               t t)
+        (call-process-region (point-min) (point-max) shell-file-name
+                             t t nil "-c" spell-command))
+      (if (= 0 (buffer-size))
+          (message "%s is correct" string)
+        (goto-char (point-min))
+        (while (search-forward "\n" nil t)
+          (replace-match " "))
+        (message "%sincorrect" (buffer-substring 1 (point-max)))))))
 ;;;###autoload
 (make-obsolete 'spell-string "The `spell' package is obsolete - use `ispell'."
                "23.1")
--- a/lisp/textmodes/tex-mode.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/tex-mode.el	Sat Oct 31 02:38:34 2009 +0000
@@ -1700,8 +1700,7 @@
   (setq directory (file-name-as-directory (expand-file-name directory)))
   (if (not (file-directory-p directory))
       (error "%s is not a directory" directory)
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (setq default-directory directory))))
 
 (defvar tex-send-command-modified-tick 0)
--- a/lisp/textmodes/texnfo-upd.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/texnfo-upd.el	Sat Oct 31 02:38:34 2009 +0000
@@ -1723,8 +1723,7 @@
   "Return a list of the included files in OUTER-FILE."
   (let ((included-file-list (list outer-file))
 	start)
-    (save-excursion
-      (set-buffer (find-file-noselect outer-file))
+    (with-current-buffer (find-file-noselect outer-file)
       (widen)
       (goto-char (point-min))
       (while (re-search-forward "^@include" nil t)
--- a/lisp/textmodes/two-column.el	Sat Oct 31 02:22:30 2009 +0000
+++ b/lisp/textmodes/two-column.el	Sat Oct 31 02:38:34 2009 +0000
@@ -407,8 +407,7 @@
        (if (y-or-n-p (concat "Overwrite associated buffer `"
 			     (buffer-name (2C-other))
 			     "'? "))
-	   (save-excursion
-	     (set-buffer (2C-other))
+	   (with-current-buffer (2C-other)
 	     (erase-buffer))
 	 (signal 'quit nil)))
   (let ((point (point))