all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Org babel noweb expansion includes extra newline
@ 2022-02-03  2:03 pareto optimal
  2022-10-23  5:29 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: pareto optimal @ 2022-02-03  2:03 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1666 bytes --]

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 <<all-tangled-filepaths()>>
#+end_src

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

[-- Attachment #2: Type: text/html, Size: 2021 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Org babel noweb expansion includes extra newline
  2022-02-03  2:03 Org babel noweb expansion includes extra newline pareto optimal
@ 2022-10-23  5:29 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2022-10-23  5:29 UTC (permalink / raw)
  To: pareto optimal; +Cc: emacs-orgmode

pareto optimal <pareto.optimal@mailfence.com> 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 <<all-tangled-filepaths()>>
> #+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 <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-24  5:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-03  2:03 Org babel noweb expansion includes extra newline pareto optimal
2022-10-23  5:29 ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.