浏览代码

agenda: Call finalize-hook later

* lisp/org-agenda.el (org-agenda-finalize): Call the hooks after the
save-excursion.

This opens the way for hooks to position the cursor after agenda
generation.
Marco Wahl 4 年之前
父节点
当前提交
cc570144f8
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      lisp/org-agenda.el

+ 4 - 4
lisp/org-agenda.el

@@ -3858,8 +3858,8 @@ This function is called just before displaying the agenda.  If
 you want to add your own functions to the finalization of the
 you want to add your own functions to the finalization of the
 agenda display, configure `org-agenda-finalize-hook'."
 agenda display, configure `org-agenda-finalize-hook'."
   (unless org-agenda-multi
   (unless org-agenda-multi
-    (save-excursion
-      (let ((inhibit-read-only t))
+    (let ((inhibit-read-only t))
+      (save-excursion
 	(goto-char (point-min))
 	(goto-char (point-min))
 	(save-excursion
 	(save-excursion
 	  (while (org-activate-links (point-max))
 	  (while (org-activate-links (point-max))
@@ -3927,8 +3927,8 @@ agenda display, configure `org-agenda-finalize-hook'."
 	(when (get 'org-agenda-effort-filter :preset-filter)
 	(when (get 'org-agenda-effort-filter :preset-filter)
 	  (org-agenda-filter-apply
 	  (org-agenda-filter-apply
 	   (get 'org-agenda-effort-filter :preset-filter) 'effort))
 	   (get 'org-agenda-effort-filter :preset-filter) 'effort))
-	(add-hook 'kill-buffer-hook 'org-agenda-reset-markers 'append 'local)
-	(run-hooks 'org-agenda-finalize-hook)))))
+	(add-hook 'kill-buffer-hook 'org-agenda-reset-markers 'append 'local))
+      (run-hooks 'org-agenda-finalize-hook))))
 
 
 (defun org-agenda-mark-clocking-task ()
 (defun org-agenda-mark-clocking-task ()
   "Mark the current clock entry in the agenda if it is present."
   "Mark the current clock entry in the agenda if it is present."