* [PATCH] Fix clock table when there are links in headings.
@ 2014-02-20 5:47 Alexey Lebedeff
2014-03-03 12:32 ` Bastien
0 siblings, 1 reply; 10+ messages in thread
From: Alexey Lebedeff @ 2014-02-20 5:47 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 196 bytes --]
Hi,
This screenshot
https://www.dropbox.com/s/g3obxpigr8gg69f/-Org%20Agenda-%20-%20emacs_017.png
shows how it looked before the patch. It's no good unless you have
very good memory for numbers )
[-- Attachment #2: 0001-Fix-clock-table-when-there-are-links-in-headings.patch --]
[-- Type: text/x-patch, Size: 1945 bytes --]
From d14eac26b0a452b39e0f8231d2c7a552f16ffe1b Mon Sep 17 00:00:00 2001
From: Alexey Lebedeff <binarin@gmail.com>
Date: Thu, 20 Feb 2014 08:43:21 +0400
Subject: [PATCH] Fix clock table when there are links in headings.
* lisp/org.el (org-all-links-display-format): New function which
replaces all links in string with their descriptions.
* lisp/org-clock.el (org-clock-get-table-data): When linking table
entry to original heading, replace all links there with their
descriptions. It's because when nesting org links they are converted
to something like "{{some-link}{some-description}}" and as a result
mulitple rows such as that can become almost indistinguishable.
TINYCHANGE
---
lisp/org-clock.el | 3 ++-
lisp/org.el | 7 +++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 8e1d632..31e59a8 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2709,7 +2709,8 @@ TIME: The sum of all time spend in this tree, in minutes. This time
(save-match-data
(org-make-org-heading-search-string
(match-string 2))))
- (match-string 2)))
+ (org-all-links-display-format
+ (match-string 2))))
tsp (when timestamp
(setq props (org-entry-properties (point)))
(or (cdr (assoc "SCHEDULED" props))
diff --git a/lisp/org.el b/lisp/org.el
index ac53e56..a9a5bd7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -24095,6 +24095,13 @@ If there is no description, use the link target."
nil t link)
link)))
+(defun org-all-links-display-format (string)
+ "Replaces all links in string with their descriptions."
+ (loop
+ for result = string then (org-link-display-format result)
+ while (string-match org-bracket-link-regexp result)
+ finally (return result)))
+
(defun org-toggle-link-display ()
"Toggle the literal or descriptive display of links."
(interactive)
--
1.8.5.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] Fix clock table when there are links in headings.
2014-02-20 5:47 [PATCH] Fix clock table when there are links in headings Alexey Lebedeff
@ 2014-03-03 12:32 ` Bastien
2014-03-13 11:21 ` Alexey Lebedeff
0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2014-03-03 12:32 UTC (permalink / raw)
To: Alexey Lebedeff; +Cc: emacs-orgmode
Hi Alexey,
Alexey Lebedeff <binarin@gmail.com> writes:
> This screenshot
> https://www.dropbox.com/s/g3obxpigr8gg69f/-Org%20Agenda-%20-%20emacs_017.png
> shows how it looked before the patch. It's no good unless you have
> very good memory for numbers )
Thanks for the patch.
`org-all-links-display-format' is a bit redundant with
`org-link-prettify'. Would you mind rewriting the change
using `org-link-prettify'?
Thanks,
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Fix clock table when there are links in headings.
2014-03-03 12:32 ` Bastien
@ 2014-03-13 11:21 ` Alexey Lebedeff
2014-03-13 11:33 ` Bastien
0 siblings, 1 reply; 10+ messages in thread
From: Alexey Lebedeff @ 2014-03-13 11:21 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
Hi Bastien,
2014-03-03 16:32 GMT+04:00 Bastien <bzg@gnu.org>:
>> This screenshot
>> https://www.dropbox.com/s/g3obxpigr8gg69f/-Org%20Agenda-%20-%20emacs_017.png
>> shows how it looked before the patch. It's no good unless you have
>> very good memory for numbers )
>
> Thanks for the patch.
>
> `org-all-links-display-format' is a bit redundant with
> `org-link-prettify'. Would you mind rewriting the change
> using `org-link-prettify'?
I can't figure out how to use 'org-link-prettify' function. It only
accepts one link that is already parsed.
But for clocktable whole heading string needs to be transformed, and
it can contain multiple links.
E.g. "[[a][b]] and [[c][d]]" must be transformed to "b and d".
'org-all-links-display-format' does exactly this.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Fix clock table when there are links in headings.
2014-03-13 11:21 ` Alexey Lebedeff
@ 2014-03-13 11:33 ` Bastien
2014-03-18 13:24 ` Alexey Lebedeff
0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2014-03-13 11:33 UTC (permalink / raw)
To: Alexey Lebedeff; +Cc: emacs-orgmode
Hi Alexey,
I assumed you use the latest Org version, but maybe not.
What does M-x org-version RET reports?
Actually, my bracket links are displayed correctly in the
clocktable (i.e. as bracket links, not with curly braces.)
Maybe I'm missing something,
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Fix clock table when there are links in headings.
2014-03-13 11:33 ` Bastien
@ 2014-03-18 13:24 ` Alexey Lebedeff
2014-03-18 16:10 ` Bastien
0 siblings, 1 reply; 10+ messages in thread
From: Alexey Lebedeff @ 2014-03-18 13:24 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
Hi Bastien,
Sorry, I failed to explicitly mention that it was in agenda
clockreport. It was in the screenshot, but I forgot that clocktable is
used in other places than agenda.
With current master (17ecfd4130b11e400b65dfd6b9df43af43d4061b) from
git://orgmode.org/org-mode.git i observe following behaviour:
- When I generate clocktable using C-c C-x C-c on such a heading, all
looks perfect - only descriptions are shown.
- But in agenda (via org-agenda-clockreport-mode) it is displayed with
braces like "STRT {{a}{b}} and {{c}{d}}". This happens if ':link'
option is enabled when calling org-clock-get-table-data and something
like this is evaluated:
(org-make-link-string "file::abc:100" "[[a][b]] and [[c][d]]") =>
"[[file::abc:100][{{a}{b}} and {{c}{d}}]]"
2014-03-13 15:33 GMT+04:00 Bastien <bzg@gnu.org>:
> Hi Alexey,
>
> I assumed you use the latest Org version, but maybe not.
>
> What does M-x org-version RET reports?
>
> Actually, my bracket links are displayed correctly in the
> clocktable (i.e. as bracket links, not with curly braces.)
>
> Maybe I'm missing something,
>
> --
> Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Fix clock table when there are links in headings.
2014-03-18 13:24 ` Alexey Lebedeff
@ 2014-03-18 16:10 ` Bastien
2014-03-19 8:57 ` Alexey Lebedeff
0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2014-03-18 16:10 UTC (permalink / raw)
To: Alexey Lebedeff; +Cc: emacs-orgmode
Hi Alexey,
Alexey Lebedeff <binarin@gmail.com> writes:
> Sorry, I failed to explicitly mention that it was in agenda
> clockreport. It was in the screenshot, but I forgot that clocktable is
> used in other places than agenda.
You need to configure `org-agenda-clockreport-parameter-plist'
like this:
(setq org-agenda-clockreport-parameter-plist '(:link nil :maxlevel 2))
HTH,
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Fix clock table when there are links in headings.
2014-03-18 16:10 ` Bastien
@ 2014-03-19 8:57 ` Alexey Lebedeff
2014-03-19 9:50 ` Bastien
0 siblings, 1 reply; 10+ messages in thread
From: Alexey Lebedeff @ 2014-03-19 8:57 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
Hi Bastien,
2014-03-18 20:10 GMT+04:00 Bastien <bzg@gnu.org>:
> Hi Alexey,
>
> Alexey Lebedeff <binarin@gmail.com> writes:
>
>> Sorry, I failed to explicitly mention that it was in agenda
>> clockreport. It was in the screenshot, but I forgot that clocktable is
>> used in other places than agenda.
>
> You need to configure `org-agenda-clockreport-parameter-plist'
> like this:
>
> (setq org-agenda-clockreport-parameter-plist '(:link nil :maxlevel 2))
But I don't want do disable linking agenda clocktable row to the
original heading, it's very convenient. I just want it to look pretty,
but the thing from the screenshot looks really ugly. Patch affects
execution only when :link is true.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Fix clock table when there are links in headings.
2014-03-19 8:57 ` Alexey Lebedeff
@ 2014-03-19 9:50 ` Bastien
2014-03-20 7:47 ` Alexey Lebedeff
0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2014-03-19 9:50 UTC (permalink / raw)
To: Alexey Lebedeff; +Cc: emacs-orgmode
Hi Alexey,
Alexey Lebedeff <binarin@gmail.com> writes:
> But I don't want do disable linking agenda clocktable row to the
> original heading, it's very convenient. I just want it to look pretty,
> but the thing from the screenshot looks really ugly. Patch affects
> execution only when :link is true.
Of course you're right. I pushed this change:
http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=3a233a
It should do what you want -- thanks for insisting and for
the patch you submitted for this.
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Fix clock table when there are links in headings.
2014-03-19 9:50 ` Bastien
@ 2014-03-20 7:47 ` Alexey Lebedeff
2014-03-20 8:45 ` Bastien
0 siblings, 1 reply; 10+ messages in thread
From: Alexey Lebedeff @ 2014-03-20 7:47 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
Hi Bastien,
2014-03-19 13:50 GMT+04:00 Bastien <bzg@gnu.org>:
>> But I don't want do disable linking agenda clocktable row to the
>> original heading, it's very convenient. I just want it to look pretty,
>> but the thing from the screenshot looks really ugly. Patch affects
>> execution only when :link is true.
>
> Of course you're right. I pushed this change:
> http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=3a233a
>
> It should do what you want -- thanks for insisting and for
> the patch you submitted for this.
We are almost there )
Links [[without description]] will be missing from output, "\\3"
should be more like (lambda (match) (or (match-string 3 match)
(match-string 1 match)))
Thanks to you for your efforts.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Fix clock table when there are links in headings.
2014-03-20 7:47 ` Alexey Lebedeff
@ 2014-03-20 8:45 ` Bastien
0 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2014-03-20 8:45 UTC (permalink / raw)
To: Alexey Lebedeff; +Cc: emacs-orgmode
Hi Alexey,
Alexey Lebedeff <binarin@gmail.com> writes:
> Links [[without description]] will be missing from output, "\\3"
> should be more like (lambda (match) (or (match-string 3 match)
> (match-string 1 match)))
Indeed, sorry I've overlooked this and thanks for the solution!
Fixed now,
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-03-20 8:46 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-20 5:47 [PATCH] Fix clock table when there are links in headings Alexey Lebedeff
2014-03-03 12:32 ` Bastien
2014-03-13 11:21 ` Alexey Lebedeff
2014-03-13 11:33 ` Bastien
2014-03-18 13:24 ` Alexey Lebedeff
2014-03-18 16:10 ` Bastien
2014-03-19 8:57 ` Alexey Lebedeff
2014-03-19 9:50 ` Bastien
2014-03-20 7:47 ` Alexey Lebedeff
2014-03-20 8:45 ` Bastien
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).