emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: [PATCH] Allow caption and header text in clocktable dblocks
Date: Tue, 10 Sep 2013 12:19:27 +0200	[thread overview]
Message-ID: <86d2ohdln4.fsf_-_@somewhere.org> (raw)
In-Reply-To: 874n9zisux.fsf@somewhere.org

Hello Francesco,

"Francesco Pizzolante" wrote:
> Nicolas Goaziou wrote:
>> "Francesco Pizzolante" <fpz-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org> 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" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
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	other threads:[~2013-09-10 10:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-03 15:24 ATTR_LATEX not being applied on dynamic blocks Francesco Pizzolante
2013-09-03 15:46 ` Nicolas Goaziou
     [not found]   ` <87a9jt3o2l.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-04  7:46     ` Francesco Pizzolante
2013-09-04 11:41       ` Nicolas Goaziou
     [not found]         ` <878uzc4xwt.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-05  8:18           ` Francesco Pizzolante
2013-09-10 10:19             ` Sebastien Vauban [this message]

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=86d2ohdln4.fsf_-_@somewhere.org \
    --to=sva-news-d0wtavr13harg/idocfnwg@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.gmane.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).