emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Derek Chen-Becker <derek@chen-becker.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] Cannot tangle src block in capture buffer [9.7.6]
Date: Wed, 15 Jan 2025 17:15:22 +0000	[thread overview]
Message-ID: <878qrcdmmt.fsf@localhost> (raw)
In-Reply-To: <CAMbmz5n=npK+3-Vw9k67Mz+L2us2QFj=dXGrjGtgnbLyjq2AOA@mail.gmail.com>

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	other threads:[~2025-01-15 17:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26 16:29 [BUG] Cannot tangle src block in capture buffer [9.7.6] Dilip
2024-08-05 14:03 ` Ihor Radchenko
2024-12-16  3:26   ` Derek Chen-Becker
2024-12-16 17:39     ` Ihor Radchenko
2024-12-19 17:56       ` Derek Chen-Becker
2024-12-19 19:17         ` Ihor Radchenko
2024-12-23 23:36           ` Derek Chen-Becker
2024-12-24  9:14             ` Ihor Radchenko
2025-01-10 15:25               ` Derek Chen-Becker
2025-01-11  9:17                 ` Ihor Radchenko
2025-01-12 15:52                   ` Derek Chen-Becker
2025-01-12 16:45                     ` Ihor Radchenko
2025-01-12 22:24                       ` Derek Chen-Becker
2025-01-13 17:23                         ` Ihor Radchenko
2025-01-14  3:01                           ` Derek Chen-Becker
2025-01-14 17:56                             ` Ihor Radchenko
2025-01-14 19:26                               ` Derek Chen-Becker
2025-01-15 14:15                                 ` Derek Chen-Becker
2025-01-15 17:15                                   ` Ihor Radchenko [this message]
2025-01-14 23:10                               ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878qrcdmmt.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=derek@chen-becker.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).