From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ELQrKRQf+17ZegAA0tVLHw (envelope-from ) for ; Tue, 30 Jun 2020 11:16:36 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id iIHgJBQf+17xSwAAbx9fmQ (envelope-from ) for ; Tue, 30 Jun 2020 11:16:36 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 18B2A9403E9 for ; Tue, 30 Jun 2020 11:16:35 +0000 (UTC) Received: from localhost ([::1]:45980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jqEFd-0008IU-I0 for larch@yhetil.org; Tue, 30 Jun 2020 07:16:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jqEF8-0008IF-8E for emacs-orgmode@gnu.org; Tue, 30 Jun 2020 07:16:02 -0400 Received: from ciao.gmane.io ([159.69.161.202]:58228 helo=old-ciao) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jqEF6-000074-Eb for emacs-orgmode@gnu.org; Tue, 30 Jun 2020 07:16:01 -0400 Received: from list by old-ciao with local (Exim 4.92) (envelope-from ) id 1jqEF2-000WOz-Jc for emacs-orgmode@gnu.org; Tue, 30 Jun 2020 13:15:56 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Marco Wahl Subject: [rfc] Call agenda finalize hook a little bit later Date: Tue, 30 Jun 2020 13:15:53 +0200 Message-ID: <874kqsztw6.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:1dRDQreAPz8dkEaq3oZ3RJKsBqo= Received-SPF: pass client-ip=159.69.161.202; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=old-ciao X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/30 07:15:57 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 30 X-Spam_score: 3.0 X-Spam_bar: +++ X-Spam_report: (3.0 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, FSL_HELO_NON_FQDN_1=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, HELO_NO_DOMAIN=1, NML_ADSP_CUSTOM_MED=0.9, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.41 X-TUID: WFTTVuLMnz8U --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-agenda-Call-finalize-hook-later.patch >From 37f2e1519915a0476bb4d15328473541236d4890 Mon Sep 17 00:00:00 2001 From: Marco Wahl 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 --=-=-=--