fix(popup,org): popup management for org-mode

Adapts to changes made upstream to Org's window management logic (e.g.
Org dropped `org-switch-to-buffer-other-window` for
`switch-to-buffer-other-window`, and org-journal renamed one of its
helper functions).
This commit is contained in:
Henrik Lissner 2024-08-09 15:51:14 -04:00
parent b3bea23331
commit 334157d741
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
2 changed files with 4 additions and 20 deletions

View file

@ -1059,7 +1059,8 @@ between the two."
'(("^\\*Org Links" :slot -1 :vslot -1 :size 2 :ttl 0)
("^ ?\\*\\(?:Agenda Com\\|Calendar\\|Org Export Dispatcher\\)"
:slot -1 :vslot -1 :size #'+popup-shrink-to-fit :ttl 0)
("^\\*Org \\(?:Select\\|Attach\\)" :slot -1 :vslot -2 :ttl 0 :size 0.25)
("^\\*Org \\(?:Select\\|Attach\\|Table Edit\\)" :slot -1 :vslot -2 :ttl 0 :size 0.25)
("^\\*Edit Formulas\\*$" :slot -1 :vslot -2 :ttl 0 :size 0.25)
("^\\*Org Agenda" :ignore t)
("^\\*Org Src" :size 0.42 :quit nil :select t :autosave t :modeline t :ttl nil)
("^\\*Org-Babel")

View file

@ -50,14 +50,6 @@ to this commmand."
(+popup/close nil 'force))))
(global-set-key [remap quit-window] #'+popup/quit-window)
(defadvice! +popup-override-display-buffer-alist-a (fn &rest args)
"When `pop-to-buffer' is called with non-nil ACTION, that ACTION should
override `display-buffer-alist'."
:around #'switch-to-buffer-other-tab
:around #'switch-to-buffer-other-window
:around #'switch-to-buffer-other-frame
(let ((display-buffer-alist nil))
(apply fn args)))
;;
@ -295,20 +287,11 @@ Ugh, such an ugly hack."
(popup-p (+popup-window-p window)))
(prog1 (apply fn args)
(when (and popup-p (window-live-p window))
(delete-window window)))))
;; Ensure todo, agenda, and other minor popups are delegated to the popup system.
(defadvice! +popup--org-pop-to-buffer-a (fn buf &optional norecord)
"Use `pop-to-buffer' instead of `switch-to-buffer' to open buffer.'"
:around #'org-switch-to-buffer-other-window
(if +popup-mode
(pop-to-buffer buf nil norecord)
(funcall fn buf norecord))))
(delete-window window))))))
;;;###package org-journal
(defadvice! +popup--use-popup-window-a (fn &rest args)
:around #'org-journal-search-by-string
:around #'org-journal--search-by-string
(letf! ((#'switch-to-buffer #'pop-to-buffer))
(apply fn args)))