Obsolete org-switch-to-buffer-other-window and org-no-popups

* lisp/org-compat.el (org-switch-to-buffer-other-window):
(org-no-popups): Move from org-macs.el and mark obsolete.
* lisp/ob-lilypond.el (org-babel-lilypond-execute-tangled-ly):
(org-babel-lilypond-mark-error-line):
* lisp/ol.el (org-insert-link):
* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
(org-agenda-prepare-window):
(org-agenda-goto):
(org-agenda-open-link):
(org-agenda-clock-goto):
(org-agenda-diary-entry-in-org-file):
(org-agenda-add-entry-to-org-agenda-diary-file):
(org-agenda-show-the-flagging-note):
* lisp/org-attach.el (org-attach):
* lisp/org-capture.el (org-capture-place-template):
(org-capture-fill-template):
* lisp/org-clock.el (org-clock-select-task):
* lisp/org-macs.el (org-mks):
* lisp/org-src.el (org-src-switch-to-buffer):
* lisp/org-table.el (org-table-edit-field):
(org-table-edit-formulas):
(org-table-show-reference):
* lisp/org.el (org-fast-todo-selection):
(org-add-log-note):
(org-fast-tag-selection):
* lisp/ox.el (org-export-stack-view):
(org-export--dispatch-ui): Use `switch-to-buffer-other-window'.
* etc/ORG-NEWS (Org mode no longer disallows configuring
~display-buffer-alist~ to open Org popups in other frame): Document
the breaking change.

Reported-by: Jan Seeger
Link: https://orgmode.org/list/87pmr3mfq3.fsf@localhost
This commit is contained in:
Ihor Radchenko 2024-01-24 14:54:30 +01:00
parent b980f7abb8
commit 78dc58508d
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
13 changed files with 49 additions and 42 deletions

View File

@ -13,6 +13,13 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
* Version 9.7 (not released yet)
** Important announcements and breaking changes
*** Org mode no longer disallows configuring ~display-buffer-alist~ to open Org popups in other frame
Previously, Org mode disallowed pop-up frames when displaying dispatch buffers.
This is no longer the case. ~display-buffer-alist~ is fully obeyed.
~org-switch-to-buffer-other-window~ and ~org-no-popups~ are now deprecated.
*** Folded lines can now extend their face beyond ellipsis
Previously, ~:extend t~ face attribute did not make folded headlines,

View File

@ -230,7 +230,7 @@ If error in compilation, attempt to mark the error in lilypond org file."
(delete-file org-babel-lilypond-temp-file))
(rename-file org-babel-lilypond-tangled-file
org-babel-lilypond-temp-file))
(org-switch-to-buffer-other-window "*lilypond*")
(switch-to-buffer-other-window "*lilypond*")
(erase-buffer)
(org-babel-lilypond-compile-lilyfile org-babel-lilypond-temp-file)
(goto-char (point-min))
@ -280,7 +280,7 @@ FILE-NAME is full path to lilypond file."
"Mark the erroneous lines in the lilypond org buffer.
FILE-NAME is full path to lilypond file.
LINE is the erroneous line."
(org-switch-to-buffer-other-window
(switch-to-buffer-other-window
(concat (file-name-nondirectory
(org-babel-lilypond-switch-extension file-name ".org"))))
(let ((temp (point)))

View File

@ -1867,7 +1867,7 @@ non-interactively, don't allow to edit the default description."
(t
;; Read link, with completion for stored links.
(org-link--fontify-links-to-this-file)
(org-switch-to-buffer-other-window "*Org Links*")
(switch-to-buffer-other-window "*Org Links*")
(with-current-buffer "*Org Links*"
(read-only-mode 1)
(let ((inhibit-read-only t)

View File

@ -3113,7 +3113,7 @@ Agenda views are separated by `org-agenda-block-separator'."
line lines left right n n1)
(save-window-excursion
(delete-other-windows)
(org-switch-to-buffer-other-window " *Agenda Commands*")
(switch-to-buffer-other-window " *Agenda Commands*")
(erase-buffer)
(insert (eval-when-compile
(let ((header
@ -3915,7 +3915,7 @@ FILTER-ALIST is an alist of filters we need to apply when
((eq org-agenda-window-setup 'current-window)
(pop-to-buffer-same-window abuf))
((eq org-agenda-window-setup 'other-window)
(org-switch-to-buffer-other-window abuf))
(switch-to-buffer-other-window abuf))
((eq org-agenda-window-setup 'other-frame)
(switch-to-buffer-other-frame abuf))
((eq org-agenda-window-setup 'other-tab)
@ -3927,7 +3927,7 @@ FILTER-ALIST is an alist of filters we need to apply when
(pop-to-buffer-same-window abuf))
((eq org-agenda-window-setup 'reorganize-frame)
(delete-other-windows)
(org-switch-to-buffer-other-window abuf)))
(switch-to-buffer-other-window abuf)))
(setq org-agenda-tag-filter (cdr (assq 'tag filter-alist)))
(setq org-agenda-category-filter (cdr (assq 'cat filter-alist)))
(setq org-agenda-effort-filter (cdr (assq 'effort filter-alist)))
@ -9210,7 +9210,6 @@ When called with a prefix argument, include all archive files as well."
(org-agenda-error)))
(buffer (marker-buffer marker))
(pos (marker-position marker)))
;; FIXME: use `org-switch-to-buffer-other-window'?
(switch-to-buffer-other-window buffer)
(widen)
(push-mark)
@ -9465,9 +9464,8 @@ It also looks at the text of the entry itself."
(when (search-forward l nil lkend)
(goto-char (match-beginning 0))
(org-open-at-point)))
;; This is an internal link, widen the buffer
;; FIXME: use `org-switch-to-buffer-other-window'?
(switch-to-buffer-other-window buffer)
;; This is an internal link, widen the buffer
(widen)
(goto-char marker)
(when (search-forward l nil lkend)
@ -10272,7 +10270,7 @@ buffer, display it in another window."
;; If the currently clocked entry is not in the agenda
;; buffer, we visit it in another window:
((bound-and-true-p org-clock-current-task)
(org-switch-to-buffer-other-window (org-clock-goto)))
(switch-to-buffer-other-window (org-clock-goto)))
(t (message "No running clock, use `C-c C-x C-j' to jump to the most recent one")))))
(defun org-agenda-diary-entry-in-org-file ()
@ -10310,7 +10308,7 @@ buffer, display it in another window."
(org-agenda-add-entry-to-org-agenda-diary-file 'block text d1 d2)
(and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo)))
((equal char ?j)
(org-switch-to-buffer-other-window
(switch-to-buffer-other-window
(find-file-noselect org-agenda-diary-file))
(require 'org-datetree)
(org-datetree-find-date-create d1)
@ -10348,7 +10346,7 @@ If TEXT is not empty, it will become the headline of the new entry, and
the resulting entry will not be shown. When TEXT is empty, switch to
`org-agenda-diary-file' and let the user finish the entry there."
(let ((cw (current-window-configuration)))
(org-switch-to-buffer-other-window
(switch-to-buffer-other-window
(find-file-noselect org-agenda-diary-file))
(widen)
(goto-char (point-min))
@ -11044,7 +11042,7 @@ tag and (if present) the flagging note."
(unless note
(user-error "No flagging note"))
(org-kill-new note)
(org-switch-to-buffer-other-window "*Flagging Note*")
(switch-to-buffer-other-window "*Flagging Note*")
(erase-buffer)
(insert note)
(goto-char (point-min))

View File

@ -320,7 +320,7 @@ Shows a list of commands and prompts for another key to execute a command."
(save-excursion
(save-window-excursion
(unless org-attach-expert
(org-switch-to-buffer-other-window "*Org Attach*")
(switch-to-buffer-other-window "*Org Attach*")
(erase-buffer)
(setq cursor-type nil
header-line-format "Use C-v, M-v, C-n or C-p to navigate.")

View File

@ -1177,7 +1177,7 @@ may have been stored before."
(unless inhibit-wconf-store
(org-capture-put :return-to-wconf (current-window-configuration)))
(delete-other-windows)
(org-switch-to-buffer-other-window
(switch-to-buffer-other-window
(org-capture-get-indirect-buffer (org-capture-get :buffer) "CAPTURE"))
(widen)
(org-fold-show-all)
@ -1694,7 +1694,7 @@ Expansion occurs in a temporary Org mode buffer."
(message "no template") (ding)
(sit-for 1))
(save-window-excursion
(org-switch-to-buffer-other-window (get-buffer-create "*Capture*"))
(switch-to-buffer-other-window (get-buffer-create "*Capture*"))
(erase-buffer)
(setq buffer-file-name nil)
(setq mark-active nil)

View File

@ -665,7 +665,7 @@ there is no recent clock to choose from."
(if (zerop chl)
(user-error "No recent clock")
(save-window-excursion
(org-switch-to-buffer-other-window
(switch-to-buffer-other-window
(get-buffer-create "*Clock Task Select*"))
(erase-buffer)
(when (marker-buffer org-clock-default-task)

View File

@ -653,6 +653,19 @@ Counting starts at 1."
(define-obsolete-function-alias 'org--math-always-on
'org--math-p "9.7")
(defmacro org-no-popups (&rest body)
"Suppress popup windows and evaluate BODY."
`(let (pop-up-frames pop-up-windows)
,@body))
(make-obsolete 'org-no-popups "no longer used" "9.7")
(defun org-switch-to-buffer-other-window (&rest args)
"Switch to buffer in a second window on the current frame.
In particular, do not allow pop-up frames.
Returns the newly created buffer."
(org-no-popups (apply #'switch-to-buffer-other-window args)))
(make-obsolete 'org-switch-to-buffer-other-window "no longer used" "9.7")
(make-obsolete 'org-refresh-category-properties "no longer used" "9.7")
(make-obsolete 'org-refresh-effort-properties "no longer used" "9.7")

View File

@ -269,11 +269,6 @@ This function is only useful when called from Agenda buffer."
(unless modified
(restore-buffer-modified-p nil))))))))
(defmacro org-no-popups (&rest body)
"Suppress popup windows and evaluate BODY."
`(let (pop-up-frames pop-up-windows)
,@body))
(defmacro org-element-with-disabled-cache (&rest body)
"Run BODY without active org-element-cache."
(declare (debug (form body)) (indent 0))
@ -296,12 +291,6 @@ FILE is the file name passed to `find-buffer-visiting'."
(find-buffer-visiting file))))
(org-base-buffer buf)))
(defun org-switch-to-buffer-other-window (&rest args)
"Switch to buffer in a second window on the current frame.
In particular, do not allow pop-up frames.
Returns the newly created buffer."
(org-no-popups (apply #'switch-to-buffer-other-window args)))
(defun org-fit-window-to-buffer (&optional window max-height min-height
shrink-only)
"Fit WINDOW to the buffer, but only if it is not a side-by-side window.
@ -492,7 +481,7 @@ alist with (\"key\" \"description\") entries. When one of these
is selected, only the bare key is returned."
(save-window-excursion
(let ((inhibit-quit t)
(buffer (org-switch-to-buffer-other-window "*Org Select*"))
(buffer (switch-to-buffer-other-window "*Org Select*"))
(prompt (or prompt "Select: "))
case-fold-search
current)

View File

@ -1012,7 +1012,7 @@ Raise an error when current buffer is not a source editing buffer."
(`current-window (pop-to-buffer-same-window buffer))
(`other-window
(let ((cur-win (selected-window)))
(org-switch-to-buffer-other-window buffer)
(switch-to-buffer-other-window buffer)
(when (eq context 'exit) (quit-restore-window cur-win))))
(`split-window-below
(if (eq context 'exit)
@ -1036,7 +1036,7 @@ Raise an error when current buffer is not a source editing buffer."
(_ (switch-to-buffer-other-frame buffer))))
(`reorganize-frame
(when (eq context 'edit) (delete-other-windows))
(org-switch-to-buffer-other-window buffer)
(switch-to-buffer-other-window buffer)
(when (eq context 'exit) (delete-other-windows)))
(`switch-invisibly (set-buffer buffer))
(_

View File

@ -2051,7 +2051,7 @@ toggle `org-table-follow-field-mode'."
(cw (current-window-configuration))
p)
(goto-char pos)
(org-switch-to-buffer-other-window "*Org Table Edit Field*")
(switch-to-buffer-other-window "*Org Table Edit Field*")
(when (and (local-variable-p 'org-field-marker)
(markerp org-field-marker))
(move-marker org-field-marker nil))
@ -3362,7 +3362,7 @@ Parameters get priority."
(titles '((column . "# Column Formulas\n")
(field . "# Field and Range Formulas\n")
(named . "# Named Field Formulas\n"))))
(org-switch-to-buffer-other-window "*Edit Formulas*")
(switch-to-buffer-other-window "*Edit Formulas*")
(erase-buffer)
;; Keep global-font-lock-mode from turning on font-lock-mode
(let ((font-lock-global-modes '(not fundamental-mode)))
@ -4992,8 +4992,8 @@ When LOCAL is non-nil, show references for the table at point."
(if (and (markerp pos) (marker-buffer pos))
(if (get-buffer-window (marker-buffer pos))
(select-window (get-buffer-window (marker-buffer pos)))
(org-switch-to-buffer-other-window (get-buffer-window
(marker-buffer pos)))))
(switch-to-buffer-other-window (get-buffer-window
(marker-buffer pos)))))
(goto-char pos)
(org-table--force-dataline)
(let ((table-start

View File

@ -9922,7 +9922,7 @@ where CURRENT-TODO-KEYWORD belongs over on in another sequence."
(set-buffer (get-buffer-create " *Org todo*"))
(delete-other-windows)
(set-window-buffer (split-window-vertically) (get-buffer-create " *Org todo*"))
(org-switch-to-buffer-other-window " *Org todo*"))
(switch-to-buffer-other-window " *Org todo*"))
;; Fill text in *Org todo* buffer.
(erase-buffer)
;; Copy `org-done-keywords' from the original Org buffer to be
@ -10650,7 +10650,7 @@ items are State notes."
(move-marker org-log-note-return-to (point))
(pop-to-buffer-same-window (marker-buffer org-log-note-marker))
(goto-char org-log-note-marker)
(org-switch-to-buffer-other-window "*Org Note*")
(switch-to-buffer-other-window "*Org Note*")
(erase-buffer)
(if (memq org-log-note-how '(time state))
(org-store-log-note)
@ -12072,7 +12072,7 @@ Returns the new tags string, or nil to not change the current settings."
(set-buffer (get-buffer-create " *Org tags*"))
(delete-other-windows)
(set-window-buffer (split-window-vertically) (get-buffer-create " *Org tags*"))
(org-switch-to-buffer-other-window " *Org tags*"))
(switch-to-buffer-other-window " *Org tags*"))
;; Fill text in *Org tags* buffer.
(erase-buffer)
(setq-local org-done-keywords done-keywords)
@ -12216,7 +12216,7 @@ Returns the new tags string, or nil to not change the current settings."
(setq expert-interface nil)
(delete-other-windows)
(set-window-buffer (split-window-vertically) " *Org tags*")
(org-switch-to-buffer-other-window " *Org tags*")
(switch-to-buffer-other-window " *Org tags*")
(org-fit-window-to-buffer)))
;; Quit.
((or ?\C-g

View File

@ -6907,8 +6907,8 @@ within Emacs."
(interactive "P")
(let ((source (org-export--stack-source-at-point)))
(cond ((processp source)
(org-switch-to-buffer-other-window (process-buffer source)))
((bufferp source) (org-switch-to-buffer-other-window source))
(switch-to-buffer-other-window (process-buffer source)))
((bufferp source) (switch-to-buffer-other-window source))
(t (org-open-file source in-emacs)))))
(defvar org-export-stack-mode-map
@ -7252,7 +7252,7 @@ back to standard interface."
;; At first call, create frame layout in order to display menu.
(unless (get-buffer "*Org Export Dispatcher*")
(delete-other-windows)
(org-switch-to-buffer-other-window
(switch-to-buffer-other-window
(get-buffer-create "*Org Export Dispatcher*"))
(setq cursor-type nil)
(setq header-line-format