From: "Théo Maxime Tyburn" <theo.tyburn@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: Multiple noweb-ref
Date: Sun, 26 Feb 2023 19:51:18 +0100 [thread overview]
Message-ID: <87356sl0in.fsf@gmail.com> (raw)
In-Reply-To: <875ybwe7qs.fsf@localhost>
Hi Ihor,
>> Anyway I tried to hack my way trough it. It seems there are two things
>> to do :
>> 1) Enable noweb-ref to contain multiple references.
>> 2) Accumulate references when using header-args+ or use tags to set the
>> value of noweb-ref
>>
>> I came up with a quick patch for 1):
>> modified lisp/ob-core.el
>> @@ -2910,8 +2910,11 @@ block but are passed literally to the \"example-block\"."
>> (if (org-in-commented-heading-p)
>> (org-forward-heading-same-level nil t)
>> (let* ((info (org-babel-get-src-block-info t))
>> - (ref (cdr (assq :noweb-ref (nth 2 info)))))
>> - (push info (gethash ref cache))))))
>> + (refs (cdr (assq :noweb-ref (nth 2 info)))))
>> + (if refs
>> + (dolist (ref (s-split "+" refs))
>> + (push info (gethash ref cache)))
>> + (push info (gethash refs cache)))))))
>
> + is a bit awkward.
> Space would be more logical as separator.
> Though I am wondering if people are using noweb reference names with
> spaces in the wild.
Might be. So maybe we could use another non-alphabetical character? What
about "|" ?
>> For 2) I didn't check in detail how one could achieve this. I have the
>> impression it would be easier to use tags. One could define a
>> new variable `org-babel-set-noweb-refs-from-tags` that would be used in
>> `org-babel-get-src-block-info` to generate the value of noweb-ref we
>> would like to have depending on the tags of the headline of the
>> block. I'll try this soonish.
>
> I do not like the idea of using tags.
>
> What we might do is:
>
> 1. Leave :noweb-ref's current behavior of overwriting the parent
> parameter values.
> 2. Add a new :noweb-ref+ parameter to accumulate multiple noweb
> reference names. The relevant function to modify is
> `org-babel-merge-params'
I like the idea. Thanks for the hint, I'll try that out!
Best,
Théo
next prev parent reply other threads:[~2023-02-26 18:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-09 10:01 Multiple noweb-ref Théo Maxime Tyburn
2023-02-20 14:23 ` Ihor Radchenko
2023-02-26 18:51 ` Théo Maxime Tyburn [this message]
2023-03-03 16:49 ` Ihor Radchenko
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=87356sl0in.fsf@gmail.com \
--to=theo.tyburn@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.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).