[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Add light argument to org-babel-lob-get-info
From: |
Ferdinand Pieper |
Subject: |
[PATCH] Add light argument to org-babel-lob-get-info |
Date: |
Sun, 16 Oct 2022 14:17:51 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Similar to ~org-babel-get-src-block-info~ it is sometimes useful to disable
evaluation of lisp parameters when getting the info of a lob call. This patch
adds an argument for that.
Better name for the argument could be ~no-eval~, but I decided to stick with
the naming in ~org-babel-get-src-block-info~. To be completely consistent with
~org-babel-get-src-block-info~ the argument order could be swapped, but this
would break existing function calls.
What do you think?
Best,
Ferdinand
>From ba8069a3b83489ee1de8c4eeba059883809d0ea7 Mon Sep 17 00:00:00 2001
From: fpi <git@pie.tf>
Date: Sun, 16 Oct 2022 13:17:40 +0200
Subject: [PATCH] org-babel-lob-get-info: Add light argument
* lisp/ob-lob.el (org-babel-lob-get-info): Add light argument to
prevent recursive evaluation of lisp values in parameters.
---
lisp/ob-exp.el | 2 +-
lisp/ob-lob.el | 13 +++++++++----
lisp/ob-ref.el | 2 +-
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index e9b304b86..83dd5fc74 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -25,7 +25,7 @@
;;; Code:
(require 'ob-core)
-(declare-function org-babel-lob-get-info "ob-lob" (&optional datum))
+(declare-function org-babel-lob-get-info "ob-lob" (&optional datum light))
(declare-function org-element-at-point "org-element" ())
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-property "org-element" (property element))
diff --git a/lisp/ob-lob.el b/lisp/ob-lob.el
index 903dabfbd..3043ff647 100644
--- a/lisp/ob-lob.el
+++ b/lisp/ob-lob.el
@@ -114,11 +114,16 @@ after REF in the Library of Babel."
(cdr (assoc-string ref org-babel-library-of-babel))))))))
;;;###autoload
-(defun org-babel-lob-get-info (&optional datum)
+(defun org-babel-lob-get-info (&optional datum light)
"Return internal representation for Library of Babel function call.
Consider DATUM, when provided, or element at point otherwise.
+When optional argument LIGHT is non-nil, Babel does not resolve
+remote variable references; a process which could likely result
+in the execution of other code blocks, and do not evaluate Lisp
+values in parameters.
+
Return nil when not on an appropriate location. Otherwise return
a list compatible with `org-babel-get-src-block-info', which
see."
@@ -139,16 +144,16 @@ see."
org-babel-default-lob-header-args
(append
(org-with-point-at begin
- (org-babel-params-from-properties language))
+ (org-babel-params-from-properties language light))
(list
(org-babel-parse-header-arguments
- (org-element-property :inside-header context))
+ (org-element-property :inside-header context) light)
(let ((args (org-element-property :arguments
context)))
(and args
(mapcar (lambda (ref) (cons :var ref))
(org-babel-ref-split-args args))))
(org-babel-parse-header-arguments
- (org-element-property :end-header context)))))
+ (org-element-property :end-header context) light))))
nil
(org-element-property :name context)
begin
diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el
index a7ab299b2..a7cdb22e1 100644
--- a/lisp/ob-ref.el
+++ b/lisp/ob-ref.el
@@ -53,7 +53,7 @@
(require 'org-macs)
(require 'cl-lib)
-(declare-function org-babel-lob-get-info "ob-lob" (&optional datum))
+(declare-function org-babel-lob-get-info "ob-lob" (&optional datum light))
(declare-function org-element-at-point "org-element" ())
(declare-function org-element-property "org-element" (property element))
(declare-function org-element-type "org-element" (element))
--
2.20.1
- [PATCH] Add light argument to org-babel-lob-get-info,
Ferdinand Pieper <=
- Re: [PATCH] Add light argument to org-babel-lob-get-info, Ihor Radchenko, 2022/10/17
- Re: [PATCH] Add light argument to org-babel-lob-get-info, Ferdinand Pieper, 2022/10/18
- Re: [PATCH] Add light argument to org-babel-lob-get-info, Ihor Radchenko, 2022/10/19
- Possible bugs in org-babel-temp-stable-file (was: [PATCH] Add light argument to org-babel-lob-get-info), Ferdinand Pieper, 2022/10/22
- Re: Possible bugs in org-babel-temp-stable-file (was: [PATCH] Add light argument to org-babel-lob-get-info), Ihor Radchenko, 2022/10/23
- Re: Possible bugs in org-babel-temp-stable-file, Ferdinand Pieper, 2022/10/23
- Re: Possible bugs in org-babel-temp-stable-file, Ihor Radchenko, 2022/10/24
- Re: Possible bugs in org-babel-temp-stable-file, Ferdinand Pieper, 2022/10/24
- Re: Possible bugs in org-babel-temp-stable-file, Ihor Radchenko, 2022/10/24