>From 015ce9ef56c997331ea34957d47fa98efffb54a3 Mon Sep 17 00:00:00 2001 From: fpi Date: Tue, 18 Oct 2022 17:34:18 +0200 Subject: [PATCH 2/2] org-babel-get-src-block-info: Rename light argument * lisp/ob-core.el (org-babel-get-src-block-info): Rename argument light to no-eval. --- lisp/ob-core.el | 20 ++++++++++---------- lisp/ob-lob.el | 2 +- lisp/ob-tangle.el | 6 +++--- lisp/org-pcomplete.el | 4 ++-- lisp/org-src.el | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index f273fa92e..c725a5508 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -339,7 +339,7 @@ then run `org-babel-execute-src-block'." This includes header arguments, language and name, and is largely a window into the `org-babel-get-src-block-info' function." (interactive) - (let ((info (org-babel-get-src-block-info 'light)) + (let ((info (org-babel-get-src-block-info 'no-eval)) (full (lambda (it) (> (length it) 0))) (printf (lambda (fmt &rest args) (princ (apply #'format fmt args))))) (when info @@ -640,10 +640,10 @@ the list of header arguments." (push elem lst))) (reverse lst))) -(defun org-babel-get-src-block-info (&optional light datum) +(defun org-babel-get-src-block-info (&optional no-eval datum) "Extract information from a source block or inline source block. -When optional argument LIGHT is non-nil, Babel does not resolve +When optional argument NO-EVAL 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. @@ -677,9 +677,9 @@ a list with the following pattern: ;; properties applicable to its location within ;; the document. (org-with-point-at (org-element-property :begin datum) - (org-babel-params-from-properties lang light)) + (org-babel-params-from-properties lang no-eval)) (mapcar (lambda (h) - (org-babel-parse-header-arguments h light)) + (org-babel-parse-header-arguments h no-eval)) (cons (org-element-property :parameters datum) (org-element-property :header datum))))) (or (org-element-property :switches datum) "") @@ -687,7 +687,7 @@ a list with the following pattern: (org-element-property (if inline :begin :post-affiliated) datum) (and (not inline) (org-src-coderef-format datum))))) - (unless light + (unless no-eval (setf (nth 2 info) (org-babel-process-params (nth 2 info)))) (setf (nth 2 info) (org-babel-generate-file-param name (nth 2 info))) info)))) @@ -933,7 +933,7 @@ arguments and pop open the results in a preview buffer." (defun org-babel-insert-header-arg (&optional header-arg value) "Insert a header argument selecting from lists of common args and values." (interactive) - (let* ((info (org-babel-get-src-block-info 'light)) + (let* ((info (org-babel-get-src-block-info 'no-eval)) (lang (car info)) (begin (nth 5 info)) (lang-headers (intern (concat "org-babel-header-args:" lang))) @@ -1130,7 +1130,7 @@ code block, otherwise return nil. With optional prefix argument RE-RUN the source-code block is evaluated even if results already exist." (interactive "P") - (pcase (org-babel-get-src-block-info 'light) + (pcase (org-babel-get-src-block-info 'no-eval) (`(,_ ,_ ,arguments ,_ ,_ ,start ,_) (save-excursion ;; Go to the results, if there aren't any then run the block. @@ -1967,7 +1967,7 @@ split. When called from outside of a code block a new code block is created. In both cases if the region is demarcated and if the region is not active then the point is demarcated." (interactive "P") - (let* ((info (org-babel-get-src-block-info 'light)) + (let* ((info (org-babel-get-src-block-info 'no-eval)) (start (org-babel-where-is-src-block-head)) (block (and start (match-string 0))) (headers (and start (match-string 4))) @@ -2916,7 +2916,7 @@ would set the value of argument \"a\" equal to \"9\". Note that these arguments are not evaluated in the current source-code block but are passed literally to the \"example-block\"." (let* ((parent-buffer (or parent-buffer (current-buffer))) - (info (or info (org-babel-get-src-block-info 'light))) + (info (or info (org-babel-get-src-block-info 'no-eval))) (lang (nth 0 info)) (body (nth 1 info)) (comment (string= "noweb" (cdr (assq :comments (nth 2 info))))) diff --git a/lisp/ob-lob.el b/lisp/ob-lob.el index 10822accb..e4766a7d1 100644 --- a/lisp/ob-lob.el +++ b/lisp/ob-lob.el @@ -54,7 +54,7 @@ should not be inherited from a source block.") (interactive "fFile: ") (let ((lob-ingest-count 0)) (org-babel-map-src-blocks file - (let* ((info (org-babel-get-src-block-info 'light)) + (let* ((info (org-babel-get-src-block-info 'no-eval)) (source-name (nth 4 info))) (when source-name (setf (nth 1 info) diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 3240b994e..2da92efaf 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -246,7 +246,7 @@ matching a regular expression." org-babel-default-header-args)) (tangle-file (when (equal arg '(16)) - (or (cdr (assq :tangle (nth 2 (org-babel-get-src-block-info 'light)))) + (or (cdr (assq :tangle (nth 2 (org-babel-get-src-block-info 'no-eval)))) (user-error "Point is not in a source code block")))) path-collector) (mapc ;; map over file-names @@ -461,7 +461,7 @@ code blocks by target file." (setq last-heading-pos current-heading-pos))) (unless (or (org-in-commented-heading-p) (org-in-archived-heading-p)) - (let* ((info (org-babel-get-src-block-info 'light)) + (let* ((info (org-babel-get-src-block-info 'no-eval)) (src-lang (nth 0 info)) (src-tfile (cdr (assq :tangle (nth 2 info))))) (unless (or (string= src-tfile "no") @@ -594,7 +594,7 @@ non-nil, return the full association list to be used by "Return a list of begin and end link comments for the code block at point. INFO, when non nil, is the source block information, as returned by `org-babel-get-src-block-info'." - (let ((link-data (pcase (or info (org-babel-get-src-block-info 'light)) + (let ((link-data (pcase (or info (org-babel-get-src-block-info 'no-eval)) (`(,_ ,_ ,params ,_ ,name ,start ,_) `(("start-line" . ,(org-with-point-at start (number-to-string diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el index 225cdc093..14bdc55e9 100644 --- a/lisp/org-pcomplete.el +++ b/lisp/org-pcomplete.el @@ -35,7 +35,7 @@ (declare-function org-at-heading-p "org" (&optional ignored)) (declare-function org-babel-combine-header-arg-lists "ob-core" (original &rest others)) -(declare-function org-babel-get-src-block-info "ob-core" (&optional light datum)) +(declare-function org-babel-get-src-block-info "ob-core" (&optional no-eval datum)) (declare-function org-before-first-heading-p "org" ()) (declare-function org-buffer-property-keys "org" (&optional specials defaults columns)) (declare-function org-element-at-point "org-element" (&optional pom cached-only)) @@ -428,7 +428,7 @@ switches." (symbol-plist 'org-babel-load-languages) 'custom-type))))))) - (let* ((info (org-babel-get-src-block-info 'light)) + (let* ((info (org-babel-get-src-block-info 'no-eval)) (lang (car info)) (lang-headers (intern (concat "org-babel-header-args:" lang))) (headers (org-babel-combine-header-arg-lists diff --git a/lisp/org-src.el b/lisp/org-src.el index 2c1dd98ea..8744e98bf 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -1250,7 +1250,7 @@ name of the sub-editing buffer." "example")) (lang-f (and (eq type 'src-block) (org-src-get-lang-mode lang))) (babel-info (and (eq type 'src-block) - (org-babel-get-src-block-info 'light))) + (org-babel-get-src-block-info 'no-eval))) deactivate-mark) (when (and (eq type 'src-block) (not (functionp lang-f))) (error "No such language mode: %s" lang-f)) @@ -1282,7 +1282,7 @@ name of the sub-editing buffer." (user-error "Not on inline source code")) (let* ((lang (org-element-property :language context)) (lang-f (org-src-get-lang-mode lang)) - (babel-info (org-babel-get-src-block-info 'light)) + (babel-info (org-babel-get-src-block-info 'no-eval)) deactivate-mark) (unless (functionp lang-f) (error "No such language mode: %s" lang-f)) (org-src--edit-element -- 2.20.1