Hacker News new | ask | show | jobs
by bombastry 2023 days ago
Org-Capture creates a temporary buffer, inserts its template string, processes the special escape sequences (called "%-escapes")[1], and then lets the user edit the buffer before adding it as an entry. Where the entry goes is specified by the code that sets up the template.

The power here comes from the %-escapes, which range from asking the user for a prompt and pasting it in that location ("%^{PROMPT}") to arbitrary code execution ("%(EXP)") that can include text input from the user from other %-escapes. There are escapes to insert the file name ("%f") and the full file path ("%F") of the file that was visited when the template was triggered.

I think it's a lot easier to evaluate this kind of thing in action rather than in screenshots, so I've added an example screen recording[2] with a keylogger to show what a capture using a fairly simple template looks like. This Imgur album has both the screen recording as well as what the resulting entry looks like after it is saved.

[1]https://orgmode.org/manual/Template-expansion.html [2]https://imgur.com/a/l8jwbnN

1 comments

It’s intersecting to get an idea of how to quickly do logging from within a code editor.

My linkblog uses a web app, with a bookmarklet frontend, so it’s easy to post when browsing the web from inside the browser.

But for a bug log it makes sense to be adding directly from the editor, though I could imagine that having a way to add entries using a web form might be useful too, making it possible to use touch screen devices.