]> git.eshelyaron.com Git - emacs.git/commitdiff
* textmodes/two-column.el (2C-split):
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 31 Oct 2009 02:38:34 +0000 (02:38 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 31 Oct 2009 02:38:34 +0000 (02:38 +0000)
* 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.

61 files changed:
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

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