[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Concatenating Org property values from parent subtrees
From: |
Michael Welle |
Subject: |
Re: [O] Concatenating Org property values from parent subtrees |
Date: |
Sat, 29 Sep 2018 21:23:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) |
Hello,
Kaushal Modi <address@hidden> writes:
> On Sat, Sep 29, 2018 at 2:39 PM Michael Welle <address@hidden> wrote:
>
>>
>> I asked something similar earlier this year (concatenating compiler
>> flags given as header-args property, used for linking against different
>> libs in different sections of the Org file). I ended with a function
>> that grabs the current property value and returns the value concatenated
>> with new value. That function can be used as a 'property value'. That's
>> not a nice and bullet proof solution, but works good enough to me to
>> generate the solutions to the psets for the lecture.
>>
>
> Please share it if you don't mind. I plan to use it or its derivative in
> ox-hugo. The property is planned to be a path property, and with nested
> property values of "a","b" and "c", which I want to parse as "a/b/c".
(defun hmw/org-prop-append(prop value)
(save-excursion
(org-up-heading-safe)
(format "%s %s" value (cdr (assq prop
(car (org-babel-params-from-properties)))))))
(defalias 'A 'hmw/org-prop-append)
I use it like this:
* foo
:PROPERTIES:
:header-args: :flags -Wall
:END:
** bar
#+begin_src C :flags (A :flags "-lm")
#+end_src
** baz
:PROPERTIES:
:header-args: :flags (A :flags "-lcunit")
:END:
#+begin_src C
#+end_src
Regards
hmw