From 662dc19b9e005cef360a1404e11a4071b938ed6c Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 16 Aug 2020 12:53:54 -0400 Subject: [PATCH] FIX 27.1 todo option window sizing change --- etc/conf.org | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/etc/conf.org b/etc/conf.org index 16af4ce..26334e6 100644 --- a/etc/conf.org +++ b/etc/conf.org @@ -1628,27 +1628,14 @@ Org mode is great and all, but the windows never show up in the right place. The :END: I only need a teeny tiny window below my current window for todo selection #+BEGIN_SRC emacs-lisp -(defun nd/org-todo-position (buffer alist) - (let ((win (car (cl-delete-if-not - (lambda (window) - (with-current-buffer (window-buffer window) - (memq major-mode - '(org-mode org-agenda-mode)))) - (window-list))))) - (when win - (let ((new (split-window win -4 'below))) - (set-window-buffer new buffer) - new)))) - -(defun nd/org-todo-window-advice (orig-fn) +(defun nd/org-todo-window-advice (orig-fn &rest args) "Advice to fix window placement in `org-fast-todo-selection'." (let ((override '("\\*Org todo\\*" nd/org-todo-position))) - (add-to-list 'display-buffer-alist override) (nd/with-advice - ((#'org-switch-to-buffer-other-window :override #'pop-to-buffer)) - (unwind-protect (funcall orig-fn) - (setq display-buffer-alist - (delete override display-buffer-alist)))))) + ((#'delete-other-windows :override #'ignore) + (#'split-window-vertically :filter-args (-partial (-const '(-4)))) + (#'org-switch-to-buffer-other-window :override #'pop-to-buffer)) + (unwind-protect (apply orig-fn args))))) (advice-add #'org-fast-todo-selection :around #'nd/org-todo-window-advice) #+END_SRC