mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-04 08:47:03 +00:00
Merge branch 'maint'
This commit is contained in:
commit
36c7cfe9eb
@ -160,8 +160,24 @@ this template."
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward regexp nil t)
|
||||
(unless (save-match-data (org-in-commented-heading-p))
|
||||
(let* ((element (save-match-data (org-element-context)))
|
||||
(type (org-element-type element))
|
||||
(let* ((object? (match-end 1))
|
||||
(element (save-match-data
|
||||
(if object? (org-element-context)
|
||||
;; No deep inspection if we're
|
||||
;; just looking for an element.
|
||||
(org-element-at-point))))
|
||||
(type
|
||||
(pcase (org-element-type element)
|
||||
;; Discard block elements if we're looking
|
||||
;; for inline objects. False results
|
||||
;; happen when, e.g., "call_" syntax is
|
||||
;; located within affiliated keywords:
|
||||
;;
|
||||
;; #+name: call_src
|
||||
;; #+begin_src ...
|
||||
((and (or `babel-call `src-block) (guard object?))
|
||||
nil)
|
||||
(type type)))
|
||||
(begin
|
||||
(copy-marker (org-element-property :begin element)))
|
||||
(end
|
||||
|
@ -584,6 +584,18 @@ src_emacs-lisp{(+ 1 1)}"
|
||||
(org-babel-exp-process-buffer))
|
||||
(buffer-string)))))
|
||||
|
||||
(ert-deftest ob-exp/src-block-with-affiliated-keyword ()
|
||||
"Test exporting a code block with affiliated keywords."
|
||||
;; Pathological case: affiliated keyword matches inline src block
|
||||
;; syntax.
|
||||
(should
|
||||
(equal "#+name: call_foo\n#+BEGIN_SRC emacs-lisp\n42\n#+END_SRC"
|
||||
(org-test-with-temp-text
|
||||
"#+name: call_foo\n#+BEGIN_SRC emacs-lisp\n42\n#+END_SRC"
|
||||
(let ((org-export-use-babel t))
|
||||
(org-babel-exp-process-buffer))
|
||||
(buffer-string)))))
|
||||
|
||||
|
||||
(provide 'test-ob-exp)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user