notes from /dev/null

by Charles Choi 최민수


25 Sep 2025

Storing a Link from your Web Browser to BibTeX using Org protocol

If you’re familiar with this blog, you’ll know that I’m a fan of Org protocol, a means of sending data such as web links and content to an Org file from outside of Emacs. Following up on my last post on Casual BibTeX, this post will show how to re-purpose Org protocol to send a link from your preferred web browser to a BibTeX file.

This is achieved by adding the following template (named “bib”) to the variable org-capture-templates as shown below:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
(add-to-list org-capture-templates
             '("bib"
               "BibTex Online Entry"
               plain
               (file "~/org/bib/references.bib")
               (function (lambda ()
                           (string-join
                            (list "@Online {,"
                                  "author = {%^{Author(s)}},"
                                  "organization = {%^{Organization}},"
                                  "title = {%:description},"
                                  "url = {%:link},"
                                  "date = {%<%Y-%m-%d>%?},"
                                  "notes = {"
                                  "%i"
                                  "}"
                                  "}")
                            "\n")))
               :prepend t
               :empty-lines-after 1))

The web link is treated as an BibTeX Online entry type whose fields are populated as follows:

  • url field holds the web page link.
  • title field holds the web page title.
  • date is populated with the current day (this should be edited to the actual date).
  • notes is populated with the body value according to the capture protocol.
  • author is populated with the value entered via mini-buffer prompt.
  • organization is populated with the value entered via mini-buffer prompt, typically the name of the website.

The template is configured to prepend (via the :prepend property) the captured Online entry to the file “~/org/bib/references.bib”. These values can be adjusted to taste.

When invoking this template via Org protocol, a temporary capture window holding the populated template is created. This entry will not have a citation key, so it is recommended to run M-x bibtex-clean-entry to generate it before committing the capture via C-c C-c. If you have Casual BibTeX installed, you can invoke the Transient menu casual-bibtex-tmenu with the binding M-m and invoke the clean command from there.

Closing Thoughts

Arguably, Org protocol was not designed to support files other than those using Org markup, so the above practice skirts its design intent by sending the capture to a BibTeX file. But as of Emacs 30.2 and Org 9.7.34, this works fine, so YOLO. Users intent on customizing the above “bib” template should be advised that many template properties are not supported, so be advised.

That all said, it’s a nice win to automate the task of writing a BibTeX Online entry.

emacs   org mode

Past Articles

24
SEP
2025

Announcing Casual BibTeX

Announcing Casual support for BibTeX, a bibilography database.

read more
8
SEP
2025

Announcing Numeri - an Emacs package for Roman number translation

Never not know what Super Bowl it is.

read more
24
AUG
2025

A proof of concept to put a better Emacs UI on top of Gnuplot

Where I demo a PoC of a Transient-based UI for Gnuplot and ask out loud, “should I go further?”

read more
12
AUG
2025

Fixing Emacs Page Navigation

Page navigation in Emacs only does half of what you expect. Here’s how to fix it.

read more
5
AUG
2025

Emacs Elevator Pitch: Nerd-kitch Merch

The first thing to do in software is make a T-shirt.

read more
29
JUL
2025

Unleashing the Editing Superpower of Emacs

At the end of the day, you just want to finish the job.

read more
28
JUL
2025

Announcing Casual Compile, Elisp, and Eshell

Casual v2.8.0 update is a big one. Compile, Elisp, Eshell and revamped documentation.

read more
18
JUL
2025

Customizing the Emacs Help Menu

If you’ve outgrown the Emacs Help menu, consider changing it.

read more
8
JUL
2025

Capturing Org Source Blocks

Clip source code from your web browser elegantly with Org capture.

read more

Page 1 / 16   >

 

AboutMastodonBlueskyGitHub

Feeds & Tags
Get Scrim for macOSGet Captee for macOS

Powered by Pelican