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.
This commit is contained in:
parent
bbec9aafee
commit
e58bd039e3
|
@ -339,7 +339,7 @@ then run `org-babel-execute-src-block'."
|
||||||
This includes header arguments, language and name, and is largely
|
This includes header arguments, language and name, and is largely
|
||||||
a window into the `org-babel-get-src-block-info' function."
|
a window into the `org-babel-get-src-block-info' function."
|
||||||
(interactive)
|
(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)))
|
(full (lambda (it) (> (length it) 0)))
|
||||||
(printf (lambda (fmt &rest args) (princ (apply #'format fmt args)))))
|
(printf (lambda (fmt &rest args) (princ (apply #'format fmt args)))))
|
||||||
(when info
|
(when info
|
||||||
|
@ -640,10 +640,10 @@ the list of header arguments."
|
||||||
(push elem lst)))
|
(push elem lst)))
|
||||||
(reverse 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.
|
"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
|
remote variable references; a process which could likely result
|
||||||
in the execution of other code blocks, and do not evaluate Lisp
|
in the execution of other code blocks, and do not evaluate Lisp
|
||||||
values in parameters.
|
values in parameters.
|
||||||
|
@ -677,9 +677,9 @@ a list with the following pattern:
|
||||||
;; properties applicable to its location within
|
;; properties applicable to its location within
|
||||||
;; the document.
|
;; the document.
|
||||||
(org-with-point-at (org-element-property :begin datum)
|
(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)
|
(mapcar (lambda (h)
|
||||||
(org-babel-parse-header-arguments h light))
|
(org-babel-parse-header-arguments h no-eval))
|
||||||
(cons (org-element-property :parameters datum)
|
(cons (org-element-property :parameters datum)
|
||||||
(org-element-property :header datum)))))
|
(org-element-property :header datum)))))
|
||||||
(or (org-element-property :switches 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)
|
(org-element-property (if inline :begin :post-affiliated)
|
||||||
datum)
|
datum)
|
||||||
(and (not inline) (org-src-coderef-format 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-process-params (nth 2 info))))
|
||||||
(setf (nth 2 info) (org-babel-generate-file-param name (nth 2 info)))
|
(setf (nth 2 info) (org-babel-generate-file-param name (nth 2 info)))
|
||||||
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)
|
(defun org-babel-insert-header-arg (&optional header-arg value)
|
||||||
"Insert a header argument selecting from lists of common args and values."
|
"Insert a header argument selecting from lists of common args and values."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((info (org-babel-get-src-block-info 'light))
|
(let* ((info (org-babel-get-src-block-info 'no-eval))
|
||||||
(lang (car info))
|
(lang (car info))
|
||||||
(begin (nth 5 info))
|
(begin (nth 5 info))
|
||||||
(lang-headers (intern (concat "org-babel-header-args:" lang)))
|
(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
|
RE-RUN the source-code block is evaluated even if results already
|
||||||
exist."
|
exist."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(pcase (org-babel-get-src-block-info 'light)
|
(pcase (org-babel-get-src-block-info 'no-eval)
|
||||||
(`(,_ ,_ ,arguments ,_ ,_ ,start ,_)
|
(`(,_ ,_ ,arguments ,_ ,_ ,start ,_)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
;; Go to the results, if there aren't any then run the block.
|
;; 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
|
is created. In both cases if the region is demarcated and if the
|
||||||
region is not active then the point is demarcated."
|
region is not active then the point is demarcated."
|
||||||
(interactive "P")
|
(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))
|
(start (org-babel-where-is-src-block-head))
|
||||||
(block (and start (match-string 0)))
|
(block (and start (match-string 0)))
|
||||||
(headers (and start (match-string 4)))
|
(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
|
these arguments are not evaluated in the current source-code
|
||||||
block but are passed literally to the \"example-block\"."
|
block but are passed literally to the \"example-block\"."
|
||||||
(let* ((parent-buffer (or parent-buffer (current-buffer)))
|
(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))
|
(lang (nth 0 info))
|
||||||
(body (nth 1 info))
|
(body (nth 1 info))
|
||||||
(comment (string= "noweb" (cdr (assq :comments (nth 2 info)))))
|
(comment (string= "noweb" (cdr (assq :comments (nth 2 info)))))
|
||||||
|
|
|
@ -54,7 +54,7 @@ should not be inherited from a source block.")
|
||||||
(interactive "fFile: ")
|
(interactive "fFile: ")
|
||||||
(let ((lob-ingest-count 0))
|
(let ((lob-ingest-count 0))
|
||||||
(org-babel-map-src-blocks file
|
(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)))
|
(source-name (nth 4 info)))
|
||||||
(when source-name
|
(when source-name
|
||||||
(setf (nth 1 info)
|
(setf (nth 1 info)
|
||||||
|
|
|
@ -246,7 +246,7 @@ matching a regular expression."
|
||||||
org-babel-default-header-args))
|
org-babel-default-header-args))
|
||||||
(tangle-file
|
(tangle-file
|
||||||
(when (equal arg '(16))
|
(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"))))
|
(user-error "Point is not in a source code block"))))
|
||||||
path-collector)
|
path-collector)
|
||||||
(mapc ;; map over file-names
|
(mapc ;; map over file-names
|
||||||
|
@ -461,7 +461,7 @@ code blocks by target file."
|
||||||
(setq last-heading-pos current-heading-pos)))
|
(setq last-heading-pos current-heading-pos)))
|
||||||
(unless (or (org-in-commented-heading-p)
|
(unless (or (org-in-commented-heading-p)
|
||||||
(org-in-archived-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-lang (nth 0 info))
|
||||||
(src-tfile (cdr (assq :tangle (nth 2 info)))))
|
(src-tfile (cdr (assq :tangle (nth 2 info)))))
|
||||||
(unless (or (string= src-tfile "no")
|
(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.
|
"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
|
INFO, when non nil, is the source block information, as returned
|
||||||
by `org-babel-get-src-block-info'."
|
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 ,_)
|
(`(,_ ,_ ,params ,_ ,name ,start ,_)
|
||||||
`(("start-line" . ,(org-with-point-at start
|
`(("start-line" . ,(org-with-point-at start
|
||||||
(number-to-string
|
(number-to-string
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
(declare-function org-at-heading-p "org" (&optional ignored))
|
(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-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-before-first-heading-p "org" ())
|
||||||
(declare-function org-buffer-property-keys "org" (&optional specials defaults columns))
|
(declare-function org-buffer-property-keys "org" (&optional specials defaults columns))
|
||||||
(declare-function org-element-at-point "org-element" (&optional pom cached-only))
|
(declare-function org-element-at-point "org-element" (&optional pom cached-only))
|
||||||
|
@ -428,7 +428,7 @@ switches."
|
||||||
(symbol-plist
|
(symbol-plist
|
||||||
'org-babel-load-languages)
|
'org-babel-load-languages)
|
||||||
'custom-type)))))))
|
'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 (car info))
|
||||||
(lang-headers (intern (concat "org-babel-header-args:" lang)))
|
(lang-headers (intern (concat "org-babel-header-args:" lang)))
|
||||||
(headers (org-babel-combine-header-arg-lists
|
(headers (org-babel-combine-header-arg-lists
|
||||||
|
|
|
@ -1250,7 +1250,7 @@ name of the sub-editing buffer."
|
||||||
"example"))
|
"example"))
|
||||||
(lang-f (and (eq type 'src-block) (org-src-get-lang-mode lang)))
|
(lang-f (and (eq type 'src-block) (org-src-get-lang-mode lang)))
|
||||||
(babel-info (and (eq type 'src-block)
|
(babel-info (and (eq type 'src-block)
|
||||||
(org-babel-get-src-block-info 'light)))
|
(org-babel-get-src-block-info 'no-eval)))
|
||||||
deactivate-mark)
|
deactivate-mark)
|
||||||
(when (and (eq type 'src-block) (not (functionp lang-f)))
|
(when (and (eq type 'src-block) (not (functionp lang-f)))
|
||||||
(error "No such language mode: %s" 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"))
|
(user-error "Not on inline source code"))
|
||||||
(let* ((lang (org-element-property :language context))
|
(let* ((lang (org-element-property :language context))
|
||||||
(lang-f (org-src-get-lang-mode lang))
|
(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)
|
deactivate-mark)
|
||||||
(unless (functionp lang-f) (error "No such language mode: %s" lang-f))
|
(unless (functionp lang-f) (error "No such language mode: %s" lang-f))
|
||||||
(org-src--edit-element
|
(org-src--edit-element
|
||||||
|
|
Loading…
Reference in New Issue