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

58 files changed:
lisp/ChangeLog
lisp/allout.el
lisp/apropos.el
lisp/chistory.el
lisp/dabbrev.el
lisp/dired-aux.el
lisp/dired.el
lisp/disp-table.el
lisp/dos-w32.el
lisp/echistory.el
lisp/ediff-diff.el
lisp/ediff-mult.el
lisp/ediff-util.el
lisp/ediff-vers.el
lisp/ediff.el
lisp/ehelp.el
lisp/emerge.el
lisp/epa.el
lisp/epg.el
lisp/ezimage.el
lisp/facemenu.el
lisp/faces.el
lisp/files.el
lisp/filesets.el
lisp/find-dired.el
lisp/finder.el
lisp/generic-x.el
lisp/help-fns.el
lisp/help-mode.el
lisp/hippie-exp.el
lisp/ido.el
lisp/informat.el
lisp/ledit.el
lisp/macros.el
lisp/menu-bar.el
lisp/mouse-copy.el
lisp/mouse.el
lisp/novice.el
lisp/printing.el
lisp/ps-bdf.el
lisp/ps-print.el
lisp/ps-samp.el
lisp/saveplace.el
lisp/sb-image.el
lisp/scroll-bar.el
lisp/shadowfile.el
lisp/simple.el
lisp/speedbar.el
lisp/strokes.el
lisp/term.el
lisp/terminal.el
lisp/time-stamp.el
lisp/type-break.el
lisp/userlock.el
lisp/vc-rcs.el
lisp/whitespace.el
lisp/window.el
lisp/x-dnd.el

index 9dd140a8a086683a22f9918d31ab69135bb86efe..907292a0c2d18654cb7bec283a637c41867431c9 100644 (file)
@@ -1,12 +1,94 @@
+2009-11-13  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * x-dnd.el (x-dnd-maybe-call-test-function):
+       * window.el (split-window-vertically):
+       * whitespace.el (whitespace-help-on):
+       * vc-rcs.el (vc-rcs-consult-headers):
+       * userlock.el (ask-user-about-lock-help)
+       (ask-user-about-supersession-help):
+       * type-break.el (type-break-force-mode-line-update):
+       * time-stamp.el (time-stamp-conv-warn):
+       * terminal.el (te-set-output-log, te-more-break, te-filter)
+       (te-sentinel,terminal-emulator):
+       * term.el (make-term, term-exec, term-sentinel, term-read-input-ring)
+       (term-write-input-ring, term-check-source, term-start-output-log):
+       (term-display-buffer-line, term-dynamic-list-completions):
+       (term-ansi-make-term, serial-term):
+       * subr.el (selective-display):
+       * strokes.el (strokes-xpm-to-compressed-string, strokes-decode-buffer)
+       (strokes-encode-buffer, strokes-xpm-for-compressed-string):
+       * speedbar.el (speedbar-buffers-tail-notes, speedbar-buffers-item-info)
+       (speedbar-reconfigure-keymaps, speedbar-add-localized-speedbar-support)
+       (speedbar-remove-localized-speedbar-support)
+       (speedbar-set-mode-line-format, speedbar-create-tag-hierarchy)
+       (speedbar-update-special-contents, speedbar-buffer-buttons-engine)
+       (speedbar-buffers-line-directory):
+       * simple.el (shell-command-on-region, append-to-buffer)
+       (prepend-to-buffer):
+       * shadowfile.el (shadow-save-todo-file):
+       * scroll-bar.el (scroll-bar-set-window-start, scroll-bar-drag-1)
+       (scroll-bar-maybe-set-window-start):
+       * sb-image.el (speedbar-image-dump):
+       * saveplace.el (save-place-alist-to-file, save-places-to-alist)
+       (load-save-place-alist-from-file):
+       * ps-samp.el (ps-print-message-from-summary):
+       * ps-print.el (ps-flush-output, ps-insert-file, ps-get-boundingbox)
+       (ps-background-image, ps-begin-job, ps-do-despool):
+       * ps-bdf.el (bdf-find-file, bdf-read-font-info):
+       * printing.el (pr-interface, pr-ps-file-print, pr-find-buffer-visiting)
+       (pr-ps-message-from-summary, pr-lpr-message-from-summary):
+       (pr-call-process, pr-file-list, pr-interface-save):
+       * novice.el (disabled-command-function)
+       (enable-command, disable-command):
+       * mouse.el (mouse-buffer-menu-alist):
+       * mouse-copy.el (mouse-kill-preserving-secondary):
+       * macros.el (kbd-macro-query):
+       * ledit.el (ledit-go-to-lisp, ledit-go-to-liszt):
+       * informat.el (batch-info-validate):
+       * ido.el (ido-copy-current-word, ido-initiate-auto-merge):
+       * hippie-exp.el (try-expand-dabbrev-visible):
+       * help-mode.el (help-make-xrefs):
+       * help-fns.el (describe-variable):
+       * generic-x.el (bat-generic-mode-run-as-comint):
+       * finder.el (finder-mouse-select):
+       * find-dired.el (find-dired-sentinel):
+       * filesets.el (filesets-file-close):
+       * files.el (list-directory):
+       * faces.el (list-faces-display, describe-face):
+       * facemenu.el (list-colors-display):
+       * ezimage.el (ezimage-image-association-dump, ezimage-image-dump):
+       * epg.el (epg--process-filter, epg-cancel):
+       * epa.el (epa--marked-keys, epa--select-keys, epa-display-info)
+       (epa--read-signature-type):
+       * emerge.el (emerge-copy-as-kill-A, emerge-copy-as-kill-B)
+       (emerge-file-names):
+       * ehelp.el (electric-helpify):
+       * ediff.el (ediff-regions-wordwise, ediff-regions-linewise):
+       * ediff-vers.el (rcs-ediff-view-revision):
+       * ediff-util.el (ediff-setup):
+       * ediff-mult.el (ediff-append-custom-diff):
+       * ediff-diff.el (ediff-exec-process, ediff-process-sentinel)
+       (ediff-wordify):
+       * echistory.el (Electric-command-history-redo-expression):
+       * dos-w32.el (find-file-not-found-set-buffer-file-coding-system):
+       * disp-table.el (describe-display-table):
+       * dired.el (dired-find-buffer-nocreate):
+       * dired-aux.el (dired-rename-subdir, dired-dwim-target-directory):
+       * dabbrev.el (dabbrev--same-major-mode-p):
+       * chistory.el (list-command-history):
+       * apropos.el (apropos-documentation):
+       * allout.el (allout-obtain-passphrase):
+       (allout-copy-exposed-to-buffer):
+       (allout-verify-passphrase): Use with-current-buffer.
+
 2009-11-13  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in (ELCFILES): Regenerate.
 
 2009-11-13  Michael Albinus  <michael.albinus@gmx.de>
 
-       * net/dbus.el (dbus-registered-objects-table): Renamed from
-       `dbus-registered-functions-table', because it contains also
-       properties.
+       * net/dbus.el (dbus-registered-objects-table): Rename from
+       `dbus-registered-functions-table', because it contains also properties.
        (dbus-unregister-object): Unregister also properties.
        (dbus-get-property, dbus-set-property, dbus-get-all-properties):
        Use a timeout of 500 msec, in order to not block.
        * custom.el (custom-declare-group): Purecopy standard-value.
        (custom-declare-group): Purecopy custom-prefix.
 
-       * international/mule.el (load-with-code-conversion): Call
-       do-after-load-evaluation unconditionally.
+       * international/mule.el (load-with-code-conversion):
+       Call do-after-load-evaluation unconditionally.
 
        * emacs-lisp/bytecomp.el (byte-compile-output-file-form): Handle defvaralias.
 
index 46ecfed96dafa7566dde270ae3b4c11a9126db19..e0b2536d2ae36645a20f81e55de4e61c9f1afa5e 100644 (file)
@@ -5605,7 +5605,7 @@ alternate presentation format for the outline:
                                   (goto-char beg)
                                   (allout-topic-flat-index))
                           '(1))))
