From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ihor Radchenko Subject: Re: Concatenating Org property values from parent subtrees Date: Mon, 01 Oct 2018 23:47:52 +0800 Message-ID: <87ftxpu0rb.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> References: <87k1n46tdw.fsf@luisa.c0t0d0s0.de> <87k1n42jm5.fsf@luisa.c0t0d0s0.de> <87k1n414ww.fsf@luisa.c0t0d0s0.de> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g70SA-0003h3-R3 for emacs-orgmode@gnu.org; Mon, 01 Oct 2018 11:49:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g70S7-0002u8-Hs for emacs-orgmode@gnu.org; Mon, 01 Oct 2018 11:49:46 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:42318) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g70S7-0002tq-A9 for emacs-orgmode@gnu.org; Mon, 01 Oct 2018 11:49:43 -0400 Received: by mail-pf1-x431.google.com with SMTP id l9-v6so9503726pff.9 for ; Mon, 01 Oct 2018 08:49:43 -0700 (PDT) In-Reply-To: <87k1n414ww.fsf@luisa.c0t0d0s0.de> 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: Michael Welle , emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi, Check out the following code: ```` (defvar org-concatenated-properties '("AA") "A list of property names (strings), which should be computed via concatenation with the parent properties.") (define-advice org-entry-get (:around (oldfun pom property &optional inherit literal-nil) concatenate-parents-maybe) "Concatenate the PROPERTY value with its parent entries' values if the PROPERTY is in `org-concatenated-properties' list." (if (not (member property org-concatenated-properties)) (apply oldfun pom property inherit literal-nil) (let ((value-here (funcall oldfun pom property nil 't)) (value (funcall oldfun pom property inherit 't))) (if value-here (format "%s%s" (org-with-wide-buffer (if (org-up-heading-safe) (or (org-entry-get nil property inherit literal-nil) "") "")) (funcall oldfun pom property inherit literal-nil)) (when value (org-with-wide-buffer (org-up-heading-safe) (org-entry-get nil property inherit literal-nil))))))) ```` Best, Ihor Michael Welle writes: > Hello, > > Michael Welle writes: > [...] >> (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) > > and I just realise that it works with code blocks only. I guess the way > to get general property values has to be adapted. > > Regards > hmw > --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEERZAHPFbUe3JemmzmZHB2Kn2hHYsFAluyQagACgkQZHB2Kn2h HYsD9wf+O1wQXUVRQ8oGE/wVPckXv7qDHnNj/dUXyVdn3HNXc91aMLeWIX95fqzf u7bH7kckx9U4EUwJcYXq2Y2TKN+QrinGcgC0pQFAq5fEyvFoDjZ0178JA7Q7g1S8 9PmFKbnyJ4LAsJeYUUzE0tgCySmR7W2xtLnsFigEwGdf24ZSjUYlrY9x/Dd3GCpW 3kpTKp468y/snD3O12ByEgBaxDmWIxgnPnM+95QJZk5oT2xoq52nd2DABpfZ2HFz 7OsJ3z9AiUxZuJaVC9iowYcLoVmqk649Y1VEEOhrUDEnOBFDGbj8RjnhvWlKwyTz a0p4AraUwxHjIflG+KyTS17LcUzO+Q== =8vEq -----END PGP SIGNATURE----- --=-=-=--