]> code.delx.au - gnu-emacs/commitdiff
Fix some uses of switch-to-buffer.
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 5 Jul 2011 15:31:22 +0000 (11:31 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 5 Jul 2011 15:31:22 +0000 (11:31 -0400)
* lisp/progmodes/compile.el (compilation-goto-locus):
* lisp/net/tramp-cmds.el (tramp-append-tramp-buffers):
* lisp/bs.el (bs-cycle-next, bs-cycle-previous):
* lisp/bookmark.el (bookmark-bmenu-list, bookmark-bmenu-2-window):
* lisp/bindings.el (mode-line-other-buffer):
* lisp/autoinsert.el (auto-insert):
* lisp/arc-mode.el (archive-extract):
* lisp/abbrev.el (edit-abbrevs): Fix some uses of switch-to-buffer.

lisp/ChangeLog
lisp/abbrev.el
lisp/arc-mode.el
lisp/autoinsert.el
lisp/bindings.el
lisp/bookmark.el
lisp/bs.el
lisp/net/tramp-cmds.el
lisp/progmodes/compile.el

index e83b65fe4e512cb06d3d97aee443d4b1332c2b13..1a6c66e2bdfabf8976ae173abe35f473482dcc48 100644 (file)
@@ -1,3 +1,14 @@
+2011-07-05  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/compile.el (compilation-goto-locus):
+       * net/tramp-cmds.el (tramp-append-tramp-buffers):
+       * bs.el (bs-cycle-next, bs-cycle-previous):
+       * bookmark.el (bookmark-bmenu-list, bookmark-bmenu-2-window):
+       * bindings.el (mode-line-other-buffer):
+       * autoinsert.el (auto-insert):
+       * arc-mode.el (archive-extract):
+       * abbrev.el (edit-abbrevs): Fix some uses of switch-to-buffer.
+
 2011-07-05  Juanma Barranquero  <lekktu@gmail.com>
 
        * emacs-lock.el (emacs-lock-mode): Fix typo in variable name.
@@ -64,8 +75,8 @@
        according to whether there are or aren't any plain-text topics
        pending encryption.
 
-       (allout-inhibit-auto-save-info-for-decryption): Adjust
-       buffer-saved-size and some allout state to inhibit auto-saves if
+       (allout-inhibit-auto-save-info-for-decryption):
+       Adjust buffer-saved-size and some allout state to inhibit auto-saves if
        there are plain-text topics pending encryption.
 
        (allout-maybe-resume-auto-save-info-after-encryption): Adjust
index 9445cf9675c2e371a86df7e58ef32168d717b5b1..2122f43bbad7e01771fe19a064984975d4a0d307 100644 (file)
@@ -159,7 +159,7 @@ where NAME and EXPANSION are strings with quotes,
 USECOUNT is an integer, and HOOK is any valid function
 or may be omitted (it is usually omitted)."
   (interactive)
-  (switch-to-buffer (prepare-abbrev-list-buffer)))
+  (pop-to-buffer-same-window (prepare-abbrev-list-buffer)))
 
 (defun edit-abbrevs-redefine ()
   "Redefine abbrevs according to current buffer contents."
index e0a587c7607f4f1a4673771408b09fee122d8ae6..70f43aebaff6302eea151508eb0a15e032837981 100644 (file)
@@ -1083,7 +1083,7 @@ using `make-temp-file', and the generated name is returned."
            (view-buffer buffer (and just-created 'kill-buffer-if-not-modified)))
            ((eq other-window-p 'display) (display-buffer buffer))
            (other-window-p (switch-to-buffer-other-window buffer))
-           (t (switch-to-buffer buffer))))))
+           (t (pop-to-buffer-same-window buffer))))))
 
 (defun archive-*-extract (archive name command)
   (let* ((default-directory (file-name-as-directory archive-tmpdir))
index 5793c3180be7bcc0148020411be140272a340a4c..3b849cece22f8f7fb0f318d3e006e75491dfcef8 100644 (file)
@@ -360,7 +360,7 @@ Matches the visited file name against the elements of `auto-insert-alist'."
                   (save-window-excursion
                     ;; make buffer visible before skeleton or function
                     ;; which might ask the user for something
-                    (switch-to-buffer (current-buffer))
+                    (pop-to-buffer-same-window (current-buffer))
                     (if (and (consp action)
                              (not (eq (car action) 'lambda)))
                         (skeleton-insert action)
index 383223dc0d7b1c22197cbab18d556c40b7a29b3d..2f03560852891c39f7a3041c0d3b0a6b0e1305b9 100644 (file)
@@ -471,7 +471,8 @@ Like `bury-buffer', but temporarily select EVENT's window."
 (defun mode-line-other-buffer () "\
 Switch to the most recently selected buffer other than the current one."
   (interactive)
-  (switch-to-buffer (other-buffer)))
+  (with-no-warnings ; We really do want to call `switch-to-buffer' here.
+    (switch-to-buffer (other-buffer))))
 
 (defun mode-line-next-buffer (event)
   "Like `next-buffer', but temporarily select EVENT's window."
index 184cecb9e9cd0d850f07fdf3fa4446d2b39186f0..9f90ecedc4d48cd1c7c0f90de38321789f31b7ef 100644 (file)
@@ -1539,9 +1539,7 @@ deletion, or > if it is flagged for displaying."
   (bookmark-maybe-load-default-file)
   (let ((buf (get-buffer-create "*Bookmark List*")))
     (if (called-interactively-p 'interactive)
-        (if (or (window-dedicated-p) (window-minibuffer-p))
-            (pop-to-buffer buf)
-          (switch-to-buffer buf))
+        (pop-to-buffer-same-window buf)
       (set-buffer buf)))
   (let ((inhibit-read-only t))
     (erase-buffer)
@@ -1843,7 +1841,8 @@ With a prefix arg, prompts for a file to save them in."
         (menu (current-buffer))
         (pop-up-windows t))
     (delete-other-windows)
-    (switch-to-buffer (other-buffer))
+    (with-no-warnings ; We really do want to call `switch-to-buffer' here.
+      (switch-to-buffer (other-buffer)))
     (bookmark--jump-via bmrk 'pop-to-buffer)
     (bury-buffer menu)))
 
index 94fbd0e04f946d499621abca18853e442c7813ca..c7326eedd266c77842a9ce426334f60fb251e165 100644 (file)
@@ -1215,7 +1215,8 @@ by buffer configuration `bs-cycle-configuration-name'."
         ;; We don't want the frame iconified if the only window in the frame
         ;; happens to be dedicated.
         (bury-buffer (current-buffer))
-       (switch-to-buffer next)
+        (with-no-warnings ; We really do want to call `switch-to-buffer' here.
+          (switch-to-buffer next))
        (setq bs--cycle-list (append (cdr cycle-list)
                                     (list (car cycle-list))))
        (bs-message-without-log "Next buffers: %s"
@@ -1244,7 +1245,8 @@ by buffer configuration `bs-cycle-configuration-name'."
                                            bs--cycle-list)))
             (prev-buffer (car tupel))
             (cycle-list (cdr tupel)))
-       (switch-to-buffer prev-buffer)
+        (with-no-warnings ; We really do want to call `switch-to-buffer' here.
+          (switch-to-buffer prev-buffer))
        (setq bs--cycle-list (append (last cycle-list)
                                     (reverse (cdr (reverse cycle-list)))))
        (bs-message-without-log "Previous buffers: %s"
index fcf523a706859161cabfb1b42ed3ddb4db9923e9..307ce5368ced4cf3cd12ee5af5228873c3e65eed 100644 (file)
@@ -308,7 +308,7 @@ buffer in your bug report.
 
       ;; There is at least one Tramp buffer.
       (when buffer-list
-       (switch-to-buffer (list-buffers-noselect nil))
+       (pop-to-buffer-same-window (list-buffers-noselect nil))
        (delete-other-windows)
        (setq buffer-read-only nil)
        (goto-char (point-min))
@@ -343,7 +343,7 @@ the debug buffer(s).")
            ;; OK, let's send.  First we delete the buffer list.
            (progn
              (kill-buffer nil)
-             (switch-to-buffer curbuf)
+             (pop-to-buffer-same-window curbuf)
              (goto-char (point-max))
              (insert "\n\
 This is a special notion of the `gnus/message' package.  If you
index 0b9390af6c974c4ba0c269ee1e347fe0a25fface..3a9463f0f97c1f63ecf3ab219b43e249e1f23aa0 100644 (file)
@@ -2410,9 +2410,7 @@ and overlay is highlighted between MK and END-MK."
         ;; display the source in another window.
         (let ((pop-up-windows t))
           (pop-to-buffer (marker-buffer mk) 'other-window))
-      (if (window-dedicated-p (selected-window))
-          (pop-to-buffer (marker-buffer mk))
-        (switch-to-buffer (marker-buffer mk))))
+      (pop-to-buffer-same-window (marker-buffer mk)))
     (unless (eq (goto-char mk) (point))
       ;; If narrowing gets in the way of going to the right place, widen.
       (widen)