org-babel-header-arg-expand: more stringent check for appropriate context
The check for appropriate context in `org-babel-header-arg-expand' was inadequate: a colon was deemed appropriate anywhere in the source block, not just in the header. * lisp/ob-core.el (org-babel-header-arg-expand): The function now uses `org-babel-in-src-block-header-p' to check for appropriate context. (org-babel-in-src-block-header-p): New function. Reported-by: use @Addlai on Emacs SE. Link: https://list.orgmode.org/orgmode/87zfnrb2nu.fsf@pierrot.dokosmarshall.org/
This commit is contained in:
parent
23eb697df6
commit
8b4b89b14b
|
@ -1093,10 +1093,19 @@ completion from lists of common args and values."
|
|||
(unless (= (char-before (point)) ?\ ) (insert " "))
|
||||
(insert ":" header-arg) (when value (insert " " value)))))
|
||||
|
||||
(defun org-babel-in-src-block-header-p ()
|
||||
"Return non-nil when `point' is in the header line of the source block."
|
||||
(let ((beg (org-babel-where-is-src-block-head)))
|
||||
(when beg
|
||||
(let ((end (save-excursion (goto-char beg) (end-of-line) (point))))
|
||||
(and (>= (point) beg) (<= (point) end))))))
|
||||
|
||||
;; Add support for completing-read insertion of header arguments after ":"
|
||||
(defun org-babel-header-arg-expand ()
|
||||
"Call `org-babel-enter-header-arg-w-completion' in appropriate contexts."
|
||||
(when (and (equal (char-before) ?\:) (org-babel-where-is-src-block-head))
|
||||
"Call `org-babel-enter-header-arg-w-completion' in appropriate contexts
|
||||
(the header line of a source block)."
|
||||
(when (and (equal (char-before) ?\:)
|
||||
(org-babel-in-src-block-header-p))
|
||||
(org-babel-enter-header-arg-w-completion (match-string 2))))
|
||||
|
||||
(defun org-babel-enter-header-arg-w-completion (&optional lang)
|
||||
|
|
Loading…
Reference in New Issue