lang/org: fix mode restart in buried agenda buffers
Would formerly only apply when persp-mode was active, but this has nothing to do with persp-mode, specifically.
This commit is contained in:
parent
ff18b1329e
commit
d6fb7d8ac6
1 changed files with 19 additions and 18 deletions
|
@ -573,24 +573,25 @@ eldoc string."
|
||||||
|
|
||||||
(add-hook! 'org-agenda-finalize-hook
|
(add-hook! 'org-agenda-finalize-hook
|
||||||
(defun +org-exclude-agenda-buffers-from-workspace-h ()
|
(defun +org-exclude-agenda-buffers-from-workspace-h ()
|
||||||
"Prevent temporarily-opened agenda buffers from being associated with the
|
"Prevent temporary agenda buffers being associated with current
|
||||||
current workspace (and clean them up)."
|
workspace."
|
||||||
(when (and org-agenda-new-buffers (bound-and-true-p persp-mode))
|
(when (and org-agenda-new-buffers
|
||||||
(unless org-agenda-sticky
|
(bound-and-true-p persp-mode)
|
||||||
(let (persp-autokill-buffer-on-remove)
|
(not org-agenda-sticky))
|
||||||
(persp-remove-buffer org-agenda-new-buffers
|
(let (persp-autokill-buffer-on-remove)
|
||||||
(get-current-persp)
|
(persp-remove-buffer org-agenda-new-buffers
|
||||||
nil)))
|
(get-current-persp)
|
||||||
(dolist (buffer org-agenda-new-buffers)
|
nil))))
|
||||||
(with-current-buffer buffer
|
(defun +org-defer-mode-in-agenda-buffers-h ()
|
||||||
;; HACK Org agenda opens temporary agenda incomplete org-mode
|
"Org agenda opens temporary agenda incomplete org-mode buffers.
|
||||||
;; buffers. These are great for extracting agenda information
|
These are great for extracting agenda information from, but what if the user
|
||||||
;; from, but what if the user tries to visit one of these
|
tries to visit one of these buffers? Then we remove it from the to-be-cleaned
|
||||||
;; buffers? Then we remove it from the to-be-cleaned queue and
|
queue and restart `org-mode' so they can grow up to be full-fledged org-mode
|
||||||
;; restart `org-mode' so they can grow up to be full-fledged
|
buffers."
|
||||||
;; org-mode buffers.
|
(dolist (buffer org-agenda-new-buffers)
|
||||||
(add-hook 'doom-switch-buffer-hook #'+org--restart-mode-h
|
(with-current-buffer buffer
|
||||||
nil 'local))))))
|
(add-hook 'doom-switch-buffer-hook #'+org--restart-mode-h
|
||||||
|
nil 'local)))))
|
||||||
|
|
||||||
(defadvice! +org--exclude-agenda-buffers-from-recentf-a (orig-fn file)
|
(defadvice! +org--exclude-agenda-buffers-from-recentf-a (orig-fn file)
|
||||||
"Prevent temporarily opened agenda buffers from polluting recentf."
|
"Prevent temporarily opened agenda buffers from polluting recentf."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue