From 334157d7410dfe13ec6b9cba0f16d526c07d6f85 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 9 Aug 2024 15:51:14 -0400 Subject: [PATCH] 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). --- modules/lang/org/config.el | 3 ++- modules/ui/popup/+hacks.el | 21 ++------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 13b0b504a..cf03dc42b 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -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") diff --git a/modules/ui/popup/+hacks.el b/modules/ui/popup/+hacks.el index ab3e70275..f2c35ab9b 100644 --- a/modules/ui/popup/+hacks.el +++ b/modules/ui/popup/+hacks.el @@ -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)))