From 78dc58508ddbf97b6f44c0a6dd222eab3d13b50a Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Wed, 24 Jan 2024 14:54:30 +0100 Subject: [PATCH] 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 --- etc/ORG-NEWS | 7 +++++++ lisp/ob-lilypond.el | 4 ++-- lisp/ol.el | 2 +- lisp/org-agenda.el | 18 ++++++++---------- lisp/org-attach.el | 2 +- lisp/org-capture.el | 4 ++-- lisp/org-clock.el | 2 +- lisp/org-compat.el | 13 +++++++++++++ lisp/org-macs.el | 13 +------------ lisp/org-src.el | 4 ++-- lisp/org-table.el | 8 ++++---- lisp/org.el | 8 ++++---- lisp/ox.el | 6 +++--- 13 files changed, 49 insertions(+), 42 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index f537486d4..50c3a90a1 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -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, diff --git a/lisp/ob-lilypond.el b/lisp/ob-lilypond.el index 46e78bdce..7791fe201 100644 --- a/lisp/ob-lilypond.el +++ b/lisp/ob-lilypond.el @@ -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))) diff --git a/lisp/ol.el b/lisp/ol.el index eddd84207..cba451d1c 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -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) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 02be114fe..20da364b5 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -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)) diff --git a/lisp/org-attach.el b/lisp/org-attach.el index 58bfcf9ba..d5e5ac06d 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -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.") diff --git a/lisp/org-capture.el b/lisp/org-capture.el index a254357df..92ee9d13d 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -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) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 7298ebb65..c34c385fd 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -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) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 17f07db9d..e16d0cf04 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -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") diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 8a90af701..f14323d23 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -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) diff --git a/lisp/org-src.el b/lisp/org-src.el index 612a79c5d..7a4d2e4ce 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -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)) (_ diff --git a/lisp/org-table.el b/lisp/org-table.el index 514b275fc..0b0d8547f 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -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 diff --git a/lisp/org.el b/lisp/org.el index 7e6d432c4..796545392 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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 diff --git a/lisp/ox.el b/lisp/ox.el index 491d7a0d0..744977b80 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -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