From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marco Wahl Subject: [RFC] org-agenda: Jump directly to line in case of a timestamp Date: Sat, 07 Oct 2017 16:45:12 +0200 Message-ID: <84y3onggp3.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0qM9-0004Fq-H2 for emacs-orgmode@gnu.org; Sat, 07 Oct 2017 10:45:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e0qM5-0002cX-KA for emacs-orgmode@gnu.org; Sat, 07 Oct 2017 10:45:33 -0400 Received: from [195.159.176.226] (port=46324 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e0qM5-0002c3-3q for emacs-orgmode@gnu.org; Sat, 07 Oct 2017 10:45:29 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1e0qLr-0000HI-Uq for emacs-orgmode@gnu.org; Sat, 07 Oct 2017 16:45:15 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Hello, This is a little proposition about changing the behaviour of `org-agenda-goto' which typically gets triggered when pressing TAB on an line in the Org agenda. The proposition affects only the case of an agenda line due to a timestamp outside a planning line (i.e. SCHEDULED or DEADLINE.) Up to now `org-agenda-goto' jumps always to the corresponding headline. With the patch `org-agenda-goto' would jump directly to the line containing the timestamp. If you use plain lists with timestamps this can be helpful. Let's say in an Org file you have the following plain list. * test - <2017-10-07 Sat 16:25> Start writing the RFC. - <2017-10-07 Sat 16:29> Thought: "Will somebody notice?" - <2017-10-07 Sat 16:30> Sent the RFC to the list. For each list item a corresponding line appears in the day agenda. .tmp .:16:25...... test .tmp .:16:29...... test .tmp .:16:30...... test Pressing TAB in the agenda would jump to the respective plain list item. Find the concrete patch below. WDYT? Best regards Marco --8<---------------cut here---------------start------------->8--- >From e2fd5f36b33e17063cf06f8df7b5d924c751b327 Mon Sep 17 00:00:00 2001 From: Marco Wahl Date: Sat, 7 Oct 2017 15:57:36 +0200 Subject: [PATCH] org-agenda: Jump directly to line in case of a timestamp entry * lisp/org-agenda.el (org-agenda-goto): Don't move back to heading when on a line with a free standing timestamp. --- lisp/org-agenda.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index fb5448ef8..6fd16b659 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -8424,10 +8424,12 @@ When called with a prefix argument, include all archive files as well." (when (derived-mode-p 'org-mode) (org-show-context 'agenda) (recenter (/ (window-height) 2)) - (org-back-to-heading t) - (let ((case-fold-search nil)) - (when (re-search-forward org-complex-heading-regexp nil t) - (goto-char (match-beginning 4))))) + (unless (and (looking-at org-ts-regexp-both) + (not (org-at-planning-p))) + (org-back-to-heading t) + (let ((case-fold-search nil)) + (when (re-search-forward org-complex-heading-regexp nil t) + (goto-char (match-beginning 4)))))) (run-hooks 'org-agenda-after-show-hook) (and highlight (org-highlight (point-at-bol) (point-at-eol))))) -- 2.14.2 --8<---------------cut here---------------end--------------->8---