emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tangle Source Block Only to a Specific Location/Target in a File


From: zacque
Subject: Tangle Source Block Only to a Specific Location/Target in a File
Date: Sat, 05 Mar 2022 06:50:58 +0800
User-agent: mu4e 1.6.10; emacs 27.2

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 via email to

[Prev in Thread] Current Thread [Next in Thread]