Capture buffer from browser

So, I’ve been trying to make capturing from firefox as streamlined as possible. I use this for org-roam but I don’t see why it wouldn’t apply to “regular” captures (with the necessary alterations).

I have a roam-ref bookmarklet (see org-roam-protocol-open-ref) and an org-protocol scheme handler that calls my “scratchmacs” script:

exec emacsclient -c --frame-parameters='(quote (name . "scratchmacs"))' $*

which is just a way to tell my window manager I want special treatment for that window.

Anyway… the frame is created properly and everything works, but it would be nice if (1) the capture buffer occupied the whole frame and (2) the frame was closed after I was done with it (finish/refile/abort).

To address (1), right now I can M-x +popup/raise, so an immediate idea to automate this would be something with set-popup-rule{!,s!}, but I don’t want every org-roam capture buffer to be raised — for example, captures I initiate from my “main” emacs frame.

To address (2), today I manually SPC q f to close the frame, so my immediate idea would be advising finish/refile/abort, but the complication here is that I often create additional roam nodes during my initial capture — say, capturing the doom discourse website I’ll link to “doom” (an existing node) and to “emacs forums” (which will be created at that point); and while creating “emacs forums” I might link to another newly-created node, and so on. Yes, I clearly have problems, that’s not under discussion.

Anyway, there will be a stack of capture buffers to go through before I can actually close the frame cleanly. My idea here is to have the advice look for any CAPTURE-* buffers before trying to close the frame, but before investing any more into putting this all together I wanted to perhaps hear ideas and possibly better workflows I might be missing.

Thanks for coming to my TED talk

Take a look at how emacs-everywhere does the frame handling, it’s basically exactly what you want display-wise.

Thanks, that looks promising.

I took a quick look at the finish function but it is not immediately clear what exactly closes the frame. I’m guessing server-buffer-done, but I’ll do my homework later this week.