From: Ihor Radchenko <email@example.com> To: Tim Visher <firstname.lastname@example.org> Cc: Emacs Org Mode mailing list <email@example.com> Subject: Re: org-attach-attach in an org-capture template? Date: Fri, 30 Apr 2021 21:12:17 +0800 [thread overview] Message-ID: <877dkjrk5q.fsf@localhost> (raw) In-Reply-To: <CAHa53uxGFMsyXdEoDg=G3vF0ayE_eES_uPCZ0o=rVU1dRXACaw@mail.gmail.com> Tim Visher <firstname.lastname@example.org> writes: > I also believe I could do this with one of the org-capture hooks but > examining them I didn't see the obvious right one to add my function to. I > would think it would be the org-capture-prepare-finalize-hook and I may > just give that a try. Capture hooks should be the right place to do what your want. I recommend org-capture-before-finalize-hook since it will not run if you abort the capture for any reason. Otherwise, you may attach the file, abort capture (via C-c C-k or because of some error), and your attached file will hang somewhere unreferenced. Your first idea with %()-expansion have the same problem. > ... I further assume then that I'd need to to apply the > advice here > <https://www.reddit.com/r/emacs/comments/9n3vxn/in_org_mode_how_can_i_make_a_postcapture_hook_run/> > and > check for what template I'm in with (plist-get org-capture-plist :key) or > similar. I recommend using doct  with :before-finalize keyword. It will take care that your function runs for the right template.  https://github.com/progfolio/doct#hooks > So my question is whether there's anything I can do to get org-attach-attach to > recognize the file it's in. I'm assuming that when it's expanding it's in a > temporary buffer of some kind which is why it's failing. You are right, template expansion is done in separate "*Capture*" buffer using org-capture-fill-template. The buffer is not associated with any file. Best, Ihor
prev parent reply other threads:[~2021-04-30 13:32 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-29 14:08 Tim Visher 2021-04-30 13:12 ` Ihor Radchenko [this message]
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=877dkjrk5q.fsf@localhost \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: org-attach-attach in an org-capture template?' \ /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
Code repositories for project(s) associated with this 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).