mirror of
https://github.com/pestctrl/emacs-config.git
synced 2026-02-16 08:14:15 +00:00
Aha, I fixed the bug I was encountered
The delete-window case never worked, because deleting a window changes the current buffer, which prevents #'org-capture-put from working properly.
This commit is contained in:
parent
27e8ddfd3e
commit
11cb27d934
1 changed files with 12 additions and 10 deletions
|
|
@ -42,16 +42,18 @@
|
|||
|
||||
(defun my/org-capture-finalize-shouldnt-mess-windows (&rest args)
|
||||
(save-window-excursion
|
||||
;; This basically means that we don't change window configurations when
|
||||
;; there are previous buffers to be seen. IDK if this will have unintended
|
||||
;; consequences, because...
|
||||
(if (zerop (length (window-prev-buffers)))
|
||||
(delete-window)
|
||||
(previous-buffer))
|
||||
;; current-window-configuration will encode a buffer that's about to be
|
||||
;; deleted. I tested it, and it does what I want, so maybe there's no
|
||||
;; problem?
|
||||
(org-capture-put :return-to-wconf (current-window-configuration))))
|
||||
(let ((buffer (current-buffer)))
|
||||
;; This basically means that we don't change window configurations when
|
||||
;; there are previous buffers to be seen. IDK if this will have unintended
|
||||
;; consequences, because...
|
||||
(if (zerop (length (window-prev-buffers)))
|
||||
(delete-window)
|
||||
(previous-buffer))
|
||||
;; current-window-configuration will encode a buffer that's about to be
|
||||
;; deleted. I tested it, and it does what I want, so maybe there's no
|
||||
;; problem?
|
||||
(with-current-buffer buffer
|
||||
(org-capture-put :return-to-wconf (current-window-configuration))))))
|
||||
|
||||
(advice-add #'org-capture-finalize
|
||||
:before
|
||||
|
|
|
|||
Loading…
Reference in a new issue