emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org babel source blocks ignore buffer-local variables
@ 2021-09-04 12:30 Dominik Schrempf
  2021-09-04 17:14 ` Berry, Charles via General discussions about Org-mode.
  0 siblings, 1 reply; 4+ messages in thread
From: Dominik Schrempf @ 2021-09-04 12:30 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I use directory local environments with =envrc= [1], and run into trouble when
using (Bash) Org Babel source code blocks. The buffer local environment seems to
be ignored (see the example at the bottom).

This seems to have been discussed in the course of a GitHub issue of
=inheritenv= [2], which is pulled in by =envrc=. Also, on this mailing list,
there was a short discussion [3].

Do you have any thoughts on this? Is there an easy way to make Org Babel source
blocks honor buffer local setups?

Thank you!
Dominik

#+name: Scratch
#+begin_src sh :exports both :results output verbatim
function path () { echo "$PATH" | tr ':' '\n'; }
path
#+end_src

#+RESULTS: Scratch
#+begin_example
/home/dominik/Evolutionary-Biology/Scripts/nix-flakes
/home/dominik/Evolutionary-Biology/Scripts
/home/dominik/bin/nix-flakes
/home/dominik/bin
/run/wrappers/bin
/home/dominik/.nix-profile/bin
/etc/profiles/per-user/dominik/bin
/nix/var/nix/profiles/default/bin
/run/current-system/sw/bin
/nix/store/3l9lddwxz1mayaxvw8iy50ygzzfh1s1b-emacs-27.2/libexec/emacs/27.2/x86_64-pc-linux-gnu
#+end_example

The Emacs =exec-path= variable has the following value:

#+begin_quote
exec-path is a variable defined in ‘C source code’.
Its value is
("/nix/store/cnxncxyghj3gfpfvng6z4l8k4hfl48wq-ghc-8.10.6-with-packages/bin/" "/nix/store/435paza0j48aa9vgvf6r2l12nrg4ld11-patchelf-0.12/bin/" "/nix/store/4xs1xyj8728yvh9y5v6ji819kwgfy2fv-gcc-wrapper-10.3.0/bin/" "/nix/store/dlni53myj53kx20pi4yhm7p68lw17b07-gcc-10.3.0/bin/" "/nix/store/6z35qvn00xrjvaznv9kfy8xddbbdz4gl-glibc-2.33-47-bin/bin/" "/nix/store/1570w56jrkvr90w9x158vyb5vahnk18v-coreutils-8.32/bin/" "/nix/store/29bjq5hw1qglybp1a5f3ij9gxc2fyf94-binutils-wrapper-2.35.1/bin/" "/nix/store/v8imx1nvyz0hgvx9cbcmh6gp4ngw3ffj-binutils-2.35.1/bin/" "/nix/store/iz7bgfvjmwdz3vgmzryhfkqwbn8zr2jn-ncurses-6.2/bin/" "/nix/store/w07a7k61dw5gnsyxj3kgcq3shr76jax8-bash-interactive-4.4-p23/bin/" "/nix/store/xhxll8hx0x9szhlvvd8h1c35glszlj34-cabal-install-3.4.0.0/bin/" "/nix/store/gbxdjp9z1bjx1zl6icckw093yv0vn21r-haskell-language-server-1.2.0.0/bin/" "/nix/store/mx8v4f0hq8nff5ab7mcgmmbxn5rk6al4-aeson-pretty-0.8.8/bin/" "/nix/store/xygkar338ssrwqjcpmmbv1pkkpqc1yfy-ghc-8.10.6/bin/" "/nix/store/w16zhm17a73sn3sshqgpxjk3r265vb9l-ghcide-1.4.0.3/bin/" "/nix/store/isja3hvzjmmg7278mdsyyn0k4s7k6cf8-constraints-extras-0.3.1.0/bin/" "/nix/store/9kz9pwpgnq4miywf5bk97xpn4qqz1h2c-hie-bios-0.7.5/bin/" "/nix/store/wfpjw96bjc1kwx5spddwgpi8r4jrbc6b-hiedb-0.4.0.0/bin/" "/nix/store/il7l9fjr7r0sq00iy0jr6pcwcb97227p-shake-0.19.5/bin/" "/nix/store/9i7z6c6ydhkw1ch37hvpi6fywbfkyrm0-implicit-hie-0.1.2.6/bin/" "/nix/store/88kdasbl46rhfnz249dxnh5n9amr27pv-retrie-1.0.0.0/bin/" "/nix/store/i7djw6911qk0vkkxv5rsm2zh95arfmjp-brittany-0.13.1.2/bin/" "/nix/store/5mpyw1f5jamnvnhsawj147vyvwpw054s-floskell-0.10.5/bin/" "/nix/store/aj2q5q38wzlsl60vwcxirlc133p3i8hj-fourmolu-0.3.0.0/bin/" "/nix/store/mr0algmndmq73ybhnk3752ylhpnp7918-apply-refact-0.9.3.0/bin/" "/nix/store/k9h1adjqqwmq39iik3253cgxdd5drgz8-hlint-3.2.7/bin/" "/nix/store/rdjb7sx4clhzjfal0xhb41x1k62nchf0-cpphs-1.20.9.1/bin/" "/nix/store/wlh74ffhf19ychrcf65885jsx8xy5f8d-hscolour-1.24.4/bin/" "/nix/store/1lbb1bzjqcblb946av3703g76ng18jx1-ormolu-0.1.4.1-bin/bin/" "/nix/store/jvx2rcmbcrjpsvz4p8z5zll4gchmhl75-stylish-haskell-0.12.2.0/bin/" "/nix/store/h0yyp8i85y3cahd1wyxb0a0izxqz2gxj-stack-2.7.3/bin/" "/nix/store/62m5yxq7f9gz4xn3qlvkvkna237vz92k-hpack-0.34.4/bin/" "/nix/store/ki59g3c2y2ahpjja9hch3wxgl7gki5f3-mustache-2.3.1/bin/" "/nix/store/1wdm2g4mz9is77iihfkbycq3m8c2frrv-open-browser-0.2.1.0/bin/" "/nix/store/1570w56jrkvr90w9x158vyb5vahnk18v-coreutils-8.32/bin/" "/nix/store/ihxk2vlm0vi7c4j3gpm084kbxvz6v585-findutils-4.8.0/bin/" "/nix/store/kjx1mv85c5cgsrr4bwar22j7hbwj834m-diffutils-3.7/bin/" "/nix/store/gm2w08wwsa3vd500d8vq879s2lv65ldh-gnused-4.8/bin/" "/nix/store/v0slhpb2y3xa7gmv4q6gblkdk7n0f09j-gnugrep-3.6/bin/" "/nix/store/2wn093wbc6ps4brcsppxjd14vxvaa8a2-gawk-5.1.0/bin/" "/nix/store/5bxrjkyvqmzn1p897652y3lwa9fxagpw-gnutar-1.34/bin/" "/nix/store/liva1jnjdskrn57s42kfawr2zz66szzm-gzip-1.10/bin/" "/nix/store/ih2zkh2mbrx2c766ryk2i9hhlkly7snr-bzip2-1.0.6.0.2-bin/bin/" "/nix/store/pvkiiw0mp1yx0b21b7k105yywccychgh-gnumake-4.3/bin/" "/nix/store/dpjnjrqbgbm8a5wvi1hya01vd8wyvsq4-bash-4.4-p23/bin/" "/nix/store/aicl3kwfnaizk45aygm8bviqv7lk0a16-patch-2.7.6/bin/" "/nix/store/7jk6k46f56rszzc1bxi8mdrvcw53pym4-xz-5.2.5-bin/bin/" "/home/dominik/Evolutionary-Biology/Scripts/nix-flakes/" "/home/dominik/Evolutionary-Biology/Scripts/" "/home/dominik/bin/nix-flakes/" "/home/dominik/bin/" "/run/wrappers/bin/" "/home/dominik/.nix-profile/bin/" "/etc/profiles/per-user/dominik/bin/" "/nix/var/nix/profiles/default/bin/" "/run/current-system/sw/bin/" "/nix/store/3l9lddwxz1mayaxvw8iy50ygzzfh1s1b-emacs-27.2/libexec/emacs/27.2/x86_64-pc-linux-gnu/")
Original value was 
("/nix/store/cnxncxyghj3gfpfvng6z4l8k4hfl48wq-ghc-8.10.6-with-packages/bin" "/nix/store/435paza0j48aa9vgvf6r2l12nrg4ld11-patchelf-0.12/bin" "/nix/store/4xs1xyj8728yvh9y5v6ji819kwgfy2fv-gcc-wrapper-10.3.0/bin" "/nix/store/dlni53myj53kx20pi4yhm7p68lw17b07-gcc-10.3.0/bin" "/nix/store/6z35qvn00xrjvaznv9kfy8xddbbdz4gl-glibc-2.33-47-bin/bin" "/nix/store/1570w56jrkvr90w9x158vyb5vahnk18v-coreutils-8.32/bin" "/nix/store/29bjq5hw1qglybp1a5f3ij9gxc2fyf94-binutils-wrapper-2.35.1/bin" "/nix/store/v8imx1nvyz0hgvx9cbcmh6gp4ngw3ffj-binutils-2.35.1/bin" "/nix/store/iz7bgfvjmwdz3vgmzryhfkqwbn8zr2jn-ncurses-6.2/bin" "/nix/store/w07a7k61dw5gnsyxj3kgcq3shr76jax8-bash-interactive-4.4-p23/bin" "/nix/store/xhxll8hx0x9szhlvvd8h1c35glszlj34-cabal-install-3.4.0.0/bin" "/nix/store/gbxdjp9z1bjx1zl6icckw093yv0vn21r-haskell-language-server-1.2.0.0/bin" "/nix/store/mx8v4f0hq8nff5ab7mcgmmbxn5rk6al4-aeson-pretty-0.8.8/bin" "/nix/store/xygkar338ssrwqjcpmmbv1pkkpqc1yfy-ghc-8.10.6/bin" "/nix/store/w16zhm17a73sn3sshqgpxjk3r265vb9l-ghcide-1.4.0.3/bin" "/nix/store/isja3hvzjmmg7278mdsyyn0k4s7k6cf8-constraints-extras-0.3.1.0/bin" "/nix/store/9kz9pwpgnq4miywf5bk97xpn4qqz1h2c-hie-bios-0.7.5/bin" "/nix/store/wfpjw96bjc1kwx5spddwgpi8r4jrbc6b-hiedb-0.4.0.0/bin" "/nix/store/il7l9fjr7r0sq00iy0jr6pcwcb97227p-shake-0.19.5/bin" "/nix/store/9i7z6c6ydhkw1ch37hvpi6fywbfkyrm0-implicit-hie-0.1.2.6/bin" "/nix/store/88kdasbl46rhfnz249dxnh5n9amr27pv-retrie-1.0.0.0/bin" "/nix/store/i7djw6911qk0vkkxv5rsm2zh95arfmjp-brittany-0.13.1.2/bin" "/nix/store/5mpyw1f5jamnvnhsawj147vyvwpw054s-floskell-0.10.5/bin" "/nix/store/aj2q5q38wzlsl60vwcxirlc133p3i8hj-fourmolu-0.3.0.0/bin" "/nix/store/mr0algmndmq73ybhnk3752ylhpnp7918-apply-refact-0.9.3.0/bin" "/nix/store/k9h1adjqqwmq39iik3253cgxdd5drgz8-hlint-3.2.7/bin" "/nix/store/rdjb7sx4clhzjfal0xhb41x1k62nchf0-cpphs-1.20.9.1/bin" "/nix/store/wlh74ffhf19ychrcf65885jsx8xy5f8d-hscolour-1.24.4/bin" "/nix/store/1lbb1bzjqcblb946av3703g76ng18jx1-ormolu-0.1.4.1-bin/bin" "/nix/store/jvx2rcmbcrjpsvz4p8z5zll4gchmhl75-stylish-haskell-0.12.2.0/bin" "/nix/store/h0yyp8i85y3cahd1wyxb0a0izxqz2gxj-stack-2.7.3/bin" "/nix/store/62m5yxq7f9gz4xn3qlvkvkna237vz92k-hpack-0.34.4/bin" "/nix/store/ki59g3c2y2ahpjja9hch3wxgl7gki5f3-mustache-2.3.1/bin" "/nix/store/1wdm2g4mz9is77iihfkbycq3m8c2frrv-open-browser-0.2.1.0/bin" "/nix/store/1570w56jrkvr90w9x158vyb5vahnk18v-coreutils-8.32/bin" "/nix/store/ihxk2vlm0vi7c4j3gpm084kbxvz6v585-findutils-4.8.0/bin" "/nix/store/kjx1mv85c5cgsrr4bwar22j7hbwj834m-diffutils-3.7/bin" "/nix/store/gm2w08wwsa3vd500d8vq879s2lv65ldh-gnused-4.8/bin" "/nix/store/v0slhpb2y3xa7gmv4q6gblkdk7n0f09j-gnugrep-3.6/bin" "/nix/store/2wn093wbc6ps4brcsppxjd14vxvaa8a2-gawk-5.1.0/bin" "/nix/store/5bxrjkyvqmzn1p897652y3lwa9fxagpw-gnutar-1.34/bin" "/nix/store/liva1jnjdskrn57s42kfawr2zz66szzm-gzip-1.10/bin" "/nix/store/ih2zkh2mbrx2c766ryk2i9hhlkly7snr-bzip2-1.0.6.0.2-bin/bin" "/nix/store/pvkiiw0mp1yx0b21b7k105yywccychgh-gnumake-4.3/bin" "/nix/store/dpjnjrqbgbm8a5wvi1hya01vd8wyvsq4-bash-4.4-p23/bin" "/nix/store/aicl3kwfnaizk45aygm8bviqv7lk0a16-patch-2.7.6/bin" "/nix/store/7jk6k46f56rszzc1bxi8mdrvcw53pym4-xz-5.2.5-bin/bin" "/home/dominik/Evolutionary-Biology/Scripts/nix-flakes" "/home/dominik/Evolutionary-Biology/Scripts" "/home/dominik/bin/nix-flakes" "/home/dominik/bin" "/run/wrappers/bin" "/home/dominik/.nix-profile/bin" "/etc/profiles/per-user/dominik/bin" "/nix/var/nix/profiles/default/bin" "/run/current-system/sw/bin" "/nix/store/3l9lddwxz1mayaxvw8iy50ygzzfh1s1b-emacs-27.2/libexec/emacs/27.2/x86_64-pc-linux-gnu" "/nix/store/3l9lddwxz1mayaxvw8iy50ygzzfh1s1b-emacs-27.2/libexec/emacs/27.2/x86_64-pc-linux-gnu")
Local in buffer README.org; global value is 
("/home/dominik/Evolutionary-Biology/Scripts/nix-flakes" "/home/dominik/Evolutionary-Biology/Scripts" "/home/dominik/bin/nix-flakes" "/home/dominik/bin" "/run/wrappers/bin" "/home/dominik/.nix-profile/bin" "/etc/profiles/per-user/dominik/bin" "/nix/var/nix/profiles/default/bin" "/run/current-system/sw/bin" "/nix/store/3l9lddwxz1mayaxvw8iy50ygzzfh1s1b-emacs-27.2/libexec/emacs/27.2/x86_64-pc-linux-gnu")
#+end_quote

[1] https://github.com/purcell/envrc
[2] https://github.com/purcell/inheritenv/issues/4
[3] https://orgmode.org/list/3d3611c4-17a6-4d55-875b-f566c28d297b@www.fastmail.com/


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

end of thread, other threads:[~2021-09-06 18:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-04 12:30 Org babel source blocks ignore buffer-local variables Dominik Schrempf
2021-09-04 17:14 ` Berry, Charles via General discussions about Org-mode.
2021-09-06  8:53   ` Dominik Schrempf
2021-09-06 18:32     ` Berry, Charles via General discussions about Org-mode.

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).