summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-11-06 16:16:49 -0400
committerCarsten Dominik <carsten.dominik@gmail.com>2010-11-06 16:16:49 -0400
commitd96c9980199b88a8ecce58984fa0e6e50f369fc4 (patch)
tree8ee67ca354012508899a540e3ead82a454e6d75c
parent874467d6b6ef1fdc83492ead046f2f5fbeba0d85 (diff)
downloadorg-mode-d96c9980199b88a8ecce58984fa0e6e50f369fc4.tar.gz
Fix issue with narrowing and links in clocktables
* lisp/org-clock.el (org-clocktable-write-default): Better handling of narrowing. Liang Wang writes: > After I upgrade orgmode to latest version, clock report shows link > text literally. > > For example, > > [[file:/home/liang/gtd/todo.org::Task... > > Unfortunately, in this way, I can not see what this task actually is. > I have to temporarily disable link in clock report.
-rw-r--r--doc/org.texi5
-rw-r--r--lisp/org-clock.el26
2 files changed, 21 insertions, 10 deletions
diff --git a/doc/org.texi b/doc/org.texi
index bfdb8f9..73d4f36 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -5923,9 +5923,8 @@ but you can specify your own function using the @code{:formatter} parameter.
:emphasize @r{When @code{t}, emphasize level one and level two items.}
:link @r{Link the item headlines in the table to their origins.}
:narrow @r{An integer to limit the width of the headline column in}
- @r{the org table. Does not work together with @code{:link}.}
- @r{If you write it like @samp{50!}, then the headline will also}
- @r{be shortened in export, and will work with @code{:link}.}
+ @r{the org table. If you write it like @samp{50!}, then the}
+ @r{headline will also be shortened in export.}
:indent @r{Indent each headline field according to its level.}
:tcolumns @r{Number of columns to be used for times. If this is smaller}
@r{than @code{:maxlevel}, lower levels will be lumped into one column.}
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 94e6ecd..69eaf94 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1895,6 +1895,7 @@ from the dynamic block defintion."
(te (plist-get params :tend))
(header (plist-get params :header))
(narrow (plist-get params :narrow))
+ (link (plist-get params :link))
(maxlevel (or (plist-get params :maxlevel) 3))
(emph (plist-get params :emphasize))
(level-p (plist-get params :level))
@@ -1902,7 +1903,7 @@ from the dynamic block defintion."
(ntcol (max 1 (or (plist-get params :tcolumns) 100)))
(rm-file-column (plist-get params :one-file-with-archives))
(indent (plist-get params :indent))
- link range-text total-time tbl level hlc formula pcol
+ range-text total-time tbl level hlc formula pcol
file-time entries entry headline
recalc content narrow-cut-p)
@@ -1917,8 +1918,8 @@ from the dynamic block defintion."
(when (and narrow (integerp narrow) link)
;; We cannot have both integer narrow and link
(message
- "Suppressing :narrow INTEGER in clocktable because :link was also given")
- (setq narrow nil))
+ "Using hard narrowing in clocktable to allow for links")
+ (setq narrow (intern (format "%d!" narrow))))
(when narrow
(cond
@@ -1926,9 +1927,11 @@ from the dynamic block defintion."
((and (symbolp narrow)
(string-match "\\`[0-9]+!\\'" (symbol-name narrow)))
(setq narrow-cut-p t
- narrow (string-to-number (substring (symbol-name narrow) 0 -1))))
+ narrow (string-to-number (substring (symbol-name narrow)
+ 0 -1))))
(t
- (error "Invalid value %s of :narrow property in clock table" narrow))))
+ (error "Invalid value %s of :narrow property in clock table"
+ narrow))))
(when block
;; Get the range text for the header
@@ -2008,8 +2011,17 @@ from the dynamic block defintion."
(setq level (car entry)
headline (nth 1 entry)
hlc (if emph (or (cdr (assoc level hlchars)) "") ""))
- (if narrow-cut-p
- (setq headline (org-shorten-string headline narrow)))
+ (when narrow-cut-p
+ (if (and (string-match (concat "\\`" org-bracket-link-regexp
+ "\\'")
+ headline)
+ (match-end 3))
+ (setq headline
+ (format "[[%s][%s]]"
+ (match-string 1 headline)
+ (org-shorten-string (match-string 3 headline)
+ narrow)))
+ (setq headline (org-shorten-string headline narrow))))
(insert-before-markers
"|" ; start the table line
(if multifile "|" "") ; free space for file name column?