emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] Allow caption and header text in clocktable dblocks


From: Sebastien Vauban
Subject: [O] [PATCH] Allow caption and header text in clocktable dblocks
Date: Tue, 10 Sep 2013 12:19:27 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (windows-nt)

Hello Francesco,

"Francesco Pizzolante" wrote:
> Nicolas Goaziou wrote:
>> "Francesco Pizzolante" <address@hidden> writes:
>>
>>> But if I try what you suggest and move the #+ATTR_LATEX line inside the
>>> dynamic block (after the #+BEGIN: clocktable and just before the generated
>>> table), then this line gets lost as soon as the dynamic block is
>>> regenerated, which is not what I expect.
>>
>> Then some attribute could be added to dynamic block arguments in order to
>> re-create the ATTR_LATEX keyword each time. IIRC we did that for #+CAPTION
>> some months ago. It shouldn't be difficult to do it for this one.
>
> I've seen, indeed (thanks!), that there was a ":header" option, which you
> can use to add free text in front of the dynamic table.
>
> #+BEGIN: clocktable :maxlevel 2 :scope ("clock-file.org") :block 2013-08 
> :fileskip0 t :lang "en" :header "#+ATTR_LaTeX: :environment longtabu :align 
> lXrr\n"
> #+ATTR_LaTeX: :environment longtabu :align lXrr
> | File           | Headline            |   Time |      |
> |----------------+---------------------+--------+------|
> |                | ALL Total time      |   1:44 |      |
> |----------------+---------------------+--------+------|
> | clock-file.org | File time           | *1:44* |      |
> |                | Projet management   |   1:44 |      |
> |                | \__ Writing reports |        | 1:44 |
> #+END:
>
> Though, doing so, there is no CAPTION anymore...
>
> Maybe adding a ":header" should not strip the autogenerated caption?

I need that as well -- here is the patch (if Nicolas is OK with it)...

Best regards,
  Seb

From: "Sebastien Vauban" <address@hidden>
Date: Tue, 10 Sep 2013 12:15:26 +0200
Subject: [PATCH] Allow caption and header text in clocktable dblocks

* org-clock.el (org-clocktable-write-default): Allow caption and header text
  in clocktable dblocks.

---
 lisp/org-clock.el |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index c39b589..27fba2a 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2388,19 +2388,21 @@ from the dynamic block definition."
     ;; Now we need to output this tsuff
     (goto-char ipos)
 
-    ;; Insert the text *before* the actual table
+    ;; Insert the caption
     (insert-before-markers
-     (or header
-        ;; Format the standard header
-        (concat
-         "#+CAPTION: "
-         (nth 9 lwords) " ["
-         (substring
-          (format-time-string (cdr org-time-stamp-formats))
-          1 -1)
-         "]"
-         (if block (concat ", for " range-text ".") "")
-         "\n")))
+     ;; Format the standard header
+     (concat
+      "#+CAPTION: "
+      (nth 9 lwords) " ["
+      (substring
+       (format-time-string (cdr org-time-stamp-formats))
+       1 -1)
+      "]"
+      (if block (concat ", for " range-text ".") "")
+      "\n"))
+
+    ;; Insert the header text *before* the actual table
+    (insert-before-markers header)
 
     ;; Insert the narrowing line
     (when (and narrow (integerp narrow) (not narrow-cut-p))
-- 
1.7.9




reply via email to

[Prev in Thread] Current Thread [Next in Thread]