Try a bit harder to avoid recentering after agenda buffer redo

New try: temporarily nullify `recenter`, seems to work so far and keeps point on
the same line.
This commit is contained in:
Daniel - 2023-11-18 14:18:41 +01:00
parent 2407f4196f
commit 712a314923
Signed by: dbo
GPG Key ID: 784AA8DF0CCDF625
1 changed files with 9 additions and 6 deletions

15
init.el
View File

@ -1071,12 +1071,15 @@
(add-hook 'org-agenda-finalize-hook #'db/org-agenda-insert-active-filters)
(add-hook 'org-agenda-filter-hook #'org-agenda-redo-all)
(define-advice org-agenda-redo-all (:around (old-func &rest r) goto-top-and-execute)
"Avoid recentering the Org agenda buffer after redo by moving
point to the beginning of buffer first."
(save-mark-and-excursion
(goto-char (point-min))
(apply old-func r)))))
(define-advice org-agenda-redo (:around
(actual-agenda-redo &rest r)
inhibit-recentering)
"Try to avoid recentering the window when redoing the Org agenda buffer."
(let ((old-recenter (symbol-function 'recenter)))
(fset 'recenter 'identity)
(unwind-protect
(apply actual-agenda-redo r)
(fset 'recenter old-recenter))))))
;; Capturing