org-macro: Fix expansion in narrowed buffers
* lisp/org-macro.el (org-macro-replace-all): Expand macro even outside narrowed part of the buffer. * testing/lisp/test-org-macro.el (test-org/macro-replace-all): Add test. Reported-by: Kaushal Modi <kaushal.modi@gmail.com> <http://permalink.gmane.org/gmane.emacs.orgmode/104562>
This commit is contained in:
parent
75ee067410
commit
9ab973d0a6
|
@ -188,7 +188,7 @@ found in the buffer with no definition in TEMPLATES.
|
||||||
|
|
||||||
Optional argument KEYWORDS, when non-nil is a list of keywords,
|
Optional argument KEYWORDS, when non-nil is a list of keywords,
|
||||||
as strings, where macro expansion is allowed."
|
as strings, where macro expansion is allowed."
|
||||||
(save-excursion
|
(org-with-wide-buffer
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(let ((properties-regexp
|
(let ((properties-regexp
|
||||||
(format "\\`EXPORT_%s\\+?\\'" (regexp-opt keywords)))
|
(format "\\`EXPORT_%s\\+?\\'" (regexp-opt keywords)))
|
||||||
|
|
|
@ -107,7 +107,17 @@
|
||||||
(org-test-with-temp-text
|
(org-test-with-temp-text
|
||||||
"* H1\n:PROPERTIES:\n:A: 1\n:END:\n* H2\n{{{property(A,*???)}}}<point>"
|
"* H1\n:PROPERTIES:\n:A: 1\n:END:\n* H2\n{{{property(A,*???)}}}<point>"
|
||||||
(org-macro-initialize-templates)
|
(org-macro-initialize-templates)
|
||||||
(org-macro-replace-all org-macro-templates))))
|
(org-macro-replace-all org-macro-templates)))
|
||||||
|
;; Macro expansion ignores narrowing.
|
||||||
|
(should
|
||||||
|
(string-match
|
||||||
|
"expansion"
|
||||||
|
(org-test-with-temp-text
|
||||||
|
"#+MACRO: macro expansion\n{{{macro}}}\n<point>Contents"
|
||||||
|
(narrow-to-region (point) (point-max))
|
||||||
|
(org-macro-initialize-templates)
|
||||||
|
(org-macro-replace-all org-macro-templates)
|
||||||
|
(org-with-wide-buffer (buffer-string))))))
|
||||||
|
|
||||||
(ert-deftest test-org-macro/escape-arguments ()
|
(ert-deftest test-org-macro/escape-arguments ()
|
||||||
"Test `org-macro-escape-arguments' specifications."
|
"Test `org-macro-escape-arguments' specifications."
|
||||||
|
|
Loading…
Reference in New Issue