[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Concatenating Org property values from parent subtrees
From: |
Ihor Radchenko |
Subject: |
Re: [O] Concatenating Org property values from parent subtrees |
Date: |
Mon, 01 Oct 2018 23:47:52 +0800 |
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 <address@hidden> writes:
> Hello,
>
> Michael Welle <address@hidden> 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
>
signature.asc
Description: PGP signature
- Re: [O] Concatenating Org property values from parent subtrees,
Ihor Radchenko <=