fix capture window sizing

This commit is contained in:
petrucci4prez 2018-05-19 17:39:36 -04:00
parent eb784761fc
commit 1186d5d7cb
2 changed files with 42 additions and 1 deletions

17
conf.el
View File

@ -320,6 +320,23 @@ event of an error or nonlocal exit."
(advice-add #'org-fast-tag-selection :around #'nd/org-tag-window-advice) (advice-add #'org-fast-tag-selection :around #'nd/org-tag-window-advice)
(defun nd/org-capture-position (buffer alist)
(let ((new (split-window (get-buffer-window) -14 'below)))
(set-window-buffer new buffer)
new))
(defun nd/org-capture-window-advice (orig-fn table title &optional prompt specials)
"Advice to fix window placement in `org-capture-select-template'."
(let ((override '("\\*Org Select\\*" nd/org-capture-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 table title prompt specials)
(setq display-buffer-alist
(delete override display-buffer-alist))))))
(advice-add #'org-mks :around #'nd/org-capture-window-advice)
(setq org-src-window-setup 'current-window) (setq org-src-window-setup 'current-window)
(setq org-src-fontify-natively t) (setq org-src-fontify-natively t)
(setq org-edit-src-content-indentation 0) (setq org-edit-src-content-indentation 0)

View File

@ -430,6 +430,10 @@ The fonts in org headings bug me, make them smaller and less invasive
#+END_SRC #+END_SRC
*** window splitting *** window splitting
Org mode is great and all, but the windows never show up in the right place Org mode is great and all, but the windows never show up in the right place
The solutions here are simple, but have the downside that the window sizing
must be changed when tags/capture templates/todo items are changed.
This is because the buffer size is not known at window creation time
and I didn't feel like making a function to predict it
**** todo selection **** todo selection
I only need a teeny tiny window below my current window for todo selection I only need a teeny tiny window below my current window for todo selection
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -471,6 +475,26 @@ By default, the tag selection window obliterates all but the current window...ho
(advice-add #'org-fast-tag-selection :around #'nd/org-tag-window-advice) (advice-add #'org-fast-tag-selection :around #'nd/org-tag-window-advice)
#+END_SRC #+END_SRC
**** capture
Capture should show up in the bottom of any currently active buffer
#+BEGIN_SRC emacs-lisp
(defun nd/org-capture-position (buffer alist)
(let ((new (split-window (get-buffer-window) -14 'below)))
(set-window-buffer new buffer)
new))
(defun nd/org-capture-window-advice (orig-fn table title &optional prompt specials)
"Advice to fix window placement in `org-capture-select-template'."
(let ((override '("\\*Org Select\\*" nd/org-capture-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 table title prompt specials)
(setq display-buffer-alist
(delete override display-buffer-alist))))))
(advice-add #'org-mks :around #'nd/org-capture-window-advice)
#+END_SRC
** src ** src
*** basic *** basic
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -1335,7 +1359,7 @@ the agenda does not do this by default...it's annoying
(set-face-attribute 'org-column nil :background "#1e2023") (set-face-attribute 'org-column nil :background "#1e2023")
;; org-columns-summary-types ;; org-columns-summary-types
#+END_SRC #+END_SRC
** interactive functions ** interactive commands
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun nd/mark-subtree-keyword (new-keyword &optional exclude) (defun nd/mark-subtree-keyword (new-keyword &optional exclude)
"marks all tasks in a subtree with keyword unless original keyword "marks all tasks in a subtree with keyword unless original keyword