forked from mirrors/org-mode
ob-exp: Restore evaluation query for lob calls during export
* lisp/ob-exp.el (org-babel-exp-results): Fix a regression from v9.0 that led to silently executing lob calls on export despite a non-nil value of org-confirm-babel-evaluate. * testing/lisp/test-ob-lob.el (test-ob-lob/confirm-evaluate): New test.56bf3d789
(Babel: avoid superfluous confirmation for internal wrapper, 2013-04-10) let-bound org-confirm-babel-evaluate to nil in two spots to prevent double querying for lob calls. These overrides were no longer needed following the refactoring indbb375fdf
(Simplify Babel calls evaluation, 2016-06-16). However, that commit dropped only one of the spots, and, as a result, disabled confirmation unconditionally when exporting lob calls. Drop the remaining org-confirm-babel-evaluate override. Reported-by: 吴锐扬 <ywwry66@gmail.com> Ref: https://orgmode.org/list/5362C0A0-632F-4C87-8FA1-915F0F53D8B8@gmail.com
This commit is contained in:
parent
e8070d71ab
commit
20374f69e8
|
@ -405,8 +405,7 @@ inhibit insertion of results into the buffer."
|
|||
(`lob
|
||||
(save-excursion
|
||||
(goto-char (nth 5 info))
|
||||
(let (org-confirm-babel-evaluate)
|
||||
(org-babel-execute-src-block nil info)))))))))
|
||||
(org-babel-execute-src-block nil info))))))))
|
||||
|
||||
(provide 'ob-exp)
|
||||
|
||||
|
|
|
@ -250,6 +250,34 @@ call_test-newline[:eval yes :results raw]('(1\n2))<point>"
|
|||
<point>#+call: bar()"
|
||||
(org-babel-execute-src-block nil (org-babel-lob-get-info))))))
|
||||
|
||||
(ert-deftest test-ob-lob/confirm-evaluate ()
|
||||
"Test confirmation when exporting lob calls."
|
||||
;; With the default `org-confirm-babel-evaluate' of t, the caller is
|
||||
;; queried one time.
|
||||
(should
|
||||
(= 1
|
||||
(let ((org-export-use-babel t)
|
||||
(org-confirm-babel-evaluate t)
|
||||
(confirm-evaluate-calls 0))
|
||||
(cl-letf (((symbol-function 'yes-or-no-p)
|
||||
(lambda (&rest _ignore)
|
||||
(cl-incf confirm-evaluate-calls)
|
||||
t)))
|
||||
(org-test-with-temp-text
|
||||
"
|
||||
#+name: foo
|
||||
#+begin_src emacs-lisp
|
||||
nil
|
||||
#+end_src
|
||||
|
||||
#+call: foo()"
|
||||
(let ((string (buffer-string)))
|
||||
(with-temp-buffer
|
||||
(org-mode)
|
||||
(insert string)
|
||||
(org-babel-exp-process-buffer)
|
||||
confirm-evaluate-calls))))))))
|
||||
|
||||
(provide 'test-ob-lob)
|
||||
|
||||
;;; test-ob-lob.el ends here
|
||||
|
|
Loading…
Reference in New Issue