emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] Cannot tangle src block in capture buffer [9.7.6]


From: Ihor Radchenko
Subject: Re: [BUG] Cannot tangle src block in capture buffer [9.7.6]
Date: Wed, 15 Jan 2025 17:15:22 +0000

Derek Chen-Becker <derek@chen-becker.org> writes:

> Before I submit the updated patch, does this look like a better approach?
>
> In the test for `org-base-buffer-file-name' I changed it to explicitly find
> the current buffer file name and use that:
> ...

Looks like I was not clear enough in my last comment.

The latest version of your patch exceeds 20LOC and cannot be accepted
unless you have FSF copyright assignment.

May I know if you have the assignment? If not, I suggest dropping
`test-org-base-buffer-file-name' to not exceed the contribution size
limit.

>     (let ((base-filename (buffer-file-name)))

This looks right.

>     (let ((org-capture-templates '(("t" "Test" entry (here) "* Test
> Header\n\n")))
>           (base-filename (buffer-file-name)))
>
>       (org-capture nil "t")

This one is awkward.
You can create an indirect buffer explicitly instead of relying upon
implementation details of org-capture.

> For the tangle test, I also capture the base buffer filename, use an
> explicit tangle filename, and ensure that the call to `org-babel-tangle'
> returns the expected list of tangled files:
>
> ;; See https://list.orgmode.org/87msfxd81c.fsf@localhost/T/#t
>
> (ert-deftest ob-tangle/tangle-from-capture-buffer ()
>
>   "Test tangling of source blocks from within a capture buffer.
>
> This is to ensure that we properly resolve the buffer name."
>
>   (org-test-with-temp-text-in-file
>
>    "* Header\n\nCapture after this point:\n<point>"
>
>    (let ((tangle-filename (format "%s.el" (buffer-file-name))))

I recommend using `org-babel-effective-tangled-filename' instead.
This is more future-proof against possible changes in the way file name
is computed.

-- 
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

[Prev in Thread] Current Thread [Next in Thread]