diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2011-09-02 12:38:40 -0400 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2011-09-02 12:38:40 -0400 |
commit | c33134511b466d746312becbc0e4ef59bb9258ac (patch) | |
tree | 17693629f53ccd288c4c13cdd9f2a65ed5a1941a | |
parent | 81ec0c88f2f27c090c5928f78a9c6afb8c1b2f72 (diff) | |
download | emacs-c33134511b466d746312becbc0e4ef59bb9258ac.tar.gz |
Remove pop-to-buffer-same-window.
* lisp/window.el (pop-to-buffer-1, pop-to-buffer-same-window): Deleted.
(pop-to-buffer): Change interactive spec. Pass second argument
directly to display-buffer.
(display-buffer): Fix interactive spec. Use functionp to
distinguish between a function and a list of functions.
* lisp/abbrev.el (edit-abbrevs):
* lisp/arc-mode.el (archive-extract):
* lisp/autoinsert.el (auto-insert):
* lisp/bookmark.el (bookmark-bmenu-list):
* lisp/files.el (find-file):
* lisp/view.el (view-buffer):
* lisp/progmodes/compile.el (compilation-goto-locus):
* lisp/textmodes/bibtex.el (bibtex-initialize): Use switch-to-buffer.
* lisp/org/ob-ref.el (org-babel-ref-goto-headline-id):
* lisp/org/org.el (org-get-location, org-tree-to-indirect-buffer)
(org-mark-ring-goto, org-refile, org-add-log-note)
(org-revert-all-org-buffers, org-switchb)
(org-cycle-agenda-files, org-submit-bug-report)
(org-goto-marker-or-bmk):
* lisp/org/org-agenda.el (org-prepare-agenda, org-agenda-switch-to):
* lisp/org/org-capture.el (org-capture-goto-target)
(org-capture-fill-template):
* lisp/org/org-clock.el (org-clock-goto):
* lisp/org/org-ctags.el (org-ctags-visit-buffer-or-file):
* lisp/org/org-exp.el (org-export-as-org):
* lisp/org/org-feed.el (org-feed-show-raw-feed):
* lisp/org/org-html.el (org-export-htmlize-generate-css):
* lisp/org/org-id.el (org-id-goto):
* lisp/org/org-irc.el (org-irc-visit-erc):
* lisp/org/org-mobile.el (org-mobile-apply):
* lisp/org/org-publish.el (org-publish-org-to, org-publish-find-date):
* lisp/org/org-remember.el (org-go-to-remember-target):
* lisp/org/org-src.el (org-src-switch-to-buffer)
(org-edit-fixed-width-region): Use switch-to-buffer.
* lisp/org/org-compat.el (org-pop-to-buffer-same-window): Deleted.
-rw-r--r-- | lisp/ChangeLog | 17 | ||||
-rw-r--r-- | lisp/abbrev.el | 2 | ||||
-rw-r--r-- | lisp/arc-mode.el | 2 | ||||
-rw-r--r-- | lisp/autoinsert.el | 2 | ||||
-rw-r--r-- | lisp/bookmark.el | 2 | ||||
-rw-r--r-- | lisp/files.el | 4 | ||||
-rw-r--r-- | lisp/org/ChangeLog | 26 | ||||
-rw-r--r-- | lisp/org/ob-ref.el | 4 | ||||
-rw-r--r-- | lisp/org/org-agenda.el | 8 | ||||
-rw-r--r-- | lisp/org/org-capture.el | 6 | ||||
-rw-r--r-- | lisp/org/org-clock.el | 3 | ||||
-rw-r--r-- | lisp/org/org-compat.el | 9 | ||||
-rw-r--r-- | lisp/org/org-ctags.el | 4 | ||||
-rw-r--r-- | lisp/org/org-exp.el | 4 | ||||
-rw-r--r-- | lisp/org/org-feed.el | 2 | ||||
-rw-r--r-- | lisp/org/org-html.el | 4 | ||||
-rw-r--r-- | lisp/org/org-id.el | 4 | ||||
-rw-r--r-- | lisp/org/org-irc.el | 8 | ||||
-rw-r--r-- | lisp/org/org-mobile.el | 5 | ||||
-rw-r--r-- | lisp/org/org-publish.el | 6 | ||||
-rw-r--r-- | lisp/org/org-remember.el | 4 | ||||
-rw-r--r-- | lisp/org/org-src.el | 12 | ||||
-rw-r--r-- | lisp/org/org.el | 25 | ||||
-rw-r--r-- | lisp/progmodes/compile.el | 2 | ||||
-rw-r--r-- | lisp/textmodes/bibtex.el | 2 | ||||
-rw-r--r-- | lisp/view.el | 2 | ||||
-rw-r--r-- | lisp/window.el | 97 |
27 files changed, 123 insertions, 143 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7ea1dffe1c2..ea320e51e1c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,22 @@ 2011-09-02 Chong Yidong <cyd@stupidchicken.com> + * window.el (pop-to-buffer-1, pop-to-buffer-same-window): Deleted. + (pop-to-buffer): Change interactive spec. Pass second argument + directly to display-buffer. + (display-buffer): Fix interactive spec. Use functionp to + distinguish between a function and a list of functions. + + * abbrev.el (edit-abbrevs): + * arc-mode.el (archive-extract): + * autoinsert.el (auto-insert): + * bookmark.el (bookmark-bmenu-list): + * files.el (find-file): + * view.el (view-buffer): + * progmodes/compile.el (compilation-goto-locus): + * textmodes/bibtex.el (bibtex-initialize): Use switch-to-buffer. + +2011-09-02 Chong Yidong <cyd@stupidchicken.com> + * window.el (display-buffer-alist): Doc fix. (display-buffer): Add docstring. Don't treat display-buffer-default specially. diff --git a/lisp/abbrev.el b/lisp/abbrev.el index 3795dd46010..5a7a741a3a6 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el @@ -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) - (pop-to-buffer-same-window (prepare-abbrev-list-buffer))) + (switch-to-buffer (prepare-abbrev-list-buffer))) (defun edit-abbrevs-redefine () "Redefine abbrevs according to current buffer contents." diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index ea875b9989d..e3d1955ded5 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -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 (pop-to-buffer-same-window buffer)))))) + (t (switch-to-buffer buffer)))))) (defun archive-*-extract (archive name command) (let* ((default-directory (file-name-as-directory archive-tmpdir)) diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el index 3b849cece22..5793c3180be 100644 --- a/lisp/autoinsert.el +++ b/lisp/autoinsert.el @@ -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 - (pop-to-buffer-same-window (current-buffer)) + (switch-to-buffer (current-buffer)) (if (and (consp action) (not (eq (car action) 'lambda))) (skeleton-insert action) diff --git a/lisp/bookmark.el b/lisp/bookmark.el index bb7ad153e8b..51e869e3a21 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -1539,7 +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) - (pop-to-buffer-same-window buf) + (switch-to-buffer buf) (set-buffer buf))) (let ((inhibit-read-only t)) (erase-buffer) diff --git a/lisp/files.el b/lisp/files.el index 07188e152b3..5bdb26f4e92 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1342,8 +1342,8 @@ automatically choosing a major mode, use \\[find-file-literally]." (confirm-nonexistent-file-or-buffer))) (let ((value (find-file-noselect filename nil nil wildcards))) (if (listp value) - (mapcar #'pop-to-buffer-same-window (nreverse value)) - (pop-to-buffer-same-window value)))) + (mapcar 'switch-to-buffer (nreverse value)) + (switch-to-buffer value)))) (defun find-file-other-window (filename &optional wildcards) "Edit file FILENAME, in another window. diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index 625e0926c52..d63929d794e 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog @@ -1,3 +1,29 @@ +2011-09-02 Chong Yidong <cyd@stupidchicken.com> + + * org-compat.el (org-pop-to-buffer-same-window): Deleted. + + * ob-ref.el (org-babel-ref-goto-headline-id): + * org.el (org-get-location, org-tree-to-indirect-buffer) + (org-mark-ring-goto, org-refile, org-add-log-note) + (org-revert-all-org-buffers, org-switchb) + (org-cycle-agenda-files, org-submit-bug-report) + (org-goto-marker-or-bmk): + * org-agenda.el (org-prepare-agenda, org-agenda-switch-to): + * org-capture.el (org-capture-goto-target) + (org-capture-fill-template): + * org-clock.el (org-clock-goto): + * org-ctags.el (org-ctags-visit-buffer-or-file): + * org-exp.el (org-export-as-org): + * org-feed.el (org-feed-show-raw-feed): + * org-html.el (org-export-htmlize-generate-css): + * org-id.el (org-id-goto): + * org-irc.el (org-irc-visit-erc): + * org-mobile.el (org-mobile-apply): + * org-publish.el (org-publish-org-to, org-publish-find-date): + * org-remember.el (org-go-to-remember-target): + * org-src.el (org-src-switch-to-buffer) + (org-edit-fixed-width-region): Use switch-to-buffer. + 2011-08-31 Martin Rudalics <rudalics@gmx.at> * org-compat.el (org-pop-to-buffer-same-window): Remove LABEL diff --git a/lisp/org/ob-ref.el b/lisp/org/ob-ref.el index b27bd20db40..d0a2c14bee9 100644 --- a/lisp/org/ob-ref.el +++ b/lisp/org/ob-ref.el @@ -61,8 +61,6 @@ (declare-function org-narrow-to-subtree "org" ()) (declare-function org-id-find-id-in-file "org-id" (id file &optional markerp)) (declare-function org-show-context "org" (&optional key)) -(declare-function org-pop-to-buffer-same-window - "org-compat" (&optional buffer-or-name norecord label)) (defvar org-babel-ref-split-regexp "[ \f\t\n\r\v]*\\(.+?\\)[ \f\t\n\r\v]*=[ \f\t\n\r\v]*\\(.+\\)[ \f\t\n\r\v]*") @@ -96,7 +94,7 @@ the variable." (m (when file (org-id-find-id-in-file id file 'marker)))) (when (and file m) (message "file:%S" file) - (org-pop-to-buffer-same-window (marker-buffer m)) + (switch-to-buffer (marker-buffer m)) (goto-char m) (move-marker m nil) (org-show-context) diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 9f23c4011d1..aea284fe72c 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -60,8 +60,6 @@ (declare-function org-is-habit-p "org-habit" (&optional pom)) (declare-function org-habit-parse-todo "org-habit" (&optional pom)) (declare-function org-habit-get-priority "org-habit" (habit &optional moment)) -(declare-function org-pop-to-buffer-same-window "org-compat" - (&optional buffer-or-name norecord label)) (defvar calendar-mode-map) (defvar org-clock-current-task) ; defined in org-clock.el @@ -3067,7 +3065,7 @@ the global options and expect it to be applied to the entire view.") (awin (select-window awin)) ((not (setq org-pre-agenda-window-conf (current-window-configuration)))) ((equal org-agenda-window-setup 'current-window) - (org-pop-to-buffer-same-window abuf)) + (switch-to-buffer abuf)) ((equal org-agenda-window-setup 'other-window) (org-switch-to-buffer-other-window abuf)) ((equal org-agenda-window-setup 'other-frame) @@ -3078,7 +3076,7 @@ the global options and expect it to be applied to the entire view.") ;; additional test in case agenda is invoked from within agenda ;; buffer via elisp link (unless (equal (current-buffer) abuf) - (org-pop-to-buffer-same-window abuf))) + (switch-to-buffer abuf))) (setq buffer-read-only nil) (let ((inhibit-read-only t)) (erase-buffer)) (org-agenda-mode) @@ -6972,7 +6970,7 @@ at the text of the entry itself." (org-agenda-error))) (buffer (marker-buffer marker)) (pos (marker-position marker))) - (org-pop-to-buffer-same-window buffer) + (switch-to-buffer buffer) (and delete-other-windows (delete-other-windows)) (widen) (goto-char pos) diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el index 133460b49ec..05cca0e311e 100644 --- a/lisp/org/org-capture.el +++ b/lisp/org/org-capture.el @@ -57,8 +57,6 @@ (date &optional keep-restriction)) (declare-function org-table-get-specials "org-table" ()) (declare-function org-table-goto-line "org-table" (N)) -(declare-function org-pop-to-buffer-same-window "org-compat" - (&optional buffer-or-name norecord label)) (defvar org-remember-default-headline) (defvar org-remember-templates) @@ -1201,7 +1199,7 @@ The user is queried for the template." (error "No capture template selected")) (org-capture-set-plist entry) (org-capture-set-target-location) - (org-pop-to-buffer-same-window (org-capture-get :buffer)) + (switch-to-buffer (org-capture-get :buffer)) (goto-char (org-capture-get :pos)))) (defun org-capture-get-indirect-buffer (&optional buffer prefix) @@ -1311,7 +1309,7 @@ The template may still contain \"%?\" for cursor positioning." (sit-for 1)) (save-window-excursion (delete-other-windows) - (org-pop-to-buffer-same-window (get-buffer-create "*Capture*")) + (switch-to-buffer (get-buffer-create "*Capture*")) (erase-buffer) (insert template) (goto-char (point-min)) diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 4cf26e359f1..de5087e163c 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -36,7 +36,6 @@ (declare-function calendar-absolute-from-iso "cal-iso" (&optional date)) (declare-function notifications-notify "notifications" (&rest params)) -(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label)) (defvar org-time-stamp-formats) (defvar org-ts-what) @@ -1498,7 +1497,7 @@ With prefix arg SELECT, offer recently clocked tasks for selection." (setq recent t) (car org-clock-history)) (t (error "No active or recent clock task"))))) - (org-pop-to-buffer-same-window (marker-buffer m)) + (switch-to-buffer (marker-buffer m)) (if (or (< m (point-min)) (> m (point-max))) (widen)) (goto-char m) (org-show-entry) diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index 9b0a935a515..896acc5aeae 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el @@ -432,15 +432,6 @@ With two arguments, return floor and remainder of their quotient." (let ((q (floor x y))) (list q (- x (if y (* y q) q))))) -;; `pop-to-buffer-same-window' has been introduced with Emacs 24.1. -(defun org-pop-to-buffer-same-window - (&optional buffer-or-name norecord label) - "Pop to buffer specified by BUFFER-OR-NAME in the selected window." - (if (fboundp 'pop-to-buffer-same-window) - (funcall - 'pop-to-buffer-same-window buffer-or-name norecord) - (funcall 'switch-to-buffer buffer-or-name norecord))) - (provide 'org-compat) diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el index 9ba5024d58b..48eced9ea08 100644 --- a/lisp/org/org-ctags.el +++ b/lisp/org/org-ctags.el @@ -140,8 +140,6 @@ (require 'org) -(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label)) - (defgroup org-ctags nil "Options concerning use of ctags within org mode." :tag "Org-Ctags" @@ -387,7 +385,7 @@ the new file." (cond ((get-buffer (concat name ".org")) ;; Buffer is already open - (org-pop-to-buffer-same-window (get-buffer (concat name ".org")))) + (switch-to-buffer (get-buffer (concat name ".org")))) ((file-exists-p filename) ;; File exists but is not open --> open it (message "Opening existing org file `%S'..." diff --git a/lisp/org/org-exp.el b/lisp/org/org-exp.el index 59459b0d578..ee8e6027706 100644 --- a/lisp/org/org-exp.el +++ b/lisp/org/org-exp.el @@ -47,8 +47,6 @@ (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) (declare-function org-table-cookie-line-p "org-table" (line)) (declare-function org-table-colgroup-line-p "org-table" (line)) -(declare-function org-pop-to-buffer-same-window "org-compat" - (&optional buffer-or-name norecord label)) (autoload 'org-export-generic "org-export-generic" "Export using the generic exporter" t) @@ -2974,7 +2972,7 @@ directory." (region (buffer-string)) str-ret) (save-excursion - (org-pop-to-buffer-same-window buffer) + (switch-to-buffer buffer) (erase-buffer) (insert region) (let ((org-inhibit-startup t)) (org-mode)) diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el index a07ecc619e5..d1b31f11b4a 100644 --- a/lisp/org/org-feed.el +++ b/lisp/org/org-feed.el @@ -436,7 +436,7 @@ it can be a list structured like an entry in `org-feed-alist'." (if (stringp feed) (setq feed (assoc feed org-feed-alist))) (unless feed (error "No such feed in `org-feed-alist")) - (org-pop-to-buffer-same-window + (switch-to-buffer (org-feed-update feed 'retrieve-only)) (goto-char (point-min))) diff --git a/lisp/org/org-html.el b/lisp/org/org-html.el index 54f6cb44dab..46126ce2573 100644 --- a/lisp/org/org-html.el +++ b/lisp/org/org-html.el @@ -34,8 +34,6 @@ (declare-function org-id-find-id-file "org-id" (id)) (declare-function htmlize-region "ext:htmlize" (beg end)) -(declare-function org-pop-to-buffer-same-window - "org-compat" (&optional buffer-or-name norecord label)) (defgroup org-export-html nil "Options specific for HTML export of Org-mode files." @@ -2265,7 +2263,7 @@ that uses these same face definitions." (when (and (symbolp f) (or (not i) (not (listp i)))) (insert (org-add-props (copy-sequence "1") nil 'face f)))) (htmlize-region (point-min) (point-max)))) - (org-pop-to-buffer-same-window "*html*") + (switch-to-buffer "*html*") (goto-char (point-min)) (if (re-search-forward "<style" nil t) (delete-region (point-min) (match-beginning 0))) diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el index c840d5aeb75..c2d5cf0f25b 100644 --- a/lisp/org/org-id.el +++ b/lisp/org/org-id.el @@ -74,8 +74,6 @@ (require 'org) (declare-function message-make-fqdn "message" ()) -(declare-function org-pop-to-buffer-same-window - "org-compat" (&optional buffer-or-name norecord label)) ;;; Customization @@ -255,7 +253,7 @@ Move the cursor to that entry in that buffer." (let ((m (org-id-find id 'marker))) (unless m (error "Cannot find entry with ID \"%s\"" id)) - (org-pop-to-buffer-same-window (marker-buffer m)) + (switch-to-buffer (marker-buffer m)) (goto-char m) (move-marker m nil) (org-show-context))) diff --git a/lisp/org/org-irc.el b/lisp/org/org-irc.el index c604858b28c..7a84d2053ad 100644 --- a/lisp/org/org-irc.el +++ b/lisp/org/org-irc.el @@ -60,8 +60,6 @@ (declare-function erc-server-buffer "erc" ()) (declare-function erc-get-server-nickname-list "erc" ()) (declare-function erc-cmd-JOIN "erc" (channel &optional key)) -(declare-function org-pop-to-buffer-same-window - "org-compat" (&optional buffer-or-name norecord label)) (defvar org-irc-client 'erc "The IRC client to act on.") @@ -234,7 +232,7 @@ default." (throw 'found x)))))) (if chan-buf (progn - (org-pop-to-buffer-same-window chan-buf) + (switch-to-buffer chan-buf) ;; if we got a nick, and they're in the chan, ;; then start a chat with them (let ((nick (pop link))) @@ -245,9 +243,9 @@ default." (insert (concat nick ": "))) (error "%s not found in %s" nick chan-name))))) (progn - (org-pop-to-buffer-same-window server-buffer) + (switch-to-buffer server-buffer) (erc-cmd-JOIN chan-name)))) - (org-pop-to-buffer-same-window server-buffer))) + (switch-to-buffer server-buffer))) ;; no server match, make new connection (erc-select :server server :port port)))) diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el index df01ee44f7d..f270419877e 100644 --- a/lisp/org/org-mobile.el +++ b/lisp/org/org-mobile.el @@ -38,9 +38,6 @@ (eval-when-compile (require 'cl)) -(declare-function org-pop-to-buffer-same-window - "org-compat" (&optional buffer-or-name norecord label)) - (defgroup org-mobile nil "Options concerning support for a viewer/editor on a mobile device." :tag "Org Mobile" @@ -912,7 +909,7 @@ If BEG and END are given, only do this in that region." (buffer-file-name (current-buffer)))))) (error (setq org-mobile-error msg)))) (when org-mobile-error - (org-pop-to-buffer-same-window (marker-buffer marker)) + (switch-to-buffer (marker-buffer marker)) (goto-char marker) (incf cnt-error) (insert (if (stringp (nth 1 org-mobile-error)) diff --git a/lisp/org/org-publish.el b/lisp/org/org-publish.el index 05f82c154e5..ddb3cf7b63a 100644 --- a/lisp/org/org-publish.el +++ b/lisp/org/org-publish.el @@ -369,8 +369,6 @@ This is a compatibility function for Emacsen without `delete-dups'." (declare-function org-publish-delete-dups "org-publish" (list)) (declare-function find-lisp-find-files "find-lisp" (directory regexp)) -(declare-function org-pop-to-buffer-same-window - "org-compat" (&optional buffer-or-name norecord label)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Getting project information out of org-publish-project-alist @@ -561,7 +559,7 @@ PUB-DIR is the publishing directory." (make-directory pub-dir t)) (let ((visiting (find-buffer-visiting filename))) (save-excursion - (org-pop-to-buffer-same-window (or visiting (find-file filename))) + (switch-to-buffer (or visiting (find-file filename))) (let* ((plist (cons :buffer-will-be-killed (cons t plist))) (init-buf (current-buffer)) (init-point (point)) @@ -862,7 +860,7 @@ system's modification time. It returns time in `current-time' format." (let ((visiting (find-buffer-visiting file))) (save-excursion - (org-pop-to-buffer-same-window (or visiting (find-file-noselect file nil t))) + (switch-to-buffer (or visiting (find-file-noselect file nil t))) (let* ((plist (org-infile-export-plist)) (date (plist-get plist :date))) (unless visiting diff --git a/lisp/org/org-remember.el b/lisp/org/org-remember.el index 0eb4f899e14..2bc5ef92ae7 100644 --- a/lisp/org/org-remember.el +++ b/lisp/org/org-remember.el @@ -40,8 +40,6 @@ (declare-function remember "remember" (&optional initial)) (declare-function remember-buffer-desc "remember" ()) (declare-function remember-finalize "remember" ()) -(declare-function org-pop-to-buffer-same-window - "org-compat" (&optional buffer-or-name norecord label)) (defvar remember-save-after-remembering) (defvar remember-register) @@ -788,7 +786,7 @@ The user is queried for the template." (setq heading org-remember-default-headline)) (setq visiting (org-find-base-buffer-visiting file)) (if (not visiting) (find-file-noselect file)) - (org-pop-to-buffer-same-window (or visiting (get-file-buffer file))) + (switch-to-buffer (or visiting (get-file-buffer file))) (widen) (goto-char (point-min)) (if (re-search-forward diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index dd56b120219..5de55fa455f 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -42,8 +42,6 @@ (declare-function org-at-table.el-p "org" ()) (declare-function org-get-indentation "org" (&optional line)) (declare-function org-switch-to-buffer-other-window "org" (&rest args)) -(declare-function org-pop-to-buffer-same-window - "org-compat" (&optional buffer-or-name norecord label)) (defcustom org-edit-src-region-extra nil "Additional regexps to identify regions for editing with `org-edit-src-code'. @@ -341,7 +339,7 @@ buffer." (defun org-src-switch-to-buffer (buffer context) (case org-src-window-setup ('current-window - (org-pop-to-buffer-same-window buffer)) + (switch-to-buffer buffer)) ('other-window (switch-to-buffer-other-window buffer)) ('other-frame @@ -352,7 +350,7 @@ buffer." (delete-frame frame))) ('save (kill-buffer (current-buffer)) - (org-pop-to-buffer-same-window buffer)) + (switch-to-buffer buffer)) (t (switch-to-buffer-other-frame buffer)))) ('reorganize-frame @@ -364,7 +362,7 @@ buffer." (t (message "Invalid value %s for org-src-window-setup" (symbol-name org-src-window-setup)) - (org-pop-to-buffer-same-window buffer)))) + (switch-to-buffer buffer)))) (defun org-src-construct-edit-buffer-name (org-buffer-name lang) "Construct the buffer name for a source editing buffer." @@ -424,7 +422,7 @@ the fragment in the Org-mode buffer." begline (save-excursion (goto-char beg) (org-current-line))) (if (and (setq buffer (org-edit-src-find-buffer beg end)) (y-or-n-p "Return to existing edit buffer? [n] will revert changes: ")) - (org-pop-to-buffer-same-window buffer) + (switch-to-buffer buffer) (when buffer (with-current-buffer buffer (if (boundp 'org-edit-src-overlay) @@ -444,7 +442,7 @@ the fragment in the Org-mode buffer." (define-key map [mouse-1] 'org-edit-src-continue) map)) (overlay-put ovl :read-only "Leave me alone") - (org-pop-to-buffer-same-window buffer) + (switch-to-buffer buffer) (insert code) (remove-text-properties (point-min) (point-max) '(display nil invisible nil intangible nil)) diff --git a/lisp/org/org.el b/lisp/org/org.el index 341525537bb..d494bdb28fa 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -105,7 +105,6 @@ (declare-function org-inlinetask-at-task-p "org-inlinetask" ()) (declare-function org-inlinetask-outline-regexp "org-inlinetask" ()) (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ()) -(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label)) (declare-function org-at-clock-log-p "org-clock" ()) (declare-function org-clock-timestamps-up "org-clock" ()) (declare-function org-clock-timestamps-down "org-clock" ()) @@ -6651,7 +6650,7 @@ or nil." (save-window-excursion (delete-other-windows) (and (get-buffer "*org-goto*") (kill-buffer "*org-goto*")) - (org-pop-to-buffer-same-window + (switch-to-buffer (condition-case nil (make-indirect-buffer (current-buffer) "*org-goto*") (error (make-indirect-buffer (current-buffer) "*org-goto*")))) @@ -6789,7 +6788,7 @@ frame is not changed." (and arg (eq org-indirect-buffer-display 'dedicated-frame))) (select-frame (make-frame)) (delete-other-windows) - (org-pop-to-buffer-same-window ibuf) + (switch-to-buffer ibuf) (org-set-frame-title heading)) ((eq org-indirect-buffer-display 'dedicated-frame) (raise-frame @@ -6798,10 +6797,10 @@ frame is not changed." org-indirect-dedicated-frame) (setq org-indirect-dedicated-frame (make-frame))))) (delete-other-windows) - (org-pop-to-buffer-same-window ibuf) + (switch-to-buffer ibuf) (org-set-frame-title (concat "Indirect: " heading))) ((eq org-indirect-buffer-display 'current-window) - (org-pop-to-buffer-same-window ibuf)) + (switch-to-buffer ibuf)) ((eq org-indirect-buffer-display 'other-window) (pop-to-buffer ibuf)) (t (error "Invalid value"))) @@ -9833,7 +9832,7 @@ onto the ring." (setq p org-mark-ring)) (setq org-mark-ring-last-goto p) (setq m (car p)) - (org-pop-to-buffer-same-window (marker-buffer m)) + (switch-to-buffer (marker-buffer m)) (goto-char m) (if (or (outline-invisible-p) (org-invisible-p2)) (org-show-context 'mark-goto)))) @@ -10429,7 +10428,7 @@ prefix argument (`C-u C-u C-u C-c C-w')." (find-file-noselect file))) (if goto (progn - (org-pop-to-buffer-same-window nbuf) + (switch-to-buffer nbuf) (goto-char pos) (org-show-context 'org-goto)) (if regionp @@ -12041,7 +12040,7 @@ EXTRA is additional text that will be inserted into the notes buffer." (setq org-log-note-window-configuration (current-window-configuration)) (delete-other-windows) (move-marker org-log-note-return-to (point)) - (org-pop-to-buffer-same-window (marker-buffer org-log-note-marker)) + (switch-to-buffer (marker-buffer org-log-note-marker)) (goto-char org-log-note-marker) (org-switch-to-buffer-other-window "*Org Note*") (erase-buffer) @@ -15883,7 +15882,7 @@ changes from another. I believe the procedure must be like this: (lambda (b) (when (and (with-current-buffer b (org-mode-p)) (with-current-buffer b buffer-file-name)) - (org-pop-to-buffer-same-window b) + (switch-to-buffer b) (revert-buffer t 'no-confirm))) (buffer-list)) (when (and (featurep 'org-id) org-id-track-globally) @@ -15907,7 +15906,7 @@ Set `org-completion-use-ido' to make it use ido instead." (org-completion-use-ido org-completion-use-ido)) (unless (or org-completion-use-ido org-completion-use-iswitchb) (setq org-completion-use-iswitchb t)) - (org-pop-to-buffer-same-window + (switch-to-buffer (org-icompleting-read "Org buffer: " (mapcar 'list (mapcar 'buffer-name blist)) nil t)))) @@ -16074,7 +16073,7 @@ If the current buffer does not, find the first agenda file." (find-file (car files)) (throw 'exit t)))) (find-file (car fs))) - (if (buffer-base-buffer) (org-pop-to-buffer-same-window (buffer-base-buffer))))) + (if (buffer-base-buffer) (switch-to-buffer (buffer-base-buffer))))) (defun org-agenda-file-to-front (&optional to-end) "Move/add the current file to the top of the agenda file list. @@ -18511,7 +18510,7 @@ information about your Org-mode version and configuration." (org-version) (let (list) (save-window-excursion - (org-pop-to-buffer-same-window (get-buffer-create "*Warn about privacy*")) + (switch-to-buffer (get-buffer-create "*Warn about privacy*")) (delete-other-windows) (erase-buffer) (insert "You are about to submit a bug report to the Org-mode mailing list. @@ -18708,7 +18707,7 @@ With prefix arg UNCOMPILED, load the uncompiled versions." (if (and marker (marker-buffer marker) (buffer-live-p (marker-buffer marker))) (progn - (org-pop-to-buffer-same-window (marker-buffer marker)) + (switch-to-buffer (marker-buffer marker)) (if (or (> marker (point-max)) (< marker (point-min))) (widen)) (goto-char marker) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 79fec080d57..5f99cfe0028 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -2413,7 +2413,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)) - (pop-to-buffer-same-window (marker-buffer mk))) + (switch-to-buffer (marker-buffer mk))) (unless (eq (goto-char mk) (point)) ;; If narrowing gets in the way of going to the right place, widen. (widen) diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index a660bdb6488..0383251523f 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -3060,7 +3060,7 @@ When called interactively, FORCE is t, CURRENT is t if current buffer uses ;; select BibTeX buffer (if select (if buffer-list - (pop-to-buffer-same-window + (switch-to-buffer (completing-read "Switch to BibTeX buffer: " (mapcar 'buffer-name buffer-list) nil t diff --git a/lisp/view.el b/lisp/view.el index 96fecd9df1c..11cbc79449f 100644 --- a/lisp/view.el +++ b/lisp/view.el @@ -318,7 +318,7 @@ EXIT-ACTION to `kill-buffer-if-not-modified' avoids this." (progn (switch-to-buffer buffer) (message "Not using View mode because the major mode is special")) - (pop-to-buffer-same-window buffer) + (switch-to-buffer buffer) (view-mode-enter nil exit-action))) ;;;###autoload diff --git a/lisp/window.el b/lisp/window.el index 8bdf4131c51..d078fbec35d 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4584,7 +4584,8 @@ frame (actually the last non-minibuffer frame), except if case check all visible or iconified frames. Otherwise, FRAME can be a specific frame, `visible' (all visible frames), 0 (all frames on the current terminal), or t (all frames)." - (interactive "BDisplay buffer:\nP") + (interactive (list (read-buffer "Display buffer: " (other-buffer)) + (if current-prefix-arg t))) (let ((buffer (window-normalize-buffer-to-display buffer-or-name)) ;; Handle the old form of the first argument. (inhibit-same-window (and action (not (listp action))))) @@ -4609,7 +4610,7 @@ frames on the current terminal), or t (all frames)." (functions (apply 'append (mapcar (lambda (x) (setq x (car x)) - (if (listp x) x (list x))) + (if (functionp x) (list x) x)) actions))) (alist (apply 'append (mapcar 'cdr actions))) window) @@ -4822,70 +4823,42 @@ return the window. If no suitable window is found, return nil." ;;; Display + selection commands: -(defun pop-to-buffer (buffer-or-name &optional other-window norecord) - "Select buffer BUFFER-OR-NAME in some window, preferably a different one. -BUFFER-OR-NAME may be a buffer, a string \(a buffer name), or -nil. If BUFFER-OR-NAME is a string not naming an existent -buffer, create a buffer with that name. If BUFFER-OR-NAME is -nil, choose some other buffer. - -If `pop-up-windows' is non-nil, windows can be split to display -the buffer. If optional second arg OTHER-WINDOW is non-nil, -insist on finding another window even if the specified buffer is -already visible in the selected window, and ignore -`same-window-regexps' and `same-window-buffer-names'. - -If the window to show BUFFER-OR-NAME is not on the selected +(defun pop-to-buffer (buffer &optional action norecord) + "Select buffer BUFFER in some window, preferably a different one. +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. + +This uses `display-buffer' as a subroutine. The optional ACTION +argument is passed to `display-buffer' as its ACTION argument. +See `display-buffer' for more information. ACTION is t if called +interactively with a prefix argument, which means to pop to a +window other than the selected one even if the buffer is already +displayed in the selected window. + +If the window to show BUFFER is not on the selected frame, raise that window's frame and give it input focus. -This function returns the buffer it switched to. This uses the -function `display-buffer' as a subroutine; see the documentation -of `display-buffer' for additional customization information. - Optional third arg NORECORD non-nil means do not put this buffer at the front of the list of recently selected ones." - (interactive "BPop to buffer:\nP") - (pop-to-buffer-1 buffer-or-name (if other-window t nil) norecord)) - -(defun pop-to-buffer-same-window (&optional buffer-or-name norecord) - "Pop to buffer specified by BUFFER-OR-NAME in the selected window. -Another window will be used only if the buffer can't be shown in -the selected window, usually because it is dedicated to another -buffer. Optional arguments BUFFER-OR-NAME and NORECORD are as -for `pop-to-buffer'." - (interactive "BPop to buffer in selected window:\nP") - (pop-to-buffer-1 buffer-or-name 'same-window norecord)) - -(defun pop-to-buffer-1 (buffer-or-name window-choice norecord) - (set-buffer (window-normalize-buffer-to-display - ;; BUFFER-OR-NAME nil means another buffer. - (or buffer-or-name - (other-buffer (current-buffer))))) - (let ((old-window (selected-window)) - (old-frame (selected-frame)) - (same-window-buffer-names same-window-buffer-names) - (same-window-regexps same-window-regexps)) - (if (eq window-choice t) - (setq same-window-buffer-names nil - same-window-regexps nil)) - (let* ((action - ;; Based on the WINDOW-CHOICE argument, choose an action - ;; argument to pass to `display-buffer'. - (cond - ((eq window-choice 'same-window) - '((display-buffer-reuse-selected-window - display-buffer-same-window))) - (window-choice - '(nil (inhibit-same-window . t))))) - (window (display-buffer (current-buffer) action)) - (frame (window-frame window))) - (if (eq frame old-frame) - ;; Make sure new window gets selected (Bug#8615), (Bug#6954). - (select-window window norecord) - ;; If `display-buffer' has chosen another frame, make sure it - ;; gets input focus. - (select-frame-set-input-focus frame norecord)) - (current-buffer)))) + (interactive (list (read-buffer "Pop to buffer: " (other-buffer)) + (if current-prefix-arg t))) + (setq buffer (window-normalize-buffer-to-display + ;; BUFFER nil means another buffer. + (or buffer (other-buffer)))) + (set-buffer buffer) + (let* ((old-window (selected-window)) + (old-frame (selected-frame)) + (window (display-buffer (current-buffer) action)) + (frame (window-frame window))) + (if (eq frame old-frame) + ;; Make sure new window is selected (Bug#8615), (Bug#6954). + (select-window window norecord) + ;; If `display-buffer' has chosen another frame, make sure it + ;; gets input focus. + (select-frame-set-input-focus frame norecord)) + buffer)) (defun read-buffer-to-switch (prompt) "Read the name of a buffer to switch to, prompting with PROMPT. |