1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-21 06:55:35 +00:00

org-babel: Avoid changing user options by not sharing list structure

* lisp/ob-core.el (org-babel-get-src-block-info): Use `copy-tree'
when using `org-babel-default-header-args*' variables to prepare the
`info' variable used in src block evaluation. The `info' variable gets
modified, and the modifications were affecting the values of the user
variables. In particular, the `:file' setting was modified in the presence
of a `:output-dir' setting, concatenating more and more copies of the directory
every time the block was evaluated.

Reported-by: @lyndhurst on SE Emacs
Link: https://emacs.stackexchange.com/questions/82261/
This commit is contained in:
Nick Dokos 2024-09-28 15:39:25 -04:00 committed by Ihor Radchenko
parent eb6d70f817
commit b457dbfe5a
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -731,9 +731,17 @@ Otherwise, return a list with the following pattern:
lang
(org-babel--normalize-body datum)
(apply #'org-babel-merge-params
(if inline org-babel-default-inline-header-args
org-babel-default-header-args)
(and (boundp lang-headers) (eval lang-headers t))
;; Use `copy-tree' to avoid creating shared structure
;; with the `org-babel-default-header-args-*' variables:
;; modifications by `org-babel-generate-file-param'
;; below would modify the shared structure, thereby
;; modifying the variables.
(copy-tree
(if inline org-babel-default-inline-header-args
org-babel-default-header-args)
t)
(and (boundp lang-headers)
(copy-tree (eval lang-headers t) t))
(append
;; If DATUM is provided, make sure we get node
;; properties applicable to its location within