Ihor Radchenko <yanta...@posteo.net> 于2024年3月29日周五 03:25写道:
>
> Doerthous <doerth...@gmail.com> writes:
>
> > Can we add a support for whitespace prefix such that the prefix of a
> > noweb-ref replaced by whitespace characters?
> >
> > ...
> > #+name: a-fragment
> > #+begin_src elisp :noweb yes :noweb-prefix whitespace
> >   (let (<<varable-bindings>>)
> >     <<do-something>>)
> > #+end_src
> >
> > using whitespace :noweb-prefix, the above code will expand to
> >
> > #+begin_src elisp
> > (let ((a 0)
> >       (b 1))
> >   `(,a ,b))
> > #+end_src
>
> Do you mean that you want the code to be indented according to the major
> mode rules?
>

Why it relates to major mode,

Currently, with :noweb-prefix set to yes, the above code will be expand to
#+begin_src elisp
(let ((a 0)
(let ((b 1))
   `(,a ,b))
#+end_src

~(let (~ is the prefix of <<varable-bindings>>.

I thought we can replace just the prefix in current code[1]  with
~(setq prefix (replace-regexp-in-string "[^ \t]" " " prefix))~ ?

[1] lisp/ob-core.el (org-babel-expand-noweb-references) @ 9.6.23

Reply via email to