emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: clocktable
@ 2020-09-28 13:48 matthias
  2024-01-18 15:26 ` [FR] Transfer export attributes from dynamic block to its first child (was: Bug: clocktable) Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: matthias @ 2020-09-28 13:48 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 653 bytes --]

Salut l’équipe d’Orgmode,

J’ai un soucis avec le clocktable  qui semble être un bug car il n’accepte pas les attributs latex avant la ligne BEGIN:
#+latex_header: \usepackage{tabularx}
#+ATTR_LATEX: :align Xll :width \textwidth
#+BEGIN: clocktable :scope file :maxlevel 2

la seul solution que j'ai trouvé, c'est la suivante (mettre l’attribut après le BEGIN :) :
#+latex_header: \usepackage{tabularx}
#+BEGIN: clocktable :scope file :maxlevel 2
#+ATTR_LATEX: :align Xll :width \textwidth

Mais à chaque fois que je met à jour le clocktable (C-c C-c) la ligne d'attribut latex disparait.

 

Cordialement.

 

Matt

[-- Attachment #1.2: Type: text/html, Size: 3179 bytes --]

[-- Attachment #2: openpgp-digital-signature.asc --]
[-- Type: application/pgp-signature, Size: 834 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [FR] Transfer export attributes from dynamic block to its first child (was: Bug: clocktable)
  2020-09-28 13:48 Bug: clocktable matthias
@ 2024-01-18 15:26 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2024-01-18 15:26 UTC (permalink / raw)
  To: matthias; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1123 bytes --]

<matthias@gnu.re> writes:

> J’ai un soucis avec le clocktable  qui semble être un bug car il n’accepte pas les attributs latex avant la ligne BEGIN:

> #+ATTR_LATEX: :align Xll :width \textwidth
> #+BEGIN: clocktable :scope file :maxlevel 2

This is a commonly reported problem - when using dynamic blocks (in
particular, clocktable block), it is impossible to set export attributes
for the generated table. This is because the attributes of the dynamic
block have no effect on the table inside it.

I suggest to provide a standard dynamic block parameter that will make
Org mode prepend certain affiliated keywords to the generated contents:

#+attr_latex: :width \textwidth
#+begin: clocktable :scope file :maxlevel 2 :org-dblock-prepend (:attr_latex )
#+end:

will yield

#+attr_latex: :width \textwidth
#+begin: clocktable :scope file :maxlevel 2 :org-dblock-prepend (:attr_latex)
#+attr_latex: :width \textwidth
#+CAPTION: Clock summary at [2024-01-18 Thu 16:23]
| Headline   | Time    |
|------------+---------|
| *Total time* | *0h 0min* |
#+end:

Tentative patch is attached.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-transfering-dblock-affiliated-keywords-to-its-.patch --]
[-- Type: text/x-patch, Size: 1221 bytes --]

From b6bfe67ed19b2c3a0c3744488f051c29e79a5b3d Mon Sep 17 00:00:00 2001
Message-ID: <b6bfe67ed19b2c3a0c3744488f051c29e79a5b3d.1705591555.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Thu, 18 Jan 2024 16:24:34 +0100
Subject: [PATCH] Allow transfering dblock affiliated keywords to its contents

* lisp/org.el (org-prepare-dblock): Use :org-dblock-prepend dblock
parameter and append the listed affiliated keywords before the
generated dynamic block contents.
---
 lisp/org.el | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 8929a7217..585b9aa5b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8836,6 +8836,12 @@ (defun org-prepare-dblock ()
     (delete-region begdel (match-beginning 0))
     (goto-char begdel)
     (open-line 1)
+    (let ((prepend (plist-get params :org-dblock-prepend))
+          (dblock (org-element-at-point (1- (point))))
+          (affiliated (org-element-create 'paragraph)))
+      (dolist (prop prepend)
+        (org-element-put-property affiliated prop (org-element-property prop dblock))
+        (insert (org-element-interpret-data affiliated))))
     params))
 
 (defun org-map-dblocks (&optional command)
-- 
2.43.0


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-18 16:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-28 13:48 Bug: clocktable matthias
2024-01-18 15:26 ` [FR] Transfer export attributes from dynamic block to its first child (was: Bug: clocktable) Ihor Radchenko

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