emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH]: org-link-search failing to find links created by clock table
@ 2017-04-14 19:08 Stacey Marshall
  2017-04-15 14:48 ` [PATCH] : " Stacey Marshall
  0 siblings, 1 reply; 3+ messages in thread
From: Stacey Marshall @ 2017-04-14 19:08 UTC (permalink / raw)
  To: Org Mode

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

* 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] =>  0:04
:END:
** FIXME Test log
:LOGBOOK:
CLOCK: [2017-04-11 Tue 22:20]--[2017-04-11 Tue 23:20] =>  1:00
:END:

** COMMENT test with comment no to-do
:LOGBOOK:
CLOCK: [2017-04-14 Fri 17:29]--[2017-04-14 Fri 17:31] =>  0:02
:END:
** COMMENT FIXME comment with to-do keyword
:LOGBOOK:
CLOCK: [2017-04-14 Fri 17:31]--[2017-04-14 Fri 17:32] =>  0:01
:END:
** FIXME with a fraction [1/2]
:LOGBOOK:
CLOCK: [2017-04-14 Fri 17:42]--[2017-04-14 Fri 17:43] =>  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] =>  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))))
                        (<= 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



[-- Attachment #2: Type: text/html, Size: 5355 bytes --]

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

* Re: [PATCH] : org-link-search failing to find links created by clock table
  2017-04-14 19:08 [PATCH]: org-link-search failing to find links created by clock table Stacey Marshall
@ 2017-04-15 14:48 ` Stacey Marshall
  2017-04-17  8:07   ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Stacey Marshall @ 2017-04-15 14:48 UTC (permalink / raw)
  To: Org Mode


Sorry, I'm trying out MailMate and forgot to select Plain Text when 
copying in from Emacs.

* 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] =>  0:04
:END:
** FIXME Test log
:LOGBOOK:
CLOCK: [2017-04-11 Tue 22:20]--[2017-04-11 Tue 23:20] =>  1:00
:END:

** COMMENT test with comment no to-do
:LOGBOOK:
CLOCK: [2017-04-14 Fri 17:29]--[2017-04-14 Fri 17:31] =>  0:02
:END:
** COMMENT FIXME comment with to-do keyword
:LOGBOOK:
CLOCK: [2017-04-14 Fri 17:31]--[2017-04-14 Fri 17:32] =>  0:01
:END:
** FIXME with a fraction [1/2]
:LOGBOOK:
CLOCK: [2017-04-14 Fri 17:42]--[2017-04-14 Fri 17:43] =>  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] =>  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))))
                        (<= 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

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

* Re: [PATCH] : org-link-search failing to find links created by clock table
  2017-04-15 14:48 ` [PATCH] : " Stacey Marshall
@ 2017-04-17  8:07   ` Nicolas Goaziou
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2017-04-17  8:07 UTC (permalink / raw)
  To: Stacey Marshall; +Cc: Org Mode

Hello,

"Stacey Marshall" <stacey.marshall@oracle.com> writes:

> Sorry, I'm trying out MailMate and forgot to select Plain Text when 
> copying in from Emacs.
>
> * 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] =>  0:04
> :END:
> ** FIXME Test log
> :LOGBOOK:
> CLOCK: [2017-04-11 Tue 22:20]--[2017-04-11 Tue 23:20] =>  1:00
> :END:
>
> ** COMMENT test with comment no to-do
> :LOGBOOK:
> CLOCK: [2017-04-14 Fri 17:29]--[2017-04-14 Fri 17:31] =>  0:02
> :END:
> ** COMMENT FIXME comment with to-do keyword
> :LOGBOOK:
> CLOCK: [2017-04-14 Fri 17:31]--[2017-04-14 Fri 17:32] =>  0:01
> :END:
> ** FIXME with a fraction [1/2]
> :LOGBOOK:
> CLOCK: [2017-04-14 Fri 17:42]--[2017-04-14 Fri 17:43] =>  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] =>  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.

Thank you for the analysis and the patch.  I incorporated your
suggestion in a larger patch since there were other fishy parts in the
function. It is now hopefully fixed.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2017-04-17  8:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14 19:08 [PATCH]: org-link-search failing to find links created by clock table Stacey Marshall
2017-04-15 14:48 ` [PATCH] : " Stacey Marshall
2017-04-17  8:07   ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).