[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Persisting the current working directory in an org-babel session
From: |
Ihor Radchenko |
Subject: |
Re: Persisting the current working directory in an org-babel session |
Date: |
Sun, 01 Jan 2023 13:19:41 +0000 |
Adam Sneller <adam@earth2adam.com> writes:
> For some reason, I am unable to make changes to my working directory persist,
> from one emacs-lisp SRC block to the next.
>
> For example, consider the following:
>
> * Literate programming in a single session
> :PROPERTIES:
> :header-args: :var DIR="/Users/adam/Desktop/test"
> :END:
>
> #+BEGIN_SRC emacs-lisp :session *elisp*
> (cd DIR)
> #+END_SRC
>
> #+RESULTS:
> : /Users/adam/Desktop/test/
>
>
> #+BEGIN_SRC emacs-lisp :session *elisp*
> (cd ".")
> #+END_SRC
>
> #+RESULTS:
> : /Users/adam/org/
Confirmed.
This is because `org-babel-execute-src-block' let-binds
`default-directory'. So, your changes to it are only affecting lexical
scope.
Fixes welcome!
--
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>