From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Stacey Marshall" Subject: [PATCH]: org-link-search failing to find links created by clock table Date: Fri, 14 Apr 2017 20:08:42 +0100 Message-ID: <0C9625C0-3F43-4C6C-AA28-06D1102ACA10@oracle.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=_MailMate_8748B217-B2AD-41DD-83DA-E6C2D8CF081A_=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cz6b0-0001NO-44 for emacs-orgmode@gnu.org; Fri, 14 Apr 2017 15:09:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cz6aw-0008JG-TZ for emacs-orgmode@gnu.org; Fri, 14 Apr 2017 15:09:26 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:41613) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cz6aw-0008Iz-HC for emacs-orgmode@gnu.org; Fri, 14 Apr 2017 15:09:22 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v3EJ9KEF031601 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 14 Apr 2017 19:09:20 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v3EJ9JLT020479 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 14 Apr 2017 19:09:20 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v3EJ9JIU031249 for ; Fri, 14 Apr 2017 19:09:19 GMT 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: Org Mode --=_MailMate_8748B217-B2AD-41DD-83DA-E6C2D8CF081A_= Content-Type: text/plain; format=flowed Content-Transfer-Encoding: quoted-printable * Example of the issue Emacs : GNU Emacs 25.2.1 (x86_64-apple-darwin16.4.0, Carbon Version 157 = AppKit 1504.81) of 2017-03-07 Package: Org mode version 9.0.5 (release_9.0.5-351-g0e0fda.dirty @ = /Users/stacey/.emacs.d/org-mode/lisp/) In this buffer the TODO keywords are FIXME and FIXED, as set by: #+SEQ_TODO: FIXME FIXED #+BEGIN: clocktable :maxlevel 4 :scope subtree :link t #+CAPTION: Clock summary at [2017-04-14 Fri 20:01] | Headline = | Time | | | | |------------------------------------------------------------------------= ----------------------------------------+-----------+---------+---+---| | *Total time* = | *1h 9min* | | | | |------------------------------------------------------------------------= ----------------------------------------+-----------+---------+---+---| | [[file:/tmp/test.org::Example%20of%20the%20issue][Example of the = issue]] | 1h 9min | | = | | | \_ [[file:/tmp/test.org::Test%20log][Test log]] = | | 0h 4min | | | | \_ [[file:/tmp/test.org::Test%20log][FIXME Test log]] = | | 1h 0min | | | | \_ [[file:/tmp/test.org::test%20with%20comment%20no%20to-do][COMMENT = test with comment no to-do]] | | 0h 2min | | | | \_ = [[file:/tmp/test.org::FIXME%20comment%20with%20to-do%20keyword][COMMENT = FIXME comment with to-do keyword]] | | 0h 1min | | | | \_ [[file:/tmp/test.org::with%20a%20fraction][FIXME with a fraction]] = | | 0h 1min | | | | \_ [[file:/tmp/test.org::with%20a%20percentage][FIXME with a = percentage]] | | 0h 1min | = | | #+END: ** Test log :LOGBOOK: CLOCK: [2017-04-11 Tue 23:20]--[2017-04-11 Tue 23:24] =3D> 0:04 :END: ** FIXME Test log :LOGBOOK: CLOCK: [2017-04-11 Tue 22:20]--[2017-04-11 Tue 23:20] =3D> 1:00 :END: ** COMMENT test with comment no to-do :LOGBOOK: CLOCK: [2017-04-14 Fri 17:29]--[2017-04-14 Fri 17:31] =3D> 0:02 :END: ** COMMENT FIXME comment with to-do keyword :LOGBOOK: CLOCK: [2017-04-14 Fri 17:31]--[2017-04-14 Fri 17:32] =3D> 0:01 :END: ** FIXME with a fraction [1/2] :LOGBOOK: CLOCK: [2017-04-14 Fri 17:42]--[2017-04-14 Fri 17:43] =3D> 0:01 :END: - [X] One - [ ] two ** FIXME with a percentage [50%] :LOGBOOK: CLOCK: [2017-04-14 Fri 17:32]--[2017-04-14 Fri 17:33] =3D> 0:01 :END: - [ ] one - [X] two * Patch Appears that change ebbc675bd9890c451ad01910fa2625fa78baac9b way back in 9.0.1 needed to also modify org-clock.el, or at least when I revert that change I get the behavior I'm used to back. Below is a patch which modifies org-clock.el; Though I'm sure it can be approved upon. #+BEGIN_EXAMPLE diff diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 0973cc21b..3e30d20f8 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -2801,12 +2801,17 @@ TIME: The sum of all time spend in this = tree, in minutes. This time (- (match-end 1) (match-beginning = 1)))) (<=3D level maxlevel)) (setq hdl (if (not link) - (match-string 2) + (org-get-heading t t t t) (org-make-link-string (format "file:%s::%s" (buffer-file-name) (save-match-data - (match-string 2))) + (org-make-org-heading-search-string + (replace-regexp-in-string + org-bracket-link-regexp + (lambda (m) (or (match-string 3 m) + (match-string 1 m))) + (org-get-heading t t t t))))) (org-make-org-heading-search-string (replace-regexp-in-string org-bracket-link-regexp #+END_EXAMPLE --=_MailMate_8748B217-B2AD-41DD-83DA-E6C2D8CF081A_= Content-Type: text/html Content-Transfer-Encoding: quoted-printable
  • Example of the issue

