Morgan Smith <[email protected]> writes:

>> This won't work. FILE variable is used to derive the tangled file name.
>> Same for some clauses you changed in test-org-capture/org-capture-expand-olp.
>
> The macro `org-test-with-temp-text-in-file' exposes the variable FILE.
> ...

Hmm. That's actually a bad code practice. (which is why I missed it)
Normally, macros should not bind variables (especially not without
documenting it in the docstring). In the main source code, Org even has
a special `org-with-gensyms' that makes sure that let-binding inside
macro do not have a chance to interfere with the code using the macro.

So, what org-test-with-temp-text-in-file does is not right and can cause
hard-to-debug errors of the type
(let ((buffer (current-buffer))) ; parent buffer
(org-with-temp-text-in-file "..."
  (should (equal (buffer-string) (with-current-buffer buffer ...)))))

At least, we should (1) make the let-bound file name inside
`org-test-with-temp-text-in-file' more unique. Like
org-test-temp-file-name; (2) Document this let-bind in the
docstring. Then, your patch will be ok.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to