From: Tyler Grinn <tylergrinn@gmail.com>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: Concatenate properties
Date: Sat, 07 May 2022 10:09:25 -0400 [thread overview]
Message-ID: <87r155igdm.fsf@gmail.com> (raw)
In-Reply-To: <CAJ51ETpifQqLhRsRzjH-VWW5EG75qv53EUxERHK9wJxYB7oi1Q@mail.gmail.com> (John Kitchin's message of "Sat, 7 May 2022 09:20:56 -0400")
John Kitchin <jkitchin@andrew.cmu.edu> writes:
> Where did you add that?
>
> John
>
> -----------------------------------
> Professor John Kitchin (he/him/his)
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
> On Fri, May 6, 2022 at 11:40 AM Tyler Grinn <tylergrinn@gmail.com>
> wrote:
>
> Thanks for the advice. I've added the caret symbol
> (:EXPORT_FILE_NAME^:
> assignment-1) to mean 'concatenate' as opposed to + for 'joining'.
> If
> this is something the community would want I will clean it up and
> send
> in a patch.
I modified 'org--property-local-values' to return a cons list with the
car being the value of the property and the cdr being either 'concat or
'join.
;; Find additional values.
(let* ((property-extension (org-re-property
(concat (regexp-quote property)
"[+^]")
t t)))
(while (re-search-forward property-extension end t)
(push (cons (match-string-no-properties 3)
(if (string-match-p "\\^\\'" (match-string-no-properties 2))
'concat
'join))
value)))
I used a single re-search in order to maintain the ordering of
properties, ie:
:PROP: he
:PROP^: llo
:PROP+: world
produces 'hello world'
I then updated both 'org-entry-get' and
'org-entry-get-with-inheritance' to 'cl-reduce' the cons list into the
final string value.
prev parent reply other threads:[~2022-05-07 14:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-05 22:37 Concatenate properties Tyler Grinn
2022-05-05 22:56 ` John Kitchin
2022-05-06 15:40 ` Tyler Grinn
2022-05-07 5:33 ` Ihor Radchenko
2022-05-07 11:44 ` John Kitchin
2022-05-07 12:29 ` Tyler Grinn
2022-05-08 12:21 ` Ihor Radchenko
2022-05-08 14:14 ` Tyler Grinn
2022-05-08 14:47 ` Ihor Radchenko
2022-05-09 20:18 ` Tyler Grinn
2022-05-11 11:51 ` Ihor Radchenko
2022-05-11 17:47 ` [PATCH] " Tyler Grinn
2022-05-12 9:59 ` Ihor Radchenko
2022-05-12 23:27 ` Tyler Grinn
2022-05-13 12:21 ` Ihor Radchenko
2022-05-14 2:11 ` Tyler Grinn
2022-05-20 8:04 ` Ihor Radchenko
2022-05-07 13:20 ` John Kitchin
2022-05-07 14:09 ` Tyler Grinn [this message]
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=87r155igdm.fsf@gmail.com \
--to=tylergrinn@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=jkitchin@andrew.cmu.edu \
/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).