emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alexey Lebedeff <binarin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Fix clock table when there are links in headings.
Date: Thu, 20 Feb 2014 09:47:17 +0400	[thread overview]
Message-ID: <CADOt_n8OjtL9ndwBn_QMR0SEVdF2Gc+zk+SpZnxp7a8EXstyEA@mail.gmail.com> (raw)

[-- 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


             reply	other threads:[~2014-02-20  5:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20  5:47 Alexey Lebedeff [this message]
2014-03-03 12:32 ` [PATCH] Fix clock table when there are links in headings 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADOt_n8OjtL9ndwBn_QMR0SEVdF2Gc+zk+SpZnxp7a8EXstyEA@mail.gmail.com \
    --to=binarin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).