-    (save-excursion (set-buffer tobuf)(erase-buffer))
+    (with-current-buffer tobuf (erase-buffer))
     (allout-process-exposed 'allout-insert-listified
                             beg
                             end
@@ -6283,8 +6283,7 @@ of the availability of a cached copy."
 
     ;; Symmetric hereon:
 
-    (save-excursion
-      (set-buffer allout-buffer)
+    (with-current-buffer allout-buffer
       (let* ((hint (if (and (not (string= allout-passphrase-hint-string ""))
                             (or (equal allout-passphrase-hint-handling 'always)
                                 (and (equal allout-passphrase-hint-handling
@@ -6481,8 +6480,7 @@ Derived from value of `allout-passphrase-verifier-string'."
   "True if passphrase successfully decrypts verifier, nil otherwise.
 
 \"Otherwise\" includes absence of passphrase verifier."
-  (save-excursion
-    (set-buffer allout-buffer)
+  (with-current-buffer allout-buffer
     (and (boundp 'allout-passphrase-verifier-string)
          allout-passphrase-verifier-string
          (allout-encrypt-string (allout-get-encryption-passphrase-verifier)
index 45463784cbcf48c33611ef800394b135feb09729..1ee3bedbd31f0d8e766c736fceb6737302b1104c 100644 (file)
@@ -736,8 +736,7 @@ Returns list of symbols and documentation found."
        (apropos-sort-by-scores apropos-documentation-sort-by-scores)
        f v sf sv)
     (unwind-protect
-       (save-excursion
-         (set-buffer standard-input)
+       (with-current-buffer standard-input
          (apropos-documentation-check-doc-file)
          (if do-all
              (mapatoms
index af25175f7c2ba46a2a0aceb3c6c861897e308206..0220673ec02630608cf44e3a0aa4fda5dfc1b8b6 100644 (file)
@@ -116,8 +116,7 @@ The buffer is left in Command History mode."
          (prin1 (car history))
          (terpri))
        (setq history (cdr history))))
-    (save-excursion
-      (set-buffer "*Command History*")
+    (with-current-buffer "*Command History*"
       (goto-char (point-min))
       (if (eobp)
          (error "No command history")
index ab9cae6fed83f5158cabf868ce837b46ccefa346..115d579a07962e892d8caf4961c27154de5090d7 100644 (file)
@@ -62,8 +62,7 @@
 ;; the article for expansion):
 ;; (set (make-local-variable 'dabbrev-friend-buffer-function)
 ;;      (lambda (buffer)
-;;         (save-excursion
-;;           (set-buffer buffer)
+;;         (with-current-buffer buffer
 ;;           (memq major-mode '(news-reply-mode gnus-article-mode)))))
 
 
@@ -594,8 +593,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
 ;;; Checks if OTHER-BUFFER has the same major mode as current buffer.
 (defun dabbrev--same-major-mode-p (other-buffer)
   (eq major-mode
-      (save-excursion
-       (set-buffer other-buffer)
+      (with-current-buffer other-buffer
        major-mode)))
 
 ;;; Back over all abbrev type characters and then moves forward over
index 95cdc7669bfa8abbf089b2cc2e28ce7edf020315..ffe02cacdace2ab998a2ba0ca2ec40c467074a6d 100644 (file)
@@ -1251,8 +1251,7 @@ Special value `always' suppresses confirmation."
   (let ((expanded-from-dir (expand-file-name from-dir))
        (blist (buffer-list)))
     (while blist
-      (save-excursion
-       (set-buffer (car blist))
+      (with-current-buffer (car blist)
        (if (and buffer-file-name
                 (dired-in-this-tree buffer-file-name expanded-from-dir))
            (let ((modflag (buffer-modified-p))
@@ -1530,8 +1529,7 @@ Optional arg HOW-TO determiness how to treat the target.
     ;; non-dired buffer may want to profit from this function, e.g. vm-uudecode
     (if dired-dwim-target
        (let* ((other-buf (window-buffer (next-window)))
-              (other-dir (save-excursion
-                           (set-buffer other-buf)
+              (other-dir (with-current-buffer other-buf
                            (and (eq major-mode 'dired-mode)
                                 (dired-current-directory)))))
          (or other-dir this-dir))
index cf78354ad8fac23bc6c7651f89b8144366dfd87d..d4e79485bcdedb7971245c0556becc0da82b2387 100644 (file)
@@ -819,8 +819,7 @@ for a remote directory.  This feature is used by Auto Revert Mode."
     (while blist
       (if (null (buffer-name (cdr (car blist))))
          (setq blist (cdr blist))
-       (save-excursion
-         (set-buffer (cdr (car blist)))
+       (with-current-buffer (cdr (car blist))
          (if (and (eq major-mode mode)
                   dired-directory  ;; nil during find-alternate-file
                   (equal dirname
index 91dc4a7fd343ceb0972cee606d26137ac0f38210..5c1401bc6042ffc762f63f46ffb39fee99cdbc6b 100644 (file)
@@ -87,8 +87,7 @@ Valid symbols are `truncation', `wrap', `escape', `control',
     (princ "\nVertical window border glyph: ")
     (prin1 (display-table-slot dt 'vertical-border))
     (princ "\nCharacter display glyph sequences:\n")
-    (save-excursion
-      (set-buffer standard-output)
+    (with-current-buffer standard-output
       (let ((vector (make-vector 256 nil))
            (i 0))
        (while (< i 256)
index 9bec5b7a1db491339e15c0b2108c197b6e25d8c4..2c98417caead3b4f16386d70a580a99d0bff4008 100644 (file)
@@ -197,8 +197,7 @@ set to the appropriate coding system, and the value of
     (find-file filename)))
 
 (defun find-file-not-found-set-buffer-file-coding-system ()
-  (save-excursion
-    (set-buffer (current-buffer))
+  (with-current-buffer (current-buffer)
     (let ((coding buffer-file-coding-system))
       ;; buffer-file-coding-system is already set by
       ;; find-operation-coding-system, which was called from
index 3d783ffa8fa9827b86ba5d45ce1849cfa84c46e6..8d1bfb92a00045f4f02396bdd1dab4495924235a 100644 (file)
@@ -34,8 +34,7 @@
 With prefix arg NOCONFIRM, execute current line as-is without editing."
   (interactive "P")
   (let (todo)
-    (save-excursion
-      (set-buffer "*Command History*")
+    (with-current-buffer "*Command History*"
       (beginning-of-line)
       (setq todo (read (current-buffer)))
       (if (boundp 'electric-history-in-progress)
index 75379f3da7a75c7d82557d9fa15c49e0b1578801..7159657a816946c40dd129e2d2e1e78541812d7d 100644 (file)
@@ -1225,8 +1225,7 @@ delimiter regions"))
     (unwind-protect
        (let ((directory default-directory)
              proc)
-         (save-excursion
-           (set-buffer buffer)
+         (with-current-buffer buffer
            (erase-buffer)
            (setq default-directory directory)
            (if (or (memq system-type '(emx ms-dos windows-nt windows-95))
@@ -1283,8 +1282,7 @@ delimiter regions"))
   (if (and (memq (process-status process) '(exit signal))
            (buffer-name (process-buffer process)))
       (progn
-        (save-excursion
-          (set-buffer (process-buffer process))
+        (with-current-buffer (process-buffer process)
           (setq mode-line-process nil))
         (delete-process process))))
 
@@ -1354,8 +1352,7 @@ arguments to `skip-chars-forward'."
               ediff-forward-word-function)
           ediff-forward-word-function))
        inbuf-syntax-tbl sv-point diff-string)
-    (save-excursion
-     (set-buffer in-buffer)
+    (with-current-buffer in-buffer
      (setq inbuf-syntax-tbl
           (if control-buf
               (ediff-with-current-buffer control-buf
index b9ffb373766366ff484b342ee6dd542d2f78f44a..a1dfbded153aedefc2653523c2a2b51909fcaed9 100644 (file)
@@ -1639,8 +1639,7 @@ Useful commands:
     (cond ((ediff-buffer-live-p custom-diff-buf)
           ;; for live session buffers we do them first because the user may
           ;; have changed them with respect to the underlying files
-          (save-excursion
-            (set-buffer meta-diff-buff)
+          (with-current-buffer meta-diff-buff
             (goto-char (point-max))
             (insert-buffer-substring custom-diff-buf)
             (insert "\n")))
@@ -1649,8 +1648,8 @@ Useful commands:
                           ediff-merge-directories
                           ediff-merge-directories-with-ancestor))
           ;; get diffs by calling shell command on ediff-custom-diff-program
-          (save-excursion
-            (set-buffer (setq tmp-buf (get-buffer-create ediff-tmp-buffer)))
+          (with-current-buffer
+               (setq tmp-buf (get-buffer-create ediff-tmp-buffer))
             (erase-buffer)
             (shell-command
              (format
@@ -1662,8 +1661,7 @@ Useful commands:
               )
              t)
             )
-          (save-excursion
-            (set-buffer meta-diff-buff)
+          (with-current-buffer meta-diff-buff
             (goto-char (point-max))
             (insert-buffer-substring tmp-buf)
             (insert "\n")))
index d0be103b8a670ab5c706375fe11d02d9426df772..a6247395eff9198e1d227740374074019c83305b 100644 (file)
@@ -343,8 +343,7 @@ to invocation.")
            (setq buffer-C
                  (get-buffer-create
                   (ediff-unique-buffer-name "*ediff-merge" "*")))
-           (save-excursion
-             (set-buffer buffer-C)
+           (with-current-buffer buffer-C
              (insert-buffer-substring buf)
              (goto-char (point-min))
              (funcall (ediff-with-current-buffer buf major-mode))
index f634890451d29a73cbfcd241501adae91fec6dbe..b5c0c0bd942ee3b81d9c2cf6b8e192de6374c688 100644 (file)
@@ -123,8 +123,7 @@ comparison or merge operations are being performed."
        (fundamental-mode))
       (let ((output-buffer (ediff-rcs-get-output-buffer filename buff)))
        (delete-windows-on output-buffer)
-       (save-excursion
-         (set-buffer output-buffer)
+       (with-current-buffer output-buffer
          (apply 'call-process "co" nil t nil
                 ;; -q: quiet (no diagnostics)
                 (append switches rcs-default-co-switches
index 5c53d1a668864be710eb5e9be29ba973f9617895..33f53130caff5ff57a6d96a84aa1dbce37fd01e9 100644 (file)
@@ -977,8 +977,7 @@ lines.  For large regions, use `ediff-regions-linewise'."
        (buffer-B
          (ediff-clone-buffer-for-region-comparison buffer-B "-Region.B-"))
         reg-A-beg reg-A-end reg-B-beg reg-B-end)
-    (save-excursion
-      (set-buffer buffer-A)
+    (with-current-buffer buffer-A
       (setq reg-A-beg (region-beginning)
            reg-A-end (region-end))
       (set-buffer buffer-B)
@@ -1018,8 +1017,7 @@ lines.  For small regions, use `ediff-regions-wordwise'."
        (buffer-B
          (ediff-clone-buffer-for-region-comparison buffer-B "-Region.B-"))
         reg-A-beg reg-A-end reg-B-beg reg-B-end)
-    (save-excursion
-      (set-buffer buffer-A)
+    (with-current-buffer buffer-A
       (setq reg-A-beg (region-beginning)
            reg-A-end (region-end))
       ;; enlarge the region to hold full lines
index 8f1eeefa95ac9960b3ac8c6b9f132e6efe7d655b..4e4e59fa6d554e8e3c8c86d58bc1b276538ec0ae 100644 (file)
@@ -321,8 +321,7 @@ will select it.)"
                  ;;>>      suspend updating of the tick in order to allow
                  ;;>>      things like momentary-string-display)
                  (and b
-                      (save-excursion
-                        (set-buffer b)
+                      (with-current-buffer b
                         (set-buffer-modified-p t)))
                  (fset 'help-print-return-message 'ignore)
                  (call-interactively fun)
@@ -333,8 +332,7 @@ will select it.)"
                           (not (buffer-modified-p b)))))
              (fset 'help-print-return-message p)
              (and b (buffer-name b)
-                  (save-excursion
-                    (set-buffer b)
+                  (with-current-buffer b
                     (set-buffer-modified-p m))))))
        (with-electric-help 'ignore name t))))
 
index ee19351a2e31f2e588f18a1dd30c49d480c8fbd7..997077aa08f16c7de20c5510b9c8a73e5acf0694 100644 (file)
@@ -2060,8 +2060,7 @@ With a negative argument, turn off Skip-Prefers mode."
         (A-end (1- (aref diff-vector 1)))
         ;; so further kills don't append
         this-command)
-    (save-excursion
-      (set-buffer emerge-A-buffer)
+    (with-current-buffer emerge-A-buffer
       (copy-region-as-kill A-begin A-end))))
 
 (defun emerge-copy-as-kill-B ()
@@ -2074,8 +2073,7 @@ With a negative argument, turn off Skip-Prefers mode."
         (B-end (1- (aref diff-vector 3)))
         ;; so further kills don't append
         this-command)
-    (save-excursion
-      (set-buffer emerge-B-buffer)
+    (with-current-buffer emerge-B-buffer
       (copy-region-as-kill B-begin B-end))))
 
 (defun emerge-insert-A (arg)
@@ -2170,8 +2168,7 @@ Use C-u l to reset the windows afterward."
                                       (princ (buffer-name))))
                                   (princ "\n")))
       (princ emerge-output-description)
-      (save-excursion
-       (set-buffer standard-output)
+      (with-current-buffer standard-output
        (help-mode)))))
 
 (defun emerge-join-differences (arg)
@@ -3020,8 +3017,7 @@ If some prefix of KEY has a non-prefix definition, it is redefined."
 ;;                            minor-mode indicator))
 ;;             (princ (documentation minor-mode)))))
 ;;     (setq minor-modes (cdr minor-modes))))
-;;    (save-excursion
-;;      (set-buffer standard-output)
+;;    (with-current-buffer standard-output
 ;;      (help-mode))
 ;;    (help-print-return-message)))
 
index 541d26724d5403b5fadae94b13bb9ba36502357c..d218925b58fb3ad53a296da1f3b9dc7338c58f73 100644 (file)
@@ -463,8 +463,7 @@ If ARG is non-nil, mark the key."
   (apply #'epa--list-keys epa-list-keys-arguments))
 
 (defun epa--marked-keys ()
-  (or (save-excursion
-       (set-buffer epa-keys-buffer)
+  (or (with-current-buffer epa-keys-buffer
        (goto-char (point-min))
        (let (keys key)
          (while (re-search-forward "^\\*" nil t)
@@ -479,11 +478,10 @@ If ARG is non-nil, mark the key."
              (list key))))))
 
 (defun epa--select-keys (prompt keys)
-  (save-excursion
-    (unless (and epa-keys-buffer
-                (buffer-live-p epa-keys-buffer))
-      (setq epa-keys-buffer (generate-new-buffer "*Keys*")))
-    (set-buffer epa-keys-buffer)
+  (unless (and epa-keys-buffer
+               (buffer-live-p epa-keys-buffer))
+    (setq epa-keys-buffer (generate-new-buffer "*Keys*")))
+  (with-current-buffer epa-keys-buffer
     (epa-key-list-mode)
     (let ((inhibit-read-only t)
          buffer-read-only)
@@ -615,8 +613,7 @@ If SECRET is non-nil, list secret keys instead of public keys."
          (setq epa-info-buffer (generate-new-buffer "*Info*")))
        (if (get-buffer-window epa-info-buffer)
            (delete-window (get-buffer-window epa-info-buffer)))
-       (save-excursion
-         (set-buffer epa-info-buffer)
+       (with-current-buffer epa-info-buffer
          (let ((inhibit-read-only t)
                buffer-read-only)
            (erase-buffer)
@@ -716,8 +713,7 @@ If SECRET is non-nil, list secret keys instead of public keys."
             (setq type 'detached))
            ((eq c ??)
             (with-output-to-temp-buffer "*Help*"
-              (save-excursion
-                (set-buffer standard-output)
+              (with-current-buffer standard-output
                 (insert "\
 n - Create a normal signature
 c - Create a cleartext signature
index b8eb2b48ea7f646bbcbfa85ed2ed00649d9cd491..929f0637480998e6e399cc3dbd1db8377cfea9a0 100644 (file)
@@ -1143,8 +1143,7 @@ This function is for internal use only."
        (goto-char (point-max))
        (insert input)))
   (if (buffer-live-p (process-buffer process))
-      (save-excursion
-       (set-buffer (process-buffer process))
+      (with-current-buffer (process-buffer process)
        (goto-char (point-max))
        (insert input)
        (unless epg-process-filter-running
@@ -1927,8 +1926,7 @@ You can then use `write-region' to write new data into the file."
 
 (defun epg-cancel (context)
   (if (buffer-live-p (process-buffer (epg-context-process context)))
-      (save-excursion
-       (set-buffer (process-buffer (epg-context-process context)))
+      (with-current-buffer (process-buffer (epg-context-process context))
        (epg-context-set-result-for
         epg-context 'error
         (cons '(quit)
index a677994926fc78c7d211bd65076e27832a5126a1..8923f783f148747df3b9c16bf027dfa4bd3fa0b7 100644 (file)
@@ -300,8 +300,7 @@ Optional argument STRING is a string upon which to add text properties."
 See `ezimage-expand-image-button-alist' for details."
   (interactive)
   (with-output-to-temp-buffer "*Ezimage Images*"
-    (save-excursion
-      (set-buffer "*Ezimage Images*")
+    (with-current-buffer "*Ezimage Images*"
       (goto-char (point-max))
       (insert "Ezimage image cache.\n\n")
       (let ((start (point)) (end nil))
@@ -324,8 +323,7 @@ See `ezimage-expand-image-button-alist' for details."
 See `ezimage-expand-image-button-alist' for details."
   (interactive)
   (with-output-to-temp-buffer "*Ezimage Images*"
-    (save-excursion
-      (set-buffer "*Ezimage Images*")
+    (with-current-buffer "*Ezimage Images*"
       (goto-char (point-max))
       (insert "Ezimage image cache.\n\n")
       (let ((start (point)) (end nil))
index d12d3d48bd3dc40245ce3f0fdc494b4cf3023832..c205efad7a73cd8208f3390d070c39ca5b7abdc0 100644 (file)
@@ -494,8 +494,7 @@ argument BUFFER-NAME is nil, it defaults to *Colors*."
        (if lc
            (setcdr lc nil)))))
   (with-help-window (or buffer-name "*Colors*")
-    (save-excursion
-      (set-buffer standard-output)
+    (with-current-buffer standard-output
       (setq truncate-lines t)
       (if temp-buffer-show-function
          (list-colors-print list)
index 1dff7d0547a9a021b4f5b610258b920d67218831..2c49cd8bae2a78cd8f069c2ce6fa73ae48015f5b 100644 (file)
@@ -1273,8 +1273,7 @@ arg, prompt for a regular expression."
     (setq max-length (1+ max-length)
          line-format (format "%%-%ds" max-length))
     (with-help-window "*Faces*"
-      (save-excursion
-       (set-buffer standard-output)
+      (with-current-buffer standard-output
        (setq truncate-lines t)
        (insert
         (substitute-command-keys
@@ -1362,8 +1361,7 @@ If FRAME is omitted or nil, use the selected frame."
     (if (not (listp face))
        (setq face (list face)))
     (with-help-window (help-buffer)
-      (save-excursion
-       (set-buffer standard-output)
+      (with-current-buffer standard-output
        (dolist (f face)
          (if (stringp f) (setq f (intern f)))
          ;; We may get called for anonymous faces (i.e., faces
index 3fc64600786389c5832d26f0af68947ce2c97535..1bde2be0ef05ab0daf64758c2577d5612359a3cb 100644 (file)
@@ -5411,8 +5411,7 @@ and `list-directory-verbose-switches'."
       (princ "Directory ")
       (princ dirname)
       (terpri)
-      (save-excursion
-       (set-buffer "*Directory*")
+      (with-current-buffer "*Directory*"
        (let ((wildcard (not (file-directory-p dirname))))
          (insert-directory dirname switches wildcard (not wildcard)))))
     ;; Finishing with-output-to-temp-buffer seems to clobber default-directory.
index e287c1492022d8006f6c85df1e7431083f4d59d0..18cef4d24f7120e5969c702fca5cd0976ed20fb2 100644 (file)
@@ -1552,8 +1552,7 @@ First, save the buffer's contents using SAVE-FUNCTION.  Then, kill buffer
 if `buffer-modified-p' returns nil.
 
 SAVE-FUNCTION takes no argument, but works on the current buffer."
-  (save-excursion
-    (set-buffer buffer)
+  (with-current-buffer buffer
     (if (buffer-modified-p)
        (funcall save-function))
     (if (not (buffer-modified-p))
index 2e0515bb469531ef7d82bcf36f2a806c8a5c9dfb..98643f71777f3cc063250097bca55473b23766fe 100644 (file)
@@ -291,8 +291,7 @@ Thus ARG can also contain additional grep options."
   (let ((buf (process-buffer proc))
        (inhibit-read-only t))
     (if (buffer-name buf)
-       (save-excursion
-         (set-buffer buf)
+       (with-current-buffer buf
          (let ((buffer-read-only nil))
            (save-excursion
              (goto-char (point-max))
index 4c696a3e2a4098d6adb861e04c683602f356d54f..cba3c832064b5de0d52e5ef63cf92ed1a0a4b0b2 100644 (file)
@@ -332,8 +332,7 @@ FILE should be in a form suitable for passing to `locate-library'."
 (defun finder-mouse-select (event)
   "Select item in a finder buffer with the mouse."
   (interactive "e")
-  (save-excursion
-    (set-buffer (window-buffer (posn-window (event-start event))))
+  (with-current-buffer (window-buffer (posn-window (event-start event)))
     (goto-char (posn-point (event-start event)))
     (finder-select)))
 
index 06e663441bd605c4b2f8b8bb730ef1177bce6d9e..8113185ec75fe6b42636c7d2f97b29d5a857795d 100644 (file)
@@ -546,9 +546,7 @@ like an INI file.  You can add this hook to `find-file-hook'."
   (require 'comint)
   (let* ((file (buffer-file-name))
         (buf-name (concat "*" file "*")))
-    (save-excursion
-      (set-buffer
-       (get-buffer-create buf-name))
+    (with-current-buffer (get-buffer-create buf-name)
       (erase-buffer)
       (comint-mode)
       (comint-exec
index 9af6e38c4912d5ffe971582c724244434c1ac17f..15a68dfab7d7a4245dcd6d75984c2c14c66d61b0 100644 (file)
@@ -789,8 +789,7 @@ file local variable.\n")
                  (terpri)
                  (princ output))))
 
-           (save-excursion
-             (set-buffer standard-output)
+           (with-current-buffer standard-output
              ;; Return the text we displayed.
              (buffer-string))))))))
 
index 7c032b81cf2ba2b3777eb7ed08718a213a53c0c6..641738770a2ff9f276144958fb6e422a07e56178 100644 (file)
@@ -413,8 +413,7 @@ A special reference `back' is made to return back through a stack of
 help buffers.  Variable `help-back-label' specifies the text for
 that."
   (interactive "b")
-  (save-excursion
-    (set-buffer (or buffer (current-buffer)))
+  (with-current-buffer (or buffer (current-buffer))
     (goto-char (point-min))
     ;; Skip the header-type info, though it might be useful to parse
     ;; it at some stage (e.g. "function in `library'").
index fdce4f85109f0c0f9186ac02255ab36ac2c19720..e52fe07f8ae547564a81620b15eea9d3f2090700 100644 (file)
@@ -1000,8 +1000,7 @@ string).  It returns t if a new expansion is found, nil otherwise."
     (while (and (not (equal he-search-string ""))
                (marker-position he-search-loc)
                (not expansion))
-      (save-excursion
-       (set-buffer (marker-buffer he-search-loc))
+      (with-current-buffer (marker-buffer he-search-loc)
        (goto-char he-search-loc)
        (setq expansion (he-dabbrev-search he-search-string ()
                                           (window-end he-search-window)))
index d8f2800739f267003c8f114448903ff67df7e567..7317540db32126e7529a06a981e651b1624cfb29 100644 (file)
@@ -2975,8 +2975,7 @@ If repeated, insert text from buffer instead."
 (defun ido-copy-current-word (all)
   "Insert current word (file or directory name) from current buffer."
   (interactive "P")
-  (let ((word (save-excursion
-               (set-buffer ido-entry-buffer)
+  (let ((word (with-current-buffer ido-entry-buffer
                (let ((p (point)) start-line end-line start-name name)
                  (if (and mark-active (/= p (mark)))
                      (setq start-name (mark))
@@ -4184,8 +4183,7 @@ For details of keybindings, see `ido-find-file'."
            ido-text-init contents
            ido-rotate-temp t
            ido-exit 'refresh)
-      (save-excursion
-       (set-buffer buffer)
+      (with-current-buffer buffer
        (ido-tidy))
       (throw 'ido contents))))
 
index b78befba81e3bbcd55d2881809520d9c85adf307..57fa1da05ec024266ab7d38e5fdd673b92bd5ea2 100644 (file)
@@ -497,8 +497,7 @@ For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
                      nil ;(message "Checking validity of info file %s... OK" file)
                    (message "----------------------------------------------------------------------")
                    (message ">> PROBLEMS IN INFO FILE %s" file)
-                   (save-excursion
-                     (set-buffer loss-name)
+                   (with-current-buffer loss-name
                      (princ (buffer-substring-no-properties
                              (point-min) (point-max))))
                    (message "----------------------------------------------------------------------")
index a41f968dc5ff34e4801682417e17329b51a39338..c63992b0a6292123f66466a0dcb4f14606c69be4 100644 (file)
   (if ledit-save-files
       (save-some-buffers))
   (if (get-buffer ledit-buffer)
-      (save-excursion
-       (set-buffer ledit-buffer)
-       (goto-char (point-min))
-       (write-region (point-min) (point-max) ledit-zap-file)
-       (erase-buffer)))
+      (with-current-buffer ledit-buffer
+        (goto-char (point-min))
+        (write-region (point-min) (point-max) ledit-zap-file)
+        (erase-buffer)))
   (suspend-emacs ledit-go-to-lisp-string)
   (load ledit-read-file t t))
 
   (if ledit-save-files
       (save-some-buffers))
   (if (get-buffer ledit-buffer)
-      (save-excursion
-       (set-buffer ledit-buffer)
-       (goto-char (point-min))
-       (insert "(declare (macros t))\n")
-       (write-region (point-min) (point-max) ledit-compile-file)
-       (erase-buffer)))
+      (with-current-buffer ledit-buffer
+        (goto-char (point-min))
+        (insert "(declare (macros t))\n")
+        (write-region (point-min) (point-max) ledit-compile-file)
+        (erase-buffer)))
   (suspend-emacs ledit-go-to-liszt-string)
   (load ledit-read-file t t))
 
index 974b19a394e6f8afe6c4685d6351b62b7c6bed7d..d27a5b752a666975be2702acef1c6e36e710ed76 100644 (file)
@@ -209,8 +209,7 @@ Possibilities: \\<query-replace-map>
 \\[exit]       Stop the macro entirely right now.
 \\[recenter]   Redisplay the screen, then ask again.
 \\[edit]       Enter recursive edit; ask again when you exit from that."))
-                    (save-excursion
-                      (set-buffer standard-output)
+                    (with-current-buffer standard-output
                       (help-mode)))))))))))
 
 ;;;###autoload
index ea1551b7f67d351b21376d8d668d7c574214fb03..fbafd9077a05b53388816367c842cc81eea1fb78 100644 (file)
@@ -1857,8 +1857,7 @@ Buffers menu is regenerated."
 ;;nil means the buffer shouldn't be listed.  You can redefine this."
 ;;  (if (string-match "\\` " (buffer-name buffer))
 ;;      nil
-;;    (save-excursion
-;;     (set-buffer buffer)
+;;    (with-current-buffer buffer
 ;;     (let ((size (buffer-size)))
 ;;       (format "%s%s %-19s %6s %-15s %s"
 ;;            (if (buffer-modified-p) "*" " ")
index 67d797f488f98382038004e7adb7589f2d24cf22..86ddc4c5bfba1871c99d0663dbf5a3a3bb46e9e6 100644 (file)
@@ -200,8 +200,7 @@ by johnh@ficus.cs.ucla.edu."
                (window-buffer (posn-window (event-start click)))
              (current-buffer)))
        (error "Select or click on the buffer where the secondary selection is")))
-  (save-excursion
-    (set-buffer (overlay-buffer mouse-secondary-overlay))
+  (with-current-buffer (overlay-buffer mouse-secondary-overlay)
     (kill-region (overlay-start mouse-secondary-overlay)
                 (overlay-end mouse-secondary-overlay)))
   ;; (delete-overlay mouse-secondary-overlay)
index 943f53c781d114dddc7460e1918d7eb1d1065d3d..9ea4d8bff120658408c4f411c792d18a5eb5f6ca 100644 (file)
@@ -1975,12 +1975,10 @@ and selects that window."
                     (format "%%-%ds  %%s%%s  %%s" maxlen)
                     (buffer-name elt)
                     (if (buffer-modified-p elt) "*" " ")
-                    (save-excursion
-                      (set-buffer elt)
+                    (with-current-buffer elt
                       (if buffer-read-only "%" " "))
                     (or (buffer-file-name elt)
-                        (save-excursion
-                          (set-buffer elt)
+                        (with-current-buffer elt
                           (if list-buffers-directory
                               (expand-file-name
                                list-buffers-directory)))
index cb22433f7782b795f1f6706baba8566f3c170da2..963247dc40a469d64746de14b673c459b3e64310 100644 (file)
@@ -85,8 +85,7 @@ y   to try it and enable it (no questions if you use it again).
 n   to cancel--don't try the command, and it remains disabled.
 SPC to try the command just this once, but leave it disabled.
 !   to try it, and enable all disabled commands for this session only.")
-       (save-excursion
-        (set-buffer standard-output)
+       (with-current-buffer standard-output
         (help-mode)))
      (fit-window-to-buffer (get-buffer-window "*Disabled Command*"))
      (message "Type y, n, ! or SPC (the space bar): ")
@@ -135,9 +134,8 @@ to future sessions."
               (eq system-type 'windows-nt)
               (file-exists-p "~/_emacs"))
          (setq init-file "~/_emacs")))
-    (save-excursion
-      (set-buffer (find-file-noselect
-                  (substitute-in-file-name init-file)))
+    (with-current-buffer (find-file-noselect
+                          (substitute-in-file-name init-file))
       (goto-char (point-min))
       (if (search-forward (concat "(put '" (symbol-name command) " ") nil t)
          (delete-region
@@ -175,9 +173,8 @@ to future sessions."
               (eq system-type 'windows-nt)
               (file-exists-p "~/_emacs"))
          (setq init-file "~/_emacs")))
-    (save-excursion
-      (set-buffer (find-file-noselect
-                  (substitute-in-file-name init-file)))
+    (with-current-buffer (find-file-noselect
+                          (substitute-in-file-name init-file))
       (goto-char (point-min))
       (if (search-forward (concat "(put '" (symbol-name command) " ") nil t)
          (delete-region
index 46b5f00d182a2b9009565bf2abd5aa87c680f02e..ddd4685880b61f070adf305aff5bdc1b9e362abe 100644 (file)
@@ -3953,8 +3953,7 @@ If BUFFER is nil, the current buffer is used for printing.
 
 For more information, type \\[pr-interface-help]."
   (interactive)
-  (save-excursion
-    (set-buffer (or buffer (current-buffer)))
+  (with-current-buffer (or buffer (current-buffer))
     (pr-create-interface)))
 
 
@@ -4457,8 +4456,7 @@ image in a file with that name."
         (if (string= pr-ps-command "")
             ;; default action
             (let ((ps-spool-buffer (get-buffer-create ps-spool-buffer-name)))
-              (save-excursion
-                (set-buffer ps-spool-buffer)
+              (with-current-buffer ps-spool-buffer
                 (erase-buffer)
                 (insert-file-contents-literally file))
               (pr-despool-print))
@@ -5028,8 +5026,7 @@ Return only the dayname, if present, weekday, month, and year."
                      (symbol-value summary-buffer))
                 (symbol-value summary-default))))
     (and (get-buffer buf)
-        (save-excursion
-          (set-buffer buf)
+        (with-current-buffer buf
           (pr-mode-print n-up filename header-list)))))
 
 
@@ -5039,8 +5036,7 @@ Return only the dayname, if present, weekday, month, and year."
                      (symbol-value summary-buffer))
                 (symbol-value summary-default))))
     (and (get-buffer buf)
-        (save-excursion
-          (set-buffer buf)
+        (with-current-buffer buf
           (pr-mode-lpr header-list)))))
 
 
@@ -5633,8 +5629,7 @@ If menu binding was not done, calls `pr-menu-bind'."
        status)
     (setq args (pr-remove-nil-from-list args))
     ;; *Printing Command Output* == show command & args
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (goto-char (point-max))
       (insert (format "%s %S\n" cmd args)))
     ;; *Printing Command Output* == show any return message from command
@@ -5645,8 +5640,7 @@ If menu binding was not done, calls `pr-menu-bind'."
             ((quit error)
              (error-message-string data)))))
     ;; *Printing Command Output* == show exit status
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (goto-char (point-max))
       (insert (format "Exit status: %s\n\n" status)))
     ;; message if error status
@@ -5839,8 +5833,7 @@ If menu binding was not done, calls `pr-menu-bind'."
          (blist (buffer-list))
          found)
       (while (and (not found) blist)
-       (save-excursion
-         (set-buffer (car blist))
+       (with-current-buffer (car blist)
          (and (eq major-mode 'dired-mode)
               (save-excursion
                 (goto-char (point-min))
@@ -5864,9 +5857,8 @@ If menu binding was not done, calls `pr-menu-bind'."
                         pop-up-frames)
                     (and (or buffer
                              (file-readable-p file))
-                         (save-excursion
-                           (set-buffer (or buffer
-                                           (find-file-noselect file)))
+                         (with-current-buffer (or buffer
+                                                   (find-file-noselect file))
                            (funcall fun)
                            (or buffer
                                (kill-buffer (current-buffer))))))))
@@ -6047,8 +6039,7 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
 
 
 (defmacro pr-interface-save (&rest body)
-  `(save-excursion
-     (set-buffer pr-i-buffer)
+  `(with-current-buffer pr-i-buffer
      ,@body))
 
 
index 46c5f9842d578572e5bcefb2734ba758b7b97aa3..2b99a16a4a795b2ff9d1bb02413b56585a16d3d7 100644 (file)
@@ -95,8 +95,7 @@ If BDFNAME doesn't exist, return nil."
   (and (file-readable-p bdfname)
        (let ((buf (generate-new-buffer " *bdf-work*"))
             (coding-system-for-read 'no-conversion))
-        (save-excursion
-          (set-buffer buf)
+        (with-current-buffer buf
           (insert-file-contents bdfname)
           buf))))
 
@@ -225,8 +224,7 @@ CODE, where N and CODE are in the following relation:
        (message "Reading %s..." bdfname)
       (error "BDF file %s doesn't exist" bdfname))
     (unwind-protect
-       (save-excursion
-         (set-buffer buf)
+       (with-current-buffer buf
          (goto-char (point-min))
          (search-forward "\nFONTBOUNDINGBOX")
          (setq font-bounding-box
index 8bf3d91607dc07151f44c94141bfb9366de88229..3f0538fa3c37f1ed02464d669d99f7e8935f6bc6 100644 (file)
@@ -4734,8 +4734,7 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th
   (ps-output 'prologue (if (stringp args) (list args) args)))
 
 (defun ps-flush-output ()
-  (save-excursion
-    (set-buffer ps-spool-buffer)
+  (with-current-buffer ps-spool-buffer
     (goto-char (point-max))
     (while ps-output-head
       (let ((it (car ps-output-head)))
@@ -4756,8 +4755,7 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th
 
 (defun ps-insert-file (fname)
   (ps-flush-output)
-  (save-excursion
-    (set-buffer ps-spool-buffer)
+  (with-current-buffer ps-spool-buffer
     (goto-char (point-max))
     (insert-file-contents fname)))
 
@@ -4840,8 +4838,7 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th
 
 
 (defun ps-get-boundingbox ()
-  (save-excursion
-    (set-buffer ps-spool-buffer)
+  (with-current-buffer ps-spool-buffer
     (save-excursion
       (if (re-search-forward ps-boundingbox-re nil t)
          (vector (string-to-number     ; lower x
@@ -4909,8 +4906,7 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th
           ;; coordinate adjustment to center image
           ;; around x and y position
           (let ((box (ps-get-boundingbox)))
-            (save-excursion
-              (set-buffer ps-spool-buffer)
+            (with-current-buffer ps-spool-buffer
               (save-excursion
                 (if (re-search-backward "^--back--" nil t)
                     (replace-match
@@ -5795,8 +5791,7 @@ XSTART YSTART are the relative position for the first page in a sheet.")
                                             ps-line-number-step
                                           ps-zebra-stripe-height))))
   ;; spooling buffer
-  (save-excursion
-    (set-buffer ps-spool-buffer)
+  (with-current-buffer ps-spool-buffer
     (goto-char (point-max))
     (and (re-search-backward "^%%Trailer$" nil t)
         (delete-region (match-beginning 0) (point-max))))
@@ -6573,8 +6568,7 @@ If FACE is not a valid face name, use default face."
          (and ps-razzle-dazzle (message "Wrote %s" filename)))
       ;; Else, spool to the printer
       (and ps-razzle-dazzle (message "Printing..."))
-      (save-excursion
-       (set-buffer ps-spool-buffer)
+      (with-current-buffer ps-spool-buffer
        (let* ((coding-system-for-write 'raw-text-unix)
               (ps-printer-name (or ps-printer-name
                                    (and (boundp 'printer-name)
index ce2429fe57c374dc848280d9574ece02b5ccd47c..0288559ca31a94c3a93dfb7ad3f890c099c459d6 100644 (file)
@@ -72,8 +72,7 @@
                         (symbol-value summary-buffer))
                    summary-default)))
     (and (get-buffer ps-buf)
-        (save-excursion
-          (set-buffer ps-buf)
+        (with-current-buffer ps-buf
           (ps-spool-buffer-with-faces)))))
 
 ;; Look in an article or mail message for the Subject: line.  To be
index 6ef259b2aaec95c984f2e9fa759c28ff4e0d4634..f58e15e6e5c96235e708dc5923bd14daef476dfc 100644 (file)
@@ -205,8 +205,7 @@ may have changed\) back to `save-place-alist'."
 (defun save-place-alist-to-file ()
   (let ((file (expand-file-name save-place-file))
         (coding-system-for-write 'utf-8))
-    (save-excursion
-      (set-buffer (get-buffer-create " *Saved Places*"))
+    (with-current-buffer (get-buffer-create " *Saved Places*")
       (delete-region (point-min) (point-max))
       (when save-place-forget-unreadable-files
        (save-place-forget-unreadable-files))
@@ -236,10 +235,9 @@ may have changed\) back to `save-place-alist'."
           ;; make sure that the alist does not get overwritten, and then
           ;; load it if it exists:
           (if (file-readable-p file)
-              (save-excursion
-                ;; don't want to use find-file because we have been
-                ;; adding hooks to it.
-                (set-buffer (get-buffer-create " *Saved Places*"))
+              ;; don't want to use find-file because we have been
+              ;; adding hooks to it.
+              (with-current-buffer (get-buffer-create " *Saved Places*")
                 (delete-region (point-min) (point-max))
                 (insert-file-contents file)
                 (goto-char (point-min))
@@ -275,8 +273,7 @@ may have changed\) back to `save-place-alist'."
       ;; put this into a save-excursion in case someone is counting on
       ;; another function in kill-emacs-hook to act on the last buffer
       ;; they were in:
-      (save-excursion
-       (set-buffer (car buf-list))
+      (with-current-buffer (car buf-list)
        ;; save-place checks buffer-file-name too, but we can avoid
        ;; overhead of function call by checking here too.
        (and buffer-file-name (save-place-to-alist))
index 6140580cd3b69919e86bb5471943526a5834ca38..01fd67c879f83ebea3cb3a09aed7cf9812d28b63 100644 (file)
@@ -85,8 +85,7 @@ If we have an image associated with it, use that image."
 See `speedbar-expand-image-button-alist' for details."
   (interactive)
   (with-output-to-temp-buffer "*Speedbar Images*"
-    (save-excursion
-      (set-buffer "*Speedbar Images*")
+    (with-current-buffer "*Speedbar Images*"
       (goto-char (point-max))
       (insert "Speedbar image cache.\n\n")
       (let ((start (point)) (end nil))
index eed6921b7e7e0d253585f96a5a97f6bce4017894..f50bb12cbbecb355955bd73454e838448406b8fb 100644 (file)
@@ -156,7 +156,7 @@ Horizontal scroll bars aren't implemented yet."
 \f
 ;;;; Buffer navigation using the scroll bar.
 
-;;; This was used for up-events on button 2, but no longer.
+;; This was used for up-events on button 2, but no longer.
 (defun scroll-bar-set-window-start (event)
   "Set the window start according to where the scroll bar is dragged.
 EVENT should be a scroll bar click or drag event."
@@ -164,8 +164,7 @@ EVENT should be a scroll bar click or drag event."
   (let* ((end-position (event-end event))
         (window (nth 0 end-position))
         (portion-whole (nth 2 end-position)))
-    (save-excursion
-      (set-buffer (window-buffer window))
+    (with-current-buffer (window-buffer window)
       (save-excursion
        (goto-char (+ (point-min)
                      (scroll-bar-scale portion-whole
@@ -195,8 +194,7 @@ EVENT should be a scroll bar click or drag event."
         portion-start
         next-portion-start
         (current-start (window-start window)))
-    (save-excursion
-      (set-buffer (window-buffer window))
+    (with-current-buffer (window-buffer window)
       (setq portion-start (scroll-bar-drag-position portion-whole))
       (setq next-portion-start (max
                                (scroll-bar-drag-position next-portion-whole)
@@ -212,8 +210,7 @@ EVENT should be a scroll bar click or drag event."
   (let* ((start-position (event-start event))
         (window (nth 0 start-position))
         (portion-whole (nth 2 start-position)))
-    (save-excursion
-      (set-buffer (window-buffer window))
+    (with-current-buffer (window-buffer window)
       ;; Calculate position relative to the accessible part of the buffer.
       (goto-char (+ (point-min)
                    (scroll-bar-scale portion-whole
@@ -339,7 +336,7 @@ EVENT should be a scroll bar click."
 \f
 ;;;; Bindings.
 
-;;; For now, we'll set things up to work like xterm.
+;; For now, we'll set things up to work like xterm.
 (cond ((and (boundp 'x-toolkit-scroll-bars) x-toolkit-scroll-bars)
        (global-set-key [vertical-scroll-bar mouse-1]
                       'scroll-bar-toolkit-scroll))
index 7cd0e325da0ae4494c56335c07462b5db35e7043..d2cf09b475b315be3f7b4f8193ed13715154230a 100644 (file)
@@ -707,8 +707,7 @@ With non-nil argument also saves the buffer."
 
 (defun shadow-save-todo-file ()
   (if (and shadow-todo-buffer (buffer-modified-p shadow-todo-buffer))
-      (save-excursion
-       (set-buffer shadow-todo-buffer)
+      (with-current-buffer shadow-todo-buffer
        (condition-case nil             ; have to continue even in case of
            (basic-save-buffer)         ; error, otherwise kill-emacs might
          (error                        ; not work!
index e1d0f052ea0395af8843958bf61eefa505c4e5f3..d87ddab685d44685b34eeb0c3b149b13e345b88c 100644 (file)
@@ -2423,8 +2423,7 @@ specifies the value of ERROR-BUFFER."
              ;; Clear the output buffer, then run the command with
              ;; output there.
              (let ((directory default-directory))
-               (save-excursion
-                 (set-buffer buffer)
+               (with-current-buffer buffer
                  (setq buffer-read-only nil)
                  (if (not output-buffer)
                      (setq default-directory directory))
@@ -3469,11 +3468,10 @@ START and END specify the portion of the current buffer to be copied."
    (list (read-buffer "Append to buffer: " (other-buffer (current-buffer) t))
         (region-beginning) (region-end)))
   (let ((oldbuf (current-buffer)))
-    (save-excursion
-      (let* ((append-to (get-buffer-create buffer))
-            (windows (get-buffer-window-list append-to t t))
-            point)
-       (set-buffer append-to)
+    (let* ((append-to (get-buffer-create buffer))
+           (windows (get-buffer-window-list append-to t t))
+           point)
+      (with-current-buffer append-to
        (setq point (point))
        (barf-if-buffer-read-only)
        (insert-buffer-substring oldbuf start end)
@@ -3490,8 +3488,7 @@ BUFFER (or buffer name), START and END.
 START and END specify the portion of the current buffer to be copied."
   (interactive "BPrepend to buffer: \nr")
   (let ((oldbuf (current-buffer)))
-    (save-excursion
-      (set-buffer (get-buffer-create buffer))
+    (with-current-buffer (get-buffer-create buffer)
       (barf-if-buffer-read-only)
       (save-excursion
        (insert-buffer-substring oldbuf start end)))))
index 2559057cc2228111dfd2f4eff625bff08fcabc7e..1266c0c1a07de423bce15e6bd974a7970d24580b 100644 (file)
@@ -1173,8 +1173,7 @@ frame and window to be the currently active frame and window."
               (with-no-warnings
                 (specifier-instance has-modeline-p)))
           speedbar-buffer)
-      (save-excursion
-       (set-buffer speedbar-buffer)
+      (with-current-buffer speedbar-buffer
        (let* ((w (or (speedbar-frame-width) 20))
               (p1 "<<")
               (p5 ">>")
@@ -1246,8 +1245,7 @@ and the existence of packages."
                               (current-buffer))
                              speedbar-special-mode-key-map)
                        (select-frame cf))))))
-    (save-excursion
-      (set-buffer speedbar-buffer)
+    (with-current-buffer speedbar-buffer
       (use-local-map (or localmap
                         (speedbar-initial-keymap)
                         ;; This creates a small keymap we can glom the
@@ -1859,8 +1857,7 @@ of the special mode functions."
   (if (stringp buffer) (setq buffer (get-buffer buffer)))
   (if (not (buffer-live-p buffer))
       nil
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (save-match-data
        (let ((ms (symbol-name major-mode)) v)
          (if (not (string-match "-mode$" ms))
@@ -1893,8 +1890,7 @@ of the special mode functions."
 
 (defun speedbar-remove-localized-speedbar-support (buffer)
   "Remove any traces that BUFFER supports speedbar in a specialized way."
-  (save-excursion
-    (set-buffer buffer)
+  (with-current-buffer buffer
     (kill-local-variable 'speedbar-special-mode-expansion-list)
     (kill-local-variable 'speedbar-special-mode-key-map)
     (kill-local-variable 'speedbar-easymenu-definition-special)))
@@ -2383,8 +2379,8 @@ the list."
              (or (speedbar-line-file)
                  (speedbar-line-directory))))
         (methods (if (get-file-buffer f)
-                     (save-excursion (set-buffer (get-file-buffer f))
-                                     speedbar-tag-hierarchy-method)
+                     (with-current-buffer (get-file-buffer f)
+                        speedbar-tag-hierarchy-method)
                    speedbar-tag-hierarchy-method))
         (lst (if (fboundp 'copy-tree)
                  (copy-tree lst)
@@ -2612,9 +2608,8 @@ name will have the function FIND-FUN and not token."
 This should only be used by modes classified as special."
   (let ((funclst speedbar-special-mode-expansion-list)
        (specialbuff (current-buffer)))
-    (save-excursion
-      (setq speedbar-desired-buffer specialbuff)
-      (set-buffer speedbar-buffer)
+    (setq speedbar-desired-buffer specialbuff)
+    (with-current-buffer speedbar-buffer
       ;; If we are leaving a directory, cache it.
       (if (not speedbar-shown-directories)
          ;; Do nothing
@@ -3887,8 +3882,8 @@ If TEMP is non-nil, then clicking on a buffer restores the previous display."
                                    (buffer-name (car bl))))
               (expchar (if known ?+ ??))
               (fn (if known 'speedbar-tag-file nil))
-              (fname (save-excursion (set-buffer (car bl))
-                                     (buffer-file-name))))
+              (fname (with-current-buffer (car bl)
+                        (buffer-file-name))))
          (speedbar-make-tag-line 'bracket expchar fn
                                  (if fname (file-name-nondirectory fname))
                                  (buffer-name (car bl))
@@ -3928,8 +3923,7 @@ If TEMP is non-nil, then clicking on a buffer restores the previous display."
   "Add a note to the end of the last tag line.
 Argument BUFFER is the buffer being tested."
   (let (mod ro)
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (setq mod (buffer-modified-p)
            ro buffer-read-only))
     (if ro (speedbar-insert-button "%" nil nil nil nil t))))
@@ -3943,9 +3937,8 @@ Argument BUFFER is the buffer being tested."
             (speedbar-message "%s%s %S %d %s"
                               (if (buffer-modified-p buffer) "* " "")
                               item
-                              (save-excursion (set-buffer buffer) major-mode)
-                              (save-excursion (set-buffer buffer)
-                                              (buffer-size))
+                              (with-current-buffer buffer major-mode)
+                              (with-current-buffer buffer (buffer-size))
                               (or (buffer-file-name buffer) "<No file>"))))))
 
 (defun speedbar-buffers-line-directory (&optional depth)
@@ -3963,8 +3956,7 @@ Optional argument DEPTH specifies the current depth of the back search."
              (if (save-excursion
                    (end-of-line)
                    (eq start (point)))
-                 (or (save-excursion (set-buffer buffer)
-                                     default-directory)
+                 (or (with-current-buffer buffer default-directory)
                      "")
                (buffer-file-name buffer))))))))
 
index d033f779980e16a70a599fbc7049f12fdc111393..ba5ca20a2c1b4599b41609c725b20ebac60f0c5c 100644 (file)
@@ -1536,8 +1536,7 @@ Encode/decode your strokes with \\[strokes-encode-buffer],
 (defun strokes-xpm-to-compressed-string (&optional xpm-buffer)
   "Convert XPM in XPM-BUFFER to compressed string representing the stroke.
 XPM-BUFFER defaults to ` *strokes-xpm*'."
-  (save-excursion
-    (set-buffer (setq xpm-buffer (or xpm-buffer " *strokes-xpm*")))
+  (with-current-buffer (setq xpm-buffer (or xpm-buffer " *strokes-xpm*"))
     (goto-char (point-min))
     (search-forward "/* pixels */")    ; skip past header junk
     (forward-char 2)
@@ -1620,8 +1619,7 @@ Optional BUFFER defaults to the current buffer.
 Optional FORCE non-nil will ignore the buffer's read-only status."
   (interactive)
   ;;  (interactive "*bStrokify buffer: ")
-  (save-excursion
-    (set-buffer (setq buffer (get-buffer (or buffer (current-buffer)))))
+  (with-current-buffer (setq buffer (get-buffer (or buffer (current-buffer))))
     (when (or (not buffer-read-only)
              force
              inhibit-read-only
@@ -1669,8 +1667,7 @@ Optional FORCE non-nil will ignore the buffer's read-only status."
   ;; buffer is killed?
   ;;  (interactive "*bUnstrokify buffer: ")
   (interactive)
-  (save-excursion
-    (set-buffer (setq buffer (or buffer (current-buffer))))
+  (with-current-buffer (setq buffer (or buffer (current-buffer)))
     (when (or (not buffer-read-only)
              force
              inhibit-read-only
@@ -1706,9 +1703,8 @@ Optional FORCE non-nil will ignore the buffer's read-only status."
 (defun strokes-xpm-for-compressed-string (compressed-string &optional bufname)
   "Convert the stroke represented by COMPRESSED-STRING into an XPM.
 Store XPM in buffer BUFNAME if supplied \(default is ` *strokes-xpm*'\)"
-  (save-excursion
-    (or bufname (setq bufname " *strokes-xpm*"))
-    (set-buffer (get-buffer-create bufname))
+  (or bufname (setq bufname " *strokes-xpm*"))
+  (with-current-buffer (get-buffer-create bufname)
     (erase-buffer)
     (insert compressed-string)
     (goto-char (point-min))
index 97d2fa5a74e515fc759976d45d9b5b9563da113f..61dd3f415f0e7da8654ea987d36243387808f8f8 100644 (file)
@@ -1347,8 +1347,7 @@ the process.  Any more args are arguments to PROGRAM."
     ;; If no process, or nuked process, crank up a new one and put buffer in
     ;; term mode.  Otherwise, leave buffer and existing process alone.
     (cond ((not (term-check-proc buffer))
-          (save-excursion
-            (set-buffer buffer)
+          (with-current-buffer buffer
             (term-mode)) ; Install local vars, mode, keymap, ...
           (term-exec buffer name program startfile switches)))
     buffer))
@@ -1375,8 +1374,7 @@ commands to use in that buffer.
 Blasts any old process running in the buffer.  Doesn't set the buffer mode.
 You can use this to cheaply run a series of processes in the same term
 buffer.  The hook `term-exec-hook' is run after each exec."
-  (save-excursion
-    (set-buffer buffer)
+  (with-current-buffer buffer
     (let ((proc (get-buffer-process buffer)))  ; Blast any old process.
       (when proc (delete-process proc)))
     ;; Crank up a new process
@@ -1412,24 +1410,16 @@ The main purpose is to get rid of the local keymap."
       (if (null (buffer-name buffer))
          ;; buffer killed
          (set-process-buffer proc nil)
-       (let ((obuf (current-buffer)))
-         ;; save-excursion isn't the right thing if
-         ;; process-buffer is current-buffer
-         (unwind-protect
-             (progn
-               ;; Write something in the compilation buffer
-               ;; and hack its mode line.
-               (set-buffer buffer)
-               ;; Get rid of local keymap.
-               (use-local-map nil)
-               (term-handle-exit (process-name proc)
-                                 msg)
-               ;; Since the buffer and mode line will show that the
-               ;; process is dead, we can delete it now.  Otherwise it
-               ;; will stay around until M-x list-processes.
-               (delete-process proc))
-           (set-buffer obuf)))
-       ))))
+       (with-current-buffer buffer
+          ;; Write something in the compilation buffer
+          ;; and hack its mode line.
+          ;; Get rid of local keymap.
+          (use-local-map nil)
+          (term-handle-exit (process-name proc) msg)
+          ;; Since the buffer and mode line will show that the
+          ;; process is dead, we can delete it now.  Otherwise it
+          ;; will stay around until M-x list-processes.
+          (delete-process proc))))))
 
 (defun term-handle-exit (process-name msg)
   "Write process exit (or other change) message MSG in the current buffer."
@@ -1557,8 +1547,7 @@ See also `term-input-ignoredups' and `term-write-input-ring'."
               (count 0)
               (ring (make-ring term-input-ring-size)))
           (unwind-protect
-              (save-excursion
-                (set-buffer history-buf)
+              (with-current-buffer history-buf
                 (widen)
                 (erase-buffer)
                 (insert-file-contents file)
@@ -1601,8 +1590,7 @@ See also `term-read-input-ring'."
                (index (ring-length ring)))
           ;; Write it all out into a buffer first.  Much faster, but messier,
           ;; than writing it one line at a time.
-          (save-excursion
-            (set-buffer history-buf)
+          (with-current-buffer history-buf
             (erase-buffer)
             (while (> index 0)
               (setq index (1- index))
@@ -2460,10 +2448,8 @@ See `term-prompt-regexp'."
               (y-or-n-p (format "Save buffer %s first? "
                                 (buffer-name buff))))
       ;; save BUFF.
-      (let ((old-buffer (current-buffer)))
-       (set-buffer buff)
-       (save-buffer)
-       (set-buffer old-buffer)))))
+      (with-current-buffer buff
+       (save-buffer)))))
 
 
 ;; (TERM-GET-SOURCE prompt prev-dir/file source-modes mustmatch-p)
@@ -3453,8 +3439,7 @@ The top-most line is line 0."
 (defun term-display-buffer-line (buffer line)
   (let* ((window (display-buffer buffer t))
         (pos))
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (save-restriction
        (widen)
        (goto-char (point-min))
@@ -3896,8 +3881,7 @@ if KIND is 1, erase from home to point; else erase from home to point-max."
             (message "Output logging off."))
     (if (get-buffer name)
        nil
-      (save-excursion
-       (set-buffer (get-buffer-create name))
+      (with-current-buffer (get-buffer-create name)
        (fundamental-mode)
        (buffer-disable-undo (current-buffer))
        (erase-buffer)))
@@ -4169,8 +4153,7 @@ Typing SPC flushes the help buffer."
       (display-completion-list (sort completions 'string-lessp)))
     (message "Hit space to flush")
     (let (key first)
-      (if (save-excursion
-           (set-buffer (get-buffer "*Completions*"))
+      (if (with-current-buffer (get-buffer "*Completions*")
            (setq key (read-key-sequence nil)
                  first (aref key 0))
            (and (consp first)
@@ -4197,8 +4180,7 @@ the process.  Any more args are arguments to PROGRAM."
     ;; If no process, or nuked process, crank up a new one and put buffer in
     ;; term mode.  Otherwise, leave buffer and existing process alone.
     (cond ((not (term-check-proc buffer))
-          (save-excursion
-            (set-buffer buffer)
+          (with-current-buffer buffer
             (term-mode)) ; Install local vars, mode, keymap, ...
           (term-exec buffer name program startfile switches)))
     buffer))
@@ -4383,8 +4365,7 @@ use in that buffer.
                    :coding 'no-conversion
                    :noquery t))
          (buffer (process-buffer process)))
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (term-mode)
       (term-char-mode)
       (goto-char (point-max))
index a015a91804755fd822b351e5cb17b5429ecb5816..1ac96aad1d23faad3e1ddda82a770a2cd65e22d2 100644 (file)
@@ -326,8 +326,7 @@ Very poor man's file transfer protocol."
             (message "Output logging off."))
     (if (get-buffer name)
        nil
-      (save-excursion
-       (set-buffer (get-buffer-create name))
+      (with-current-buffer (get-buffer-create name)
        (fundamental-mode)
        (buffer-disable-undo (current-buffer))
        (erase-buffer)))
@@ -610,8 +609,7 @@ together with a command \\<terminal-edit-map>to return to terminal emulation: \\
                               "%-"))
   (set-process-filter te-process
     (function (lambda (process string)
-               (save-excursion
-                 (set-buffer (process-buffer process))
+               (with-current-buffer (process-buffer process)
                  (setq te-pending-output (nconc te-pending-output
                                                 (list string))))
                  (te-update-pending-output-display))))
@@ -874,27 +872,22 @@ move to start of new line, clear to end of line."
 \f
 
 (defun te-filter (process string)
-  (let* ((obuf (current-buffer)))
-    ;; can't use save-excursion, as that preserves point, which we don't want
-    (unwind-protect
-       (progn
-         (set-buffer (process-buffer process))
-         (goto-char te-saved-point)
-         (and (bufferp te-log-buffer)
-              (if (null (buffer-name te-log-buffer))
-                  ;; killed
-                  (setq te-log-buffer nil)
-                (set-buffer te-log-buffer)
-                (goto-char (point-max))
-                (insert-before-markers string)
-                (set-buffer (process-buffer process))))
-         (setq te-pending-output (nconc te-pending-output (list string)))
-         (te-update-pending-output-display)
-         (te-process-output (eq (current-buffer)
-                                (window-buffer (selected-window))))
-         (set-buffer (process-buffer process))
-         (setq te-saved-point (point)))
-      (set-buffer obuf))))
+  (with-current-buffer (process-buffer process)
+    (goto-char te-saved-point)
+    (and (bufferp te-log-buffer)
+         (if (null (buffer-name te-log-buffer))
+             ;; killed
+             (setq te-log-buffer nil)
+           (set-buffer te-log-buffer)
+           (goto-char (point-max))
+           (insert-before-markers string)
+           (set-buffer (process-buffer process))))
+    (setq te-pending-output (nconc te-pending-output (list string)))
+    (te-update-pending-output-display)
+    (te-process-output (eq (current-buffer)
+                           (window-buffer (selected-window))))
+    (set-buffer (process-buffer process))
+    (setq te-saved-point (point))))
 
 ;; (A version of the following comment which might be distractingly offensive
 ;; to some readers has been moved to term-nasty.el.)
@@ -1043,8 +1036,7 @@ move to start of new line, clear to end of line."
   (cond ((eq (process-status process) 'run))
        ((null (buffer-name (process-buffer process)))) ;deleted
        (t (let ((b (current-buffer)))
-            (save-excursion
-              (set-buffer (process-buffer process))
+            (with-current-buffer (process-buffer process)
               (setq buffer-read-only nil)
               (fundamental-mode)
               (goto-char (point-max))
@@ -1097,27 +1089,26 @@ This function calls the value of terminal-mode-hook if that exists
 and is non-nil after the terminal buffer has been set up and the
 subprocess started."
   (interactive
-    (cons (save-excursion
-           (set-buffer (get-buffer-create "*terminal*"))
-           (buffer-name (if (or (not (boundp 'te-process))
-                                (null te-process)
-                                (not (eq (process-status te-process)
-                                         'run)))
-                            (current-buffer)
-                          (generate-new-buffer "*terminal*"))))
-         (append
-           (let* ((default-s
-                    ;; Default shell is same thing M-x shell uses.
-                    (or explicit-shell-file-name
-                        (getenv "ESHELL")
-                        (getenv "SHELL")
-                        "/bin/sh"))
-                  (s (read-string
-                      (format "Run program in emulator (default %s): "
-                              default-s))))
-             (if (equal s "")
-                 (list default-s '())
-               (te-parse-program-and-args s))))))
+   (cons (with-current-buffer (get-buffer-create "*terminal*")
+           (buffer-name (if (or (not (boundp 'te-process))
+                                (null te-process)
+                                (not (eq (process-status te-process)
+                                         'run)))
+                            (current-buffer)
+                          (generate-new-buffer "*terminal*"))))
+         (append
+          (let* ((default-s
+                   ;; Default shell is same thing M-x shell uses.
+                   (or explicit-shell-file-name
+                       (getenv "ESHELL")
+                       (getenv "SHELL")
+                       "/bin/sh"))
+                 (s (read-string
+                     (format "Run program in emulator (default %s): "
+                             default-s))))
+            (if (equal s "")
+                (list default-s '())
+              (te-parse-program-and-args s))))))
   (switch-to-buffer buffer)
   (if (null width) (setq width (- (window-width (selected-window)) 1)))
   (if (null height) (setq height (- (window-height (selected-window)) 1)))
index d2adad1e82fe140778024679e9db3516ae741bf2..6996086c0ff0ef6f41d8a2f29717ccdbe8078fc0 100644 (file)
@@ -660,8 +660,7 @@ The new forms being recommended now will continue to work then.")
 Suggests replacing OLD-FORM with NEW-FORM."
   (cond
    (time-stamp-conversion-warn
-    (save-excursion
-      (set-buffer (get-buffer-create "*Time-stamp-compatibility*"))
+    (with-current-buffer (get-buffer-create "*Time-stamp-compatibility*")
       (goto-char (point-max))
       (if (bobp)
          (progn
index a72de04256e0c2747c93b57d23d66269f5b79b78..4c150ca575ad300016b6f7a363efbdc360729651 100644 (file)
@@ -1094,7 +1094,7 @@ FRAC should be the inverse of the fractional value; for example, a value of
 (defun type-break-force-mode-line-update (&optional all)
   "Force the mode-line of the current buffer to be redisplayed.
 With optional non-nil ALL, force redisplay of all mode-lines."
-  (and all (save-excursion (set-buffer (other-buffer))))
+  (and all (with-current-buffer (other-buffer)))
   (set-buffer-modified-p (buffer-modified-p)))
 
 ;; If an exception occurs in Emacs while running the post command hook, the
@@ -1108,9 +1108,9 @@ With optional non-nil ALL, force redisplay of all mode-lines."
 
 \f
 ;;; Timer wrapper functions
-;;;
-;;; These shield type-break from variations in the interval timer packages
-;;; for different versions of Emacs.
+;;
+;; These shield type-break from variations in the interval timer packages
+;; for different versions of Emacs.
 
 (defun type-break-run-at-time (time repeat function)
   (condition-case nil (or (require 'timer) (require 'itimer)) (error nil))
index 93848cb49434a86ee006e3bee9d4cf3c708ba380..58b6c6046665da5e306e915fe114eb6bdbc84780 100644 (file)
@@ -91,8 +91,7 @@ You can <s>teal the file; the other user becomes the
   intruder if (s)he ever unmodifies the file and then changes it again.
 You can <p>roceed; you edit at your own (and the other user's) risk.
 You can <q>uit; don't modify this file.")
-    (save-excursion
-      (set-buffer standard-output)
+    (with-current-buffer standard-output
       (help-mode))))
 
 (put
@@ -155,8 +154,7 @@ If you say `n', the change you started to make will be aborted.
 
 Usually, you should type `n' and then `M-x revert-buffer',
 to get the latest version of the file, then make the change again.")
-    (save-excursion
-      (set-buffer standard-output)
+    (with-current-buffer standard-output
       (help-mode))))
 
 ;; arch-tag: a61c5b60-e1c8-44fd-894a-c617f4dfc639
index 7352cbc4b6deb67f5b8715317d4c896c40103459..ddc27e4b36c7475c3ecc5f8fb09cbfd2759c9d20 100644 (file)
@@ -1055,65 +1055,64 @@ Returns: nil            if no headers were found
   (cond
    ((not (get-file-buffer file)) nil)
    ((let (status version locking-user)
-     (save-excursion
-      (set-buffer (get-file-buffer file))
-      (goto-char (point-min))
-      (cond
-       ;; search for $Id or $Header
-       ;; -------------------------
-       ;; The `\ 's below avoid an RCS 5.7 bug when checking in this file.
-       ((or (and (search-forward "$Id\ : " nil t)
-                (looking-at "[^ ]+ \\([0-9.]+\\) "))
-           (and (progn (goto-char (point-min))
-                       (search-forward "$Header\ : " nil t))
-                (looking-at "[^ ]+ \\([0-9.]+\\) ")))
-       (goto-char (match-end 0))
-       ;; if found, store the revision number ...
-       (setq version (match-string-no-properties 1))
-       ;; ... and check for the locking state
-       (cond
-        ((looking-at
-          (concat "[0-9]+[/-][01][0-9][/-][0-3][0-9] "             ; date
-           "[0-2][0-9]:[0-5][0-9]+:[0-6][0-9]+\\([+-][0-9:]+\\)? " ; time
-                  "[^ ]+ [^ ]+ "))                       ; author & state
-         (goto-char (match-end 0)) ; [0-6] in regexp handles leap seconds
-         (cond
-          ;; unlocked revision
-          ((looking-at "\\$")
-           (setq locking-user 'none)
-           (setq status 'rev-and-lock))
-          ;; revision is locked by some user
-          ((looking-at "\\([^ ]+\\) \\$")
-           (setq locking-user (match-string-no-properties 1))
-           (setq status 'rev-and-lock))
-          ;; everything else: false
-          (nil)))
-        ;; unexpected information in
-        ;; keyword string --> quit
-        (nil)))
-       ;; search for $Revision
-       ;; --------------------
-       ((re-search-forward (concat "\\$"
-                                  "Revision: \\([0-9.]+\\) \\$")
-                          nil t)
-       ;; if found, store the revision number ...
-       (setq version (match-string-no-properties 1))
-       ;; and see if there's any lock information
-       (goto-char (point-min))
-       (if (re-search-forward (concat "\\$" "Locker:") nil t)
-           (cond ((looking-at " \\([^ ]+\\) \\$")
-                  (setq locking-user (match-string-no-properties 1))
-                  (setq status 'rev-and-lock))
-                 ((looking-at " *\\$")
-                  (setq locking-user 'none)
-                  (setq status 'rev-and-lock))
-                 (t
-                  (setq locking-user 'none)
-                  (setq status 'rev-and-lock)))
-         (setq status 'rev)))
-       ;; else: nothing found
-       ;; -------------------
-       (t nil)))
+      (with-current-buffer (get-file-buffer file)
+        (goto-char (point-min))
+        (cond
+         ;; search for $Id or $Header
+         ;; -------------------------
+         ;; The `\ 's below avoid an RCS 5.7 bug when checking in this file.
+         ((or (and (search-forward "$Id\ : " nil t)
+                   (looking-at "[^ ]+ \\([0-9.]+\\) "))
+              (and (progn (goto-char (point-min))
+                          (search-forward "$Header\ : " nil t))
+                   (looking-at "[^ ]+ \\([0-9.]+\\) ")))
+          (goto-char (match-end 0))
+          ;; if found, store the revision number ...
+          (setq version (match-string-no-properties 1))
+          ;; ... and check for the locking state
+          (cond
+           ((looking-at
+             (concat "[0-9]+[/-][01][0-9][/-][0-3][0-9] "             ; date
+              "[0-2][0-9]:[0-5][0-9]+:[0-6][0-9]+\\([+-][0-9:]+\\)? " ; time
+                     "[^ ]+ [^ ]+ "))                       ; author & state
+            (goto-char (match-end 0)) ; [0-6] in regexp handles leap seconds
+            (cond
+             ;; unlocked revision
+             ((looking-at "\\$")
+              (setq locking-user 'none)
+              (setq status 'rev-and-lock))
+             ;; revision is locked by some user
+             ((looking-at "\\([^ ]+\\) \\$")
+              (setq locking-user (match-string-no-properties 1))
+              (setq status 'rev-and-lock))
+             ;; everything else: false
+             (nil)))
+           ;; unexpected information in
+           ;; keyword string --> quit
+           (nil)))
+         ;; search for $Revision
+         ;; --------------------
+         ((re-search-forward (concat "\\$"
+                                     "Revision: \\([0-9.]+\\) \\$")
+                             nil t)
+          ;; if found, store the revision number ...
+          (setq version (match-string-no-properties 1))
+          ;; and see if there's any lock information
+          (goto-char (point-min))
+          (if (re-search-forward (concat "\\$" "Locker:") nil t)
+              (cond ((looking-at " \\([^ ]+\\) \\$")
+                     (setq locking-user (match-string-no-properties 1))
+                     (setq status 'rev-and-lock))
+                    ((looking-at " *\\$")
+                     (setq locking-user 'none)
+                     (setq status 'rev-and-lock))
+                    (t
+                     (setq locking-user 'none)
+                     (setq status 'rev-and-lock)))
+            (setq status 'rev)))
+         ;; else: nothing found
+         ;; -------------------
+         (t nil)))
      (if status (vc-file-setprop file 'vc-working-revision version))
      (and (eq status 'rev-and-lock)
          (vc-file-setprop file 'vc-state
index 4529180c7eeb4e3b40ebd0499e78204f443225bd..492712eea0d911c99c79c1946064f09ac432b851 100644 (file)
@@ -1942,8 +1942,7 @@ cleaning up these problems."
   (unless (get-buffer whitespace-help-buffer-name)
     (delete-other-windows)
     (let ((buffer (get-buffer-create whitespace-help-buffer-name)))
-      (save-excursion
-       (set-buffer buffer)
+      (with-current-buffer buffer
        (erase-buffer)
        (insert whitespace-help-text)
        (whitespace-insert-option-mark
index 1c77795d098365e68c9dbe6a191c5aa2bd935e9d..857d3719c5f35813ca5bd26ee342392b8304bfb7 100644 (file)
@@ -1270,8 +1270,7 @@ window."
         (setq size (+ (window-height) size)))
     (setq new-window (split-window nil size))
     (unless split-window-keep-point
-      (save-excursion
-       (set-buffer (window-buffer))
+      (with-current-buffer (window-buffer)
        (goto-char (window-start))
        (setq moved (vertical-motion (window-height)))
        (set-window-start new-window (point))
index b75d650416cc4e97ac8c020e54595565a6c4d501..b6171eba0a408a29376b6c4fd18fda44487329f4 100644 (file)
@@ -175,10 +175,10 @@ action and type we got from `x-dnd-test-function'."
   (let ((buffer (when (window-live-p window)
                  (window-buffer window)))
        (current-state (x-dnd-get-state-for-frame window)))
-    (when (or (not (equal buffer (aref current-state 0)))
-             (not (equal window (aref current-state 1)))
-             (not (equal action (aref current-state 3))))
-      (save-excursion
+    (unless (and (equal buffer (aref current-state 0))
+                 (equal window (aref current-state 1))
+                 (equal action (aref current-state 3)))
+      (save-current-buffer
        (when buffer (set-buffer buffer))
        (let* ((action-type (funcall x-dnd-test-function
                                     window