Re: Org babel noweb expansion includes extra newline

2022-10-23 Thread Ihor Radchenko
pareto optimal  writes:

> #+RESULTS:
> #+begin_example
> "git ls-files ~/system/users/profiles/emacs/default.nix
> git ls-files ~/system/users/profiles/emacs/emacs-packages.nix
> git ls-files ~/system/users/profiles/chat/default.nix
> git ls-files ~/system/profiles/misc/default.nix
> git ls-files "
> #+end_example
> *** here's what hapepns if we just run =all-tangled-filepaths=
>
> ...
> #+name: files-to-remove-from-git
> #+begin_src sh :noweb yes :dir ~/system
> git ls-files <>
> #+end_src

This is because noweb automatically appends text before <<...>> to each
line of multi-line noweb expansions.
See https://orgmode.org/manual/Noweb-Reference-Syntax.html

On the latest Org, this behaviour can be disabled using :noweb-prefix no
header argument.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Org babel noweb expansion includes extra newline

2022-02-02 Thread pareto optimal
Hi, I hope this org file is descriptive enough along with the subject.

I'm using org 9.5.2.

I believe it might be a bug since the results of calling 
=all-tangled-filepaths= only has 4 results, so the =org-babel-expand-src-block= 
function might have a bug.

* Show files I tangle and could delete from git
** currently not working and outputting weird stuff
*** The expansion seems to include an empty result for some reason

#+begin_src emacs-lisp :results verbatim
  (save-excursion
    (progn
  (goto-char
   (org-babel-find-named-block "files-to-remove-from-git"))
  (org-babel-expand-src-block)
  ))
#+end_src

#+RESULTS:
#+begin_example
"git ls-files ~/system/users/profiles/emacs/default.nix
git ls-files ~/system/users/profiles/emacs/emacs-packages.nix
git ls-files ~/system/users/profiles/chat/default.nix
git ls-files ~/system/profiles/misc/default.nix
git ls-files "
#+end_example
*** here's what hapepns if we just run =all-tangled-filepaths=

#+call: all-tangled-filepaths()

#+RESULTS:
: ~/system/users/profiles/emacs/default.nix
: ~/system/users/profiles/emacs/emacs-packages.nix
: ~/system/users/profiles/chat/default.nix
: ~/system/profiles/misc/default.nix

** get tangled blocks

#+name: all-tangled-filepaths
#+begin_src sh :results output
rg -N -o  ' :tangle ([^yesno][^ ]+)' -r '$1' ~/.emacs.d/system.org  | rg 
'/system/'
#+end_src

** pass those to git-ls-files

#+name: files-to-remove-from-git
#+begin_src sh :noweb yes :dir ~/system
git ls-files <>
#+end_src

-- Sent with https://mailfence.com  Secure and private email