emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: zacque <technical@zacque.tk>
To: emacs-orgmode@gnu.org
Subject: Tangle Source Block Only to a Specific Location/Target in a File
Date: Sat, 05 Mar 2022 06:50:58 +0800	[thread overview]
Message-ID: <87czj1tjbn.fsf@zacque.tk> (raw)

Hi,

I want to tangle a source block only to a specific location in a file, without modifying the rest of its content. E.g. given this source block:

#+begin_src emacs-lisp :noweb yes :tangle /path/to/foo :target-name <<target_name>>
(+ 1 2 3)
(print "Hello, world")
<<others>>
#+end_src

Upon tangled, the "foo" contents will change from this:

#+begin_src emacs-lisp
...
(with-eval-after-load 'bar
  ...
  ;; BEGIN RECEIVE ORGSRC <<target_name>>
  ;; END RECEIVE ORGSRC <<target_name>>
  ...)
...
#+end_src

to

#+begin_src emacs-lisp
...
(with-eval-after-load 'bar
  ...
  ;; BEGIN RECEIVE ORGSRC <<target_name>>
  (+ 1 2 3)
  (print "Hello, world")
  <<expanded_others>>
  ;; END RECEIVE ORGSRC <<target_name>>
  ...)
...
#+end_src

Note: The target syntax in the target file imitates the syntax for receiving
radio tables on purpose.

Is there any idea how I can achieve this?

-- 
Cheers,
zacque


                 reply	other threads:[~2022-03-05  7:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87czj1tjbn.fsf@zacque.tk \
    --to=technical@zacque.tk \
    --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).