From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Welle Subject: Re: Concatenating Org property values from parent subtrees Date: Sat, 29 Sep 2018 21:23:30 +0200 Message-ID: <87k1n42jm5.fsf@luisa.c0t0d0s0.de> References: <87k1n46tdw.fsf@luisa.c0t0d0s0.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6Kq2-0007zN-Kw for emacs-orgmode@gnu.org; Sat, 29 Sep 2018 15:23:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6Kpy-00063G-MJ for emacs-orgmode@gnu.org; Sat, 29 Sep 2018 15:23:38 -0400 Received: from mout.gmx.net ([212.227.15.15]:54061) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g6Kpy-00062f-B2 for emacs-orgmode@gnu.org; Sat, 29 Sep 2018 15:23:34 -0400 Received: from stella.c0t0d0s0.de ([89.204.155.90]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LwJRe-1fgJUT1cpK-0180wa for ; Sat, 29 Sep 2018 21:23:31 +0200 Received: from stella.c0t0d0s0.de ([89.204.155.90]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LwJRe-1fgJUT1cpK-0180wa for ; Sat, 29 Sep 2018 21:23:31 +0200 Received: from Stella (stella.c0t0d0s0.de [192.168.42.1]) by stella.c0t0d0s0.de (Postfix) with ESMTP id 6E0EA181119 for ; Sat, 29 Sep 2018 21:23:30 +0200 (CEST) In-Reply-To: (Kaushal Modi's message of "Sat, 29 Sep 2018 15:01:26 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Hello, Kaushal Modi writes: > On Sat, Sep 29, 2018 at 2:39 PM Michael Welle 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