emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Concatenating header args
@ 2018-03-06  9:25 Michael Welle
  2018-03-06 15:31 ` John Kitchin
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Welle @ 2018-03-06  9:25 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

how can I concatenate header args? Let's assume I have an Org structure
like follows:

* foo
 :PROPERTIES:
 :header-args: :flags -Wall
 :END:
** bar
#+begin_src C :flags -lm
#+end_src

Now I want the code to be compiled with -Wall _and_ -lm.

Regards
hmw

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

* Re: Concatenating header args
  2018-03-06  9:25 Concatenating header args Michael Welle
@ 2018-03-06 15:31 ` John Kitchin
  2018-03-07  7:45   ` Michael Welle
  0 siblings, 1 reply; 4+ messages in thread
From: John Kitchin @ 2018-03-06 15:31 UTC (permalink / raw)
  To: Michael Welle; +Cc: org-mode-email

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

I am pretty sure this isn't possible. The headers get overridden by the
most local settings. There isn't a way to concatenate them. In some cases
there isn't a way to figure out what you want, e.g. if a heading property
said ":tangle no" and your header said ":tangle yes" it would not make
sense to concatenate these to ":tangle no yes".

I think you have to add -Wall to the src header.

John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu


On Tue, Mar 6, 2018 at 1:25 AM, Michael Welle <mwe012008@gmx.net> wrote:

> Hello,
>
> how can I concatenate header args? Let's assume I have an Org structure
> like follows:
>
> * foo
>  :PROPERTIES:
>  :header-args: :flags -Wall
>  :END:
> ** bar
> #+begin_src C :flags -lm
> #+end_src
>
> Now I want the code to be compiled with -Wall _and_ -lm.
>
> Regards
> hmw
>
>

[-- Attachment #2: Type: text/html, Size: 1680 bytes --]

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

* Re: Concatenating header args
  2018-03-06 15:31 ` John Kitchin
@ 2018-03-07  7:45   ` Michael Welle
  2018-03-08  9:55     ` Michael Welle
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Welle @ 2018-03-07  7:45 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> I am pretty sure this isn't possible. The headers get overridden by the
> most local settings. There isn't a way to concatenate them. In some cases
> there isn't a way to figure out what you want, e.g. if a heading property
> said ":tangle no" and your header said ":tangle yes" it would not make
> sense to concatenate these to ":tangle no yes".
hm, I could think of a special syntax, like :tangle results in the
current behaviour and :+table concats values. That way it's up to the
user to express what she wants.


> I think you have to add -Wall to the src header.
Hm, the property values can be functions that get evaluated to get the
actual property values, can't it? I'm not sure though if something like
:flags (get-em "flags" '("-more" "-values")) is so much nicer to write.
Maybe it is, esp. if you want to change the base flags for a ton of
items. Today is teaching tuesday (even if it's wednesday ;)), so I'm a
bit short on time. But I will try that approach later this week and see
where that leads to.

Thanks
hmw

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

* Re: Concatenating header args
  2018-03-07  7:45   ` Michael Welle
@ 2018-03-08  9:55     ` Michael Welle
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Welle @ 2018-03-08  9:55 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Michael Welle <mwe012008@gmx.net> writes:
> Hm, the property values can be functions that get evaluated to get the
> actual property values, can't it? I'm not sure though if something like
> :flags (get-em "flags" '("-more" "-values")) is so much nicer to write.
> Maybe it is, esp. if you want to change the base flags for a ton of
> items. Today is teaching tuesday (even if it's wednesday ;)), so I'm a
> bit short on time. But I will try that approach later this week and see
> where that leads to.
not too nice, but works good enough for me ;).

(defun hmw/org-prop-append(prop value)
  (format "%s %s" value (cdr (assq prop
                                   (car (org-babel-params-from-properties))))))
(defalias 'A 'hmw/org-prop-append)


* foo
 :PROPERTIES:
 :header-args: :flags -Wall
 :END:
** bar

#+begin_src C :flags (A :flags "-lm")
#+end_src

Regards
hmw

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

end of thread, other threads:[~2018-03-08  9:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-06  9:25 Concatenating header args Michael Welle
2018-03-06 15:31 ` John Kitchin
2018-03-07  7:45   ` Michael Welle
2018-03-08  9:55     ` Michael Welle

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