emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [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

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).