Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2017-06-05 18:47:25 +02:00
commit 57bf6bbbde
2 changed files with 50 additions and 56 deletions

View File

@ -52,11 +52,7 @@
(declare-function org-element-at-point "org-element" ())
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-map "org-element"
(data types fun &optional info first-match no-recursion
with-affiliated))
(declare-function org-element-parse-buffer "org-element"
(&optional granularity visible-only))
(declare-function org-element-macro-parser "org-element" ())
(declare-function org-element-property "org-element" (property element))
(declare-function org-element-type "org-element" (element))
(declare-function org-file-contents "org" (file &optional noerror))
@ -197,7 +193,7 @@ found in the buffer with no definition in TEMPLATES.
Optional argument KEYWORDS, when non-nil is a list of keywords,
as strings, where macro expansion is allowed."
(org-with-wide-buffer
(save-excursion
(goto-char (point-min))
(let ((properties-regexp
(format "\\`EXPORT_%s\\+?\\'" (regexp-opt keywords)))
@ -213,13 +209,11 @@ as strings, where macro expansion is allowed."
((or (and (eq type 'keyword)
(member (org-element-property :key datum) keywords))
(and (eq type 'node-property)
(string-match-p
properties-regexp
(string-match-p properties-regexp
(org-element-property :key datum))))
(save-restriction
(narrow-to-region (match-beginning 0) (line-end-position))
(org-element-map (org-element-parse-buffer) 'macro
#'identity nil t))))))
(save-excursion
(goto-char (match-beginning 0))
(org-element-macro-parser))))))
(when macro
(let* ((value (org-macro-expand macro templates))
(begin (org-element-property :begin macro))

View File

@ -77,8 +77,8 @@
(buffer-string))))
;; Macro expansion ignores narrowing.
(should
(string-match
"expansion"
(string-match-p
"{{{macro}}}"
(org-test-with-temp-text
"#+MACRO: macro expansion\n{{{macro}}}\n<point>Contents"
(narrow-to-region (point) (point-max))