unofficial mirror of emacs-orgmode@gnu.org
 help / color / Atom feed
* [rfc] Call agenda finalize hook a little bit later
@ 2020-06-30 11:15 Marco Wahl
  2020-07-05 21:24 ` Marco Wahl
  0 siblings, 1 reply; 2+ messages in thread
From: Marco Wahl @ 2020-06-30 11:15 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

Hello,

What do you think about calling the agenda finalize hook a little bit
later so that the cursor position can be changed?

E.g. this would allow to hook in a function that attempts to move point
to the current clock.

Find a proposition for a patch for master below.


Thanks for reading,
-- 
Marco

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-agenda-Call-finalize-hook-later.patch --]
[-- Type: text/x-diff, Size: 1605 bytes --]

From 37f2e1519915a0476bb4d15328473541236d4890 Mon Sep 17 00:00:00 2001
From: Marco Wahl <marcowahlsoft@gmail.com>
Date: Tue, 30 Jun 2020 13:02:19 +0200
Subject: [PATCH] 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.
---
 lisp/org-agenda.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 9fbeb2a1e..90129b23e 100644
--- a/lisp/org-agenda.el
+++ b/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
 agenda display, configure `org-agenda-finalize-hook'."
   (unless org-agenda-multi
-    (save-excursion
-      (let ((inhibit-read-only t))
+    (let ((inhibit-read-only t))
+      (save-excursion
 	(goto-char (point-min))
 	(save-excursion
 	  (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)
 	  (org-agenda-filter-apply
 	   (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 ()
   "Mark the current clock entry in the agenda if it is present."
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [rfc] Call agenda finalize hook a little bit later
  2020-06-30 11:15 [rfc] Call agenda finalize hook a little bit later Marco Wahl
@ 2020-07-05 21:24 ` Marco Wahl
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Wahl @ 2020-07-05 21:24 UTC (permalink / raw)
  To: emacs-orgmode

Hello all,

> What do you think about calling the agenda finalize hook a little bit
> later so that the cursor position can be changed?
>
> E.g. this would allow to hook in a function that attempts to move point
> to the current clock.

Since there was neither opposition nor discussion and since the change
is small, I just pushed it.


Best regards,
--
Marco



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-30 11:15 [rfc] Call agenda finalize hook a little bit later Marco Wahl
2020-07-05 21:24 ` Marco Wahl

unofficial mirror of emacs-orgmode@gnu.org

Archives are clonable:
	git clone --mirror https://yhetil.org/orgmode/0 orgmode/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 orgmode orgmode/ https://yhetil.org/orgmode \
		emacs-orgmode@gnu.org
	public-inbox-index orgmode

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git