Using Emacs for bookmark management
This post is inspired by Mike Zamansky’s video channel on youtube1.Since I am now using Arc as my main browser so usually I don’t usually need to manage my bookmark, sometimes when I saw interesting blogs and information, I still want to have it somewhere and preferably an annotation to tell me why I store it at the first place, to have this sort of bookmark in my emacs comes in handy.
The idea is to basically capture the url from my browser and send it
to a file through emacsclient and export the file in .html
form and
bookmark2 the page in my browser.
Also, I don’t want to export my bookmark every time when I add more information to it, it would be nice that the org file will auto export itself on saving.
Prep
- Org-protocol
- Org-capture (browser extension + templates)
Org-protocol configuration
There are abundant org-protocol configurations information online, the the only caveat is the link to the emacsclient file might be broken (see this blog post).
Org capture
Both chrome and firefox have the capture extension in the extension store. The templates are setup as following:
1(setq org-capture-templates '(
2 ("p" "Protocol" entry (file+headline "~/Notes/captures.org" "Inbox")
3 "* %^{Title}\nSource: %u, %c\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?")
4 ("L" "Protocol Link" entry (file+headline "~/Notes/captures.org" "Link")
5 "* %? [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]]\n")
6 ))
Be aware that, %c
stands for the head of the kill-ring, therefore in
order to capture the link properly, copy the link in the browser first
then invoke the capture button if using the Protocol
template.
The captured information will be stored in captures.org
file, under
Inbox and Link headings.
Open the captures.org
file, copy-paste the following configuration at
the end of the file:
1# Local Variables:
2# org-confirm-babel-evaluate:nil
3# eval: (add-hook 'after-save-hook 'org-html-export-to-html t t)
4# End:
This allows the corresponding html to be updated every time on saving.
-
The video also introduces another way of using emacsclient, which seems more flexible than using the org-capture extension in browser. I might dig into this configuration later. ↩︎
-
In Arc, the concept of bookmark is replaced with a pinned tab. If a tab is not pinned, the browser will close them after 24h. I pinned the bookmark page on top of my main space. ↩︎