emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Michael Welle <mwe012008@gmx.net>, emacs-orgmode@gnu.org
Subject: Re: Concatenating Org property values from parent subtrees
Date: Mon, 01 Oct 2018 23:47:52 +0800	[thread overview]
Message-ID: <87ftxpu0rb.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <87k1n414ww.fsf@luisa.c0t0d0s0.de>

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

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 <mwe012008@gmx.net> writes:

> Hello,
>
> Michael Welle <mwe012008@gmx.net> 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
>


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

  reply	other threads:[~2018-10-01 15:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26 22:57 Concatenating Org property values from parent subtrees Kaushal Modi
2018-09-29 18:38 ` Michael Welle
2018-09-29 19:01   ` Kaushal Modi
2018-09-29 19:23     ` Michael Welle
2018-09-29 19:26       ` Michael Welle
2018-10-01 15:47         ` Ihor Radchenko [this message]
2018-10-01 21:00           ` Kaushal Modi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ftxpu0rb.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mwe012008@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).