Emacs : GNU Emacs 25.2.1 (x86_64-apple-darwin16.4.0, Car= bon Version 157 AppKit 1504.81)
of 2017-03-07
Package: Org mode version 9.0.5 (release_9.0.5-351-g0e0fda.dirty @ /Users= /stacey/.emacs.d/org-mode/lisp/)

In this buffer the TODO keywords are FIXME and FIXED, as = set by:

+SEQ_TODO: FIXME FIXED

+BEGIN: clocktable :maxlevel 4 :scope subtr= ee :link t

+CAPTION: Clock summary at [2017-04-14 Fri = 20:01]

| Headline = | Time | = | | |
|------------------------------------------------------------------------= ----------------------------------------+-----------+---------+---+---| | Total time = | 1h 9min | = | | |
|------------------------------------------------------------------------= ----------------------------------------+-----------+---------+---+---| | [[file:/tmp/test.org::Example%20of%20the%20issue][Example of the issue]= ] | 1h 9min | | | | | _ [[file:/tmp/test.org::Test%20log][Test log]] = | | 0h 4min | | | | _ [[file:/tmp/test.org::Test%20log][FIXME Test log]] = | | 1h 0min | | | | _ [[file:/tmp/test.org::test%20with%20comment%20no%20to-do][COMMENT te= st with comment no to-do]] | | 0h 2min | | | | _ [[file:/tmp/test.org::FIXME%20comment%20with%20to-do%20keyword][COMM= ENT FIXME comment with to-do keyword]] | | 0h 1min | | | | _ [[file:/tmp/test.org::with%20a%20fraction][FIXME with a fraction]] = | | 0h 1min | | | | _ [[file:/tmp/test.org::with%20a%20percentage][FIXME with a percentage= ]] | | 0h 1min | | |

+END:

** Test log
:LOGBOOK:
CLOCK: [2017-04-11 Tue 23:20]--[2017-04-11 Tue 23:24] =3D> 0:04
:END:
** FIXME Test log
:LOGBOOK:
CLOCK: [2017-04-11 Tue 22:20]--[2017-04-11 Tue 23:20] =3D> 1:00
:END:

** COMMENT test with comment no to-do
:LOGBOOK:
CLOCK: [2017-04-14 Fri 17:29]--[2017-04-14 Fri 17:31] =3D> 0:02
:END:
** COMMENT FIXME comment with to-do keyword
:LOGBOOK:
CLOCK: [2017-04-14 Fri 17:31]--[2017-04-14 Fri 17:32] =3D> 0:01
:END:
** FIXME with a fraction [1/2]
:LOGBOOK:
CLOCK: [2017-04-14 Fri 17:42]--[2017-04-14 Fri 17:43] =3D> 0:01
:END:
- [X] One
- [ ] two
** FIXME with a percentage [50%]
:LOGBOOK:
CLOCK: [2017-04-14 Fri 17:32]--[2017-04-14 Fri 17:33] =3D> 0:01
:END:
- [ ] one
- [X] two

  • Patch

Appears that change ebbc675bd9890c451ad01910fa2625fa78baa= c9b way back
in 9.0.1 needed to also modify org-clock.el, or at least when I revert that change I get the behavior I'm used to back.

Below is a patch which modifies org-clock.el; Though I'm = sure it can
be approved upon.

+BEGIN_EXAMPLE diff

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 0973cc21b..3e30d20f8 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2801,12 +2801,17 @@ TIME: The sum of all time spend in this tree= , in minutes. This time
(- (match-end 1) (match-beginning 1))= ))
(<=3D level maxlevel))
(setq hdl (if (not link)
- (match-string 2)
+ (org-get-heading t t t t)
(org-make-link-string
(format "file:%s::%s"
(buffer-file-name)
(save-match-data
- (match-string 2)))
+ (org-make-org-heading-search-string
+ (replace-regexp-in-string
+ org-bracket-link-regexp
+ (lambda (m) (or (match-string 3 m)
+ (match-string 1 m)))
+ (org-get-heading t t t t)))))
(org-make-org-heading-search-string
(replace-regexp-in-string
org-bracket-link-regexp

+END_EXAMPLE

--=_MailMate_8748B217-B2AD-41DD-83DA-E6C2D8CF081A_=--