emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Chen Mingzheng" <chen.mingzheng@outlook.com>
To: emacs-orgmode@gnu.org
Subject: [FR] Add whitespace option for :noweb-prefix
Date: Mon, 25 Mar 2024 17:01:36 +0800	[thread overview]
Message-ID: <TYYP286MB28997BD7905091D470F1F64B81362@TYYP286MB2899.JPNP286.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <87a5mrlnsa.fsf@localhost> (Ihor Radchenko's message of "Thu, 21 Mar 2024 13:25:41 +0000")


Hi


For :noweb-prefix of noweb feature, now we have "yes" or "no" option.
Can we add a new "whitespace" option so that we can:

Giving following fragments,
  #+begin_src elisp :noweb-ref varable-bindings
  (a 0)
  (b 1)
  #+end_src

  #+begin_src elisp :noweb-ref do-something
  `(,a ,b)
  #+end_src

we use the "whitespace" option here
  #+name: a-fragment
  #+begin_src elisp :noweb yes :noweb-prefix whitespace
    (let (<<varable-bindings>>)
      <<do-something>>)
  #+end_src

to produce the follow code:
  #+begin_src elisp
  (let ((a 0)
        (b 1))
    `(,a ,b))
  #+end_src


Here is a try:
  #+begin_src elisp :exports results :wrap src elisp
  (org-babel--expand-body (org-babel-lob--src-info "a-fragment"))
  #+end_src
BTW, I'm curious if there's an public API that can output the code expansion of an noweb src block by it's name like above?


Best regards,

Chen


      reply	other threads:[~2024-03-28 13:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-17 20:22 Org-attach risks Kepa
2024-03-20 12:20 ` Ihor Radchenko
     [not found]   ` <171096963729.7.13315176883660452357.290626130@slmails.com>
2024-03-21 13:25     ` [FR] Add customization for default answers to `org-attach-set/unset-directory' prompt (was: Org-attach risks) Ihor Radchenko
2024-03-25  9:01       ` Chen Mingzheng [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=TYYP286MB28997BD7905091D470F1F64B81362@TYYP286MB2899.JPNP286.PROD.OUTLOOK.COM \
    --to=chen.mingzheng@outlook.com \
    --cc=emacs-orgmode@gnu.org \
    /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).