emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105877: Reintroduce pop-to-buffer-sa


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105877: Reintroduce pop-to-buffer-same-window; use it for previous users of same-window-*.
Date: Thu, 22 Sep 2011 12:15:52 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105877
fixes bug(s): http://debbugs.gnu.org/9532
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Thu 2011-09-22 12:15:52 -0400
message:
  Reintroduce pop-to-buffer-same-window; use it for previous users of 
same-window-*.
  
  * window.el (pop-to-buffer-same-window): New (reinstated) fun.
  
  * cmuscheme.el (run-scheme, switch-to-scheme):
  * cus-edit.el (customize-group, custom-buffer-create)
  (customize-browse):
  * info.el (info):
  * shell.el (shell):
  * mail/sendmail.el (mail):
  * progmodes/inf-lisp.el (inferior-lisp): Use it.
modified:
  lisp/ChangeLog
  lisp/cmuscheme.el
  lisp/cus-edit.el
  lisp/info.el
  lisp/mail/sendmail.el
  lisp/progmodes/inf-lisp.el
  lisp/shell.el
  lisp/window.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-09-22 13:34:02 +0000
+++ b/lisp/ChangeLog    2011-09-22 16:15:52 +0000
@@ -1,3 +1,15 @@
+2011-09-22  Chong Yidong  <address@hidden>
+
+       * window.el (pop-to-buffer-same-window): New (reinstated) fun.
+
+       * cmuscheme.el (run-scheme, switch-to-scheme):
+       * cus-edit.el (customize-group, custom-buffer-create)
+       (customize-browse):
+       * info.el (info):
+       * shell.el (shell):
+       * mail/sendmail.el (mail):
+       * progmodes/inf-lisp.el (inferior-lisp): Use it (Bug#9532).
+
 2011-09-22  Richard Stallman  <address@hidden>
 
        * textmodes/paragraphs.el (forward-sentence): When setting PAR-BEG,

=== modified file 'lisp/cmuscheme.el'
--- a/lisp/cmuscheme.el 2011-09-11 18:30:07 +0000
+++ b/lisp/cmuscheme.el 2011-09-22 16:15:52 +0000
@@ -246,7 +246,7 @@
        (inferior-scheme-mode)))
   (setq scheme-program-name cmd)
   (setq scheme-buffer "*scheme*")
-  (switch-to-buffer "*scheme*"))
+  (pop-to-buffer-same-window "*scheme*"))
 
 (defun scheme-start-file (prog)
   "Return the name of the start file corresponding to PROG.
@@ -371,7 +371,7 @@
   (interactive "P")
   (if (or (and scheme-buffer (get-buffer scheme-buffer))
           (scheme-interactively-start-process))
-      (switch-to-buffer scheme-buffer)
+      (pop-to-buffer-same-window scheme-buffer)
     (error "No current process buffer.  See variable `scheme-buffer'"))
   (when eob-p
     (push-mark)

=== modified file 'lisp/cus-edit.el'
--- a/lisp/cus-edit.el  2011-09-11 18:30:07 +0000
+++ b/lisp/cus-edit.el  2011-09-22 16:15:52 +0000
@@ -1111,15 +1111,19 @@
       (setq group (intern group))))
   (let ((name (format "*Customize Group: %s*"
                      (custom-unlispify-tag-name group))))
-    (if (get-buffer name)
-        (switch-to-buffer name other-window)
+    (cond
+     ((null (get-buffer name))
       (funcall (if other-window
                   'custom-buffer-create-other-window
                 'custom-buffer-create)
               (list (list group 'custom-group))
               name
               (concat " for group "
-                      (custom-unlispify-tag-name group))))))
+                      (custom-unlispify-tag-name group))))
+     (other-window
+      (switch-to-buffer-other-window name))
+     (t
+      (pop-to-buffer-same-window name)))))
 
 ;;;###autoload
 (defun customize-group-other-window (&optional group)
@@ -1533,7 +1537,7 @@
 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
 SYMBOL is a customization option, and WIDGET is a widget for editing
 that option."
-  (switch-to-buffer (custom-get-fresh-buffer (or name "*Customization*")))
+  (pop-to-buffer-same-window (custom-get-fresh-buffer (or name 
"*Customization*")))
   (custom-buffer-create-internal options description))
 
 ;;;###autoload
@@ -1721,7 +1725,7 @@
   (unless group
     (setq group 'emacs))
   (let ((name "*Customize Browser*"))
-    (switch-to-buffer (custom-get-fresh-buffer name)))
+    (pop-to-buffer-same-window (custom-get-fresh-buffer name)))
   (Custom-mode)
   (widget-insert (format "\
 %s buttons; type RET or click mouse-1

=== modified file 'lisp/info.el'
--- a/lisp/info.el      2011-09-20 20:16:42 +0000
+++ b/lisp/info.el      2011-09-22 16:15:52 +0000
@@ -649,7 +649,8 @@
                     (read-file-name "Info file name: " nil nil t))
                 (if (numberp current-prefix-arg)
                     (format "*info*<%s>" current-prefix-arg))))
-  (info-setup file-or-node (switch-to-buffer (or buffer "*info*"))))
+  (info-setup file-or-node
+             (pop-to-buffer-same-window (or buffer "*info*"))))
 
 (defun info-setup (file-or-node buffer)
   "Display Info node FILE-OR-NODE in BUFFER."

=== modified file 'lisp/mail/sendmail.el'
--- a/lisp/mail/sendmail.el     2011-09-11 18:30:07 +0000
+++ b/lisp/mail/sendmail.el     2011-09-22 16:15:52 +0000
@@ -1785,11 +1785,11 @@
  This is how Rmail arranges to mark messages `answered'."
   (interactive "P")
   (if (eq noerase 'new)
-      (switch-to-buffer (generate-new-buffer "*mail*"))
+      (pop-to-buffer-same-window (generate-new-buffer "*mail*"))
     (and noerase
         (not (get-buffer "*mail*"))
         (setq noerase nil))
-    (switch-to-buffer "*mail*"))
+    (pop-to-buffer-same-window "*mail*"))
 
   ;; Avoid danger that the auto-save file can't be written.
   (let ((dir (expand-file-name

=== modified file 'lisp/progmodes/inf-lisp.el'
--- a/lisp/progmodes/inf-lisp.el        2011-09-11 18:30:07 +0000
+++ b/lisp/progmodes/inf-lisp.el        2011-09-22 16:15:52 +0000
@@ -297,7 +297,7 @@
                           "inferior-lisp" (car cmdlist) nil (cdr cmdlist)))
        (inferior-lisp-mode)))
   (setq inferior-lisp-buffer "*inferior-lisp*")
-  (switch-to-buffer "*inferior-lisp*"))
+  (pop-to-buffer-same-window "*inferior-lisp*"))
 
 ;;;###autoload
 (defalias 'run-lisp 'inferior-lisp)

=== modified file 'lisp/shell.el'
--- a/lisp/shell.el     2011-09-11 18:30:07 +0000
+++ b/lisp/shell.el     2011-09-22 16:15:52 +0000
@@ -652,7 +652,7 @@
 
   ;; The buffer's window must be correctly set when we call comint (so
   ;; that comint sets the COLUMNS env var properly).
-  (switch-to-buffer buffer)
+  (pop-to-buffer-same-window buffer)
   (unless (comint-check-proc buffer)
     (let* ((prog (or explicit-shell-file-name
                     (getenv "ESHELL") shell-file-name))

=== modified file 'lisp/window.el'
--- a/lisp/window.el    2011-09-22 09:28:57 +0000
+++ b/lisp/window.el    2011-09-22 16:15:52 +0000
@@ -4861,6 +4861,28 @@
       (select-frame-set-input-focus frame norecord))
     buffer))
 
+(defun pop-to-buffer-same-window (buffer &optional norecord)
+  "Select buffer BUFFER in some window, preferably the same one.
+This function behaves much like `switch-to-buffer', except it
+displays with `special-display-function' if BUFFER has a match in
+`special-display-buffer-names' or `special-display-regexps'.
+
+Unlike `pop-to-buffer', this function prefers using the selected
+window over popping up a new window or frame.
+
+BUFFER may be a buffer, a string (a buffer name), or nil.  If it
+is a string not naming an existent buffer, create a buffer with
+that name.  If BUFFER is nil, choose some other buffer.  Return
+the buffer.
+
+NORECORD, if non-nil means do not put this buffer at the front of
+the list of recently selected ones."
+  (pop-to-buffer buffer
+                '((display-buffer--special
+                   display-buffer-same-window)
+                  (inhibit-same-window . nil))
+                norecord))
+
 (defun read-buffer-to-switch (prompt)
   "Read the name of a buffer to switch to, prompting with PROMPT.
 Return the neame of the buffer as a string.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]