# Taking notes on webpages using org-protocol

**URL:** <https://org-roam.discourse.group/t/taking-notes-on-webpages-using-org-protocol/2446>\
**Category:** Troubleshooting\
**Created:** [February 10, 2022, 1:02pm UTC](https://org-roam.discourse.group/t/taking-notes-on-webpages-using-org-protocol/2446 "2022-02-10T13:02:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gigatux](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@gigatux](https://org-roam.discourse.group/u/gigatux)\
**Post date:** [February 10, 2022, 1:02pm UTC](https://org-roam.discourse.group/t/taking-notes-on-webpages-using-org-protocol/2446/1 "2022-02-10T13:02:58Z")

</div>

Hi folks,

I’ve been trying to implement the solution described in the org-roam manual [here](https://www.orgroam.com/manual.html#The-roam_002dnode-protocol). The manual doesn’t reference the need to get the server running with `M-x server-start` but that is a minor problem. If you don’t, you get all sorts of problems as follows:

> user@client:~$ xdg-open org-protocol://roam-ref?template=d&ref=test&title=this  
> /usr/bin/emacsclient: can’t find socket; have you started the server?  
> /usr/bin/emacsclient: To start the server in Emacs, type “M-x server-start”.  
> /usr/bin/emacsclient: No socket or alternate editor. Please use:
> 
> ```
> --socket-name
> --server-file (or environment variable EMACS_SERVER_FILE)
> --alternate-editor (or environment variable ALTERNATE_EDITOR)
> 
> ```
> 
> kf.kio.gui: Failed to register new cgroup: “app-org\x2dprotocol-333f50bc3cc24058840ba0640cb73632.scope” “org.freedesktop.DBus.Error.UnixProcessIdUnknown” “Process with ID 6648 does not exist.”

However, that is not the end of the story. Even with the server running after I do `M-x server-start` I still get the following:

> user@client:~$ xdg-open org-protocol://roam-ref?template=d&ref=test&title=this  
> Waiting for Emacs…  
> _ERROR_: No capture template referred to by “d” keys  
> user@client:~$ emacsclient org-protocol://roam-ref?template=d&ref=test&title=this  
> Waiting for Emacs…  
> _ERROR_: No capture template referred to by “d” keys

Running Emacs 27.1 on Debian stable with latest version of org-roam. It seems to be something associated with the inability to find the “d” template but the snippet from my `init.el` file below has the following for the templates which works correctly when running `C-c n f`. Any thoughts?

> (setq org-roam-capture-templates  
> '((“d” “default” plain  
> “%?”  
> :if-new (file+head “%\<%Y%m%d%H%M%S\>-${slug}.org” “#+title: ${title}\n#+date: %u\n#+lastmod: \n\n”)  
> :unnarrowed t)  
> (“p” “program documentation” plain  
> “\* Introduction\n\n- Version: %?\n- Dependencies: \n\n\* Requirements\n\n\* Installation\n\n\* Testing\n\n”  
> :if-new (file+head “%\<%Y%m%d%H%M%S\>-${slug}.org” “#+title: ${title}\n#+date: %u\n#+lastmod: \n\n”)  
> :unnarrowed t)  
> (“b” “book” plain  
> “\* Summary\n\n- Book Title: %?\n- Number of pages: \n- Cost: \n\n\* Quotes\n\n\* Bibliographical information\n\n\* Topic notes\n\n”  
> :if-new (file+head “%\<%Y%m%d%H%M%S\>-${slug}.org” “#+title: ${title}\n#+date: %u\n#+lastmod: \n\n”)  
> :unnarrowed t)  
> (“l” “programming language” plain  
> “\* Characteristics\n\n- Family: %?\n- Inspired by: \n\n\* Reference:\n\n”  
> :if-new (file+head “%\<%Y%m%d%H%M%S\>-${slug}.org” “#+title: ${title}\n#+date: %u\n#+lastmod: \n\n”)  
> :unnarrowed t)))

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [February 10, 2022, 4:43pm UTC](https://org-roam.discourse.group/t/taking-notes-on-webpages-using-org-protocol/2446/2 "2022-02-10T16:43:17Z")

</div>

> [@gigatux](#):
>
> user@client:~$ emacsclient org-protocol://roam-ref?template=d&ref=test&title=this

So you have specifically chosen `?template=d`.  
Perhaps you might like to check `org-roam-capture-ref-templates`; the default has only `r`, and has no `d`.

The manual has the following too:

> where template is the template key for a template in `org-roam-capture-ref-templates` (see The Templating System).

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [February 10, 2022, 4:48pm UTC](https://org-roam.discourse.group/t/taking-notes-on-webpages-using-org-protocol/2446/3 "2022-02-10T16:48:38Z")

</div>

> [@gigatux](#):
>
> The manual doesn’t reference the need to get the server running with `M-x server-start` but that is a minor problem.

You could create a PR to propose this to be added; this might help others.

Org mode’s manual \[1\] has the following part; I believe Org-roam assumes this, because `org-roam-protocol` is an extension to `org-protocol`:

> In order to use Org protocol from an application, you need to  
> register ‘org-protocol://’ as a valid scheme-handler. External calls  
> are passed to Emacs through the ‘emacsclient’ command, so you also need  
> to ensure an Emacs server is running.

* * *

1. you can evaluate this: `(info "(org) Protocols")`

---

<div class="post-metadata">

**Author:** ![gigatux](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@gigatux](https://org-roam.discourse.group/u/gigatux)\
**Post date:** [February 10, 2022, 5:19pm UTC](https://org-roam.discourse.group/t/taking-notes-on-webpages-using-org-protocol/2446/4 "2022-02-10T17:19:16Z")

</div>

> [@nobiot](#):
>
> org-roam-capture-ref-templates

Alright @nobiot , credit to you. I glanced over that because my brain didn’t spot that `org-roam-capture-ref-templates` is different to `org-roam-capture-templates`. Forgive me. I feel like a little kid (even though almost 50 …) that getting this org-roam system slowly pieced together. So yes, now it does work. I have even created the bookmarklet and it rocks (just need to get Firefox to stop asking me too many questions … I’ll have to explore whether the Chrome workarounds in the manual apply to Firefox).

I understand the frustration of many that adventure to org-roam and abandon the effort after a few weeks. You need patience and resilience if you want to build your Zittelkasten environment in Emacs. But I think with time, these efforts are rewarded.

Just remind me what PR stands for (clearly not Public Relations …) . I may add another one too, which is to add a sentence after this one `where template is the template key for a template in org-roam-capture-ref-templates (see The Templating System)` on the lines of `Ensure you do not confuse `org-roam-capture-ref-templates`with`org-roam-capture-templates`.

---

<div class="post-metadata">

**Author:** ![gigatux](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@gigatux](https://org-roam.discourse.group/u/gigatux)\
**Post date:** [February 10, 2022, 5:39pm UTC](https://org-roam.discourse.group/t/taking-notes-on-webpages-using-org-protocol/2446/5 "2022-02-10T17:39:13Z")

</div>

Alright, so I think the way to fix this is to have Emacs running in daemon mode as described [here](https://www.emacswiki.org/emacs/EmacsAsDaemon).

Being on Debian, my solution was to create `~/.config/autostart/emacs_daemon.desktop` with the following content:

> [Desktop Entry]  
> Exec=emacs --daemon  
> Icon=  
> Name=emacs\_daemon  
> Path=  
> Terminal=False  
> Type=Application

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [February 10, 2022, 6:12pm UTC](https://org-roam.discourse.group/t/taking-notes-on-webpages-using-org-protocol/2446/6 "2022-02-10T18:12:27Z")

</div>

> [@gigatux](#):
>
> Just remind me what PR stands for

Sorry, it stands for a pull request. It’s a way to send a patch to a project on GitHub and some similar source code collaboration tools. Org-roam’s documentation is also part of the source code hosted on GitHub, so you can send your edit proposal to improve the quality of documentation.

---

<div class="post-metadata">

**Author:** ![gigatux](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@gigatux](https://org-roam.discourse.group/u/gigatux)\
**Post date:** [February 10, 2022, 7:53pm UTC](https://org-roam.discourse.group/t/taking-notes-on-webpages-using-org-protocol/2446/7 "2022-02-10T19:53:44Z")

</div>

> [@nobiot](#):
>
> where template is the template key for a template in `org-roam-capture-ref-templates` (see The Templating System).

Ok, has a go at submitting my first PR on Github ever 🙂  
Forgive me if not meeting expectations.

---

<div class="post-metadata">

**Author:** ![n-i-c-l-a-s](https://avatars.discourse-cdn.com/v4/letter/n/71e660/32.png) [@n-i-c-l-a-s](https://org-roam.discourse.group/u/n-i-c-l-a-s)\
**Post date:** [February 16, 2022, 2:23pm UTC](https://org-roam.discourse.group/t/taking-notes-on-webpages-using-org-protocol/2446/8 "2022-02-16T14:23:17Z")

</div>

I had pretty much the same problems when I tried to get org-protocol to work. At some point it worked fine on my Linux PC but when I tried to get it to work on Windows (with WSL2) I gave up…

My “solution” was (and still is) to use [ORG-grasp](https://github.com/karlicoss/grasp) , which is a browser extension that communicates with a small Python server application. This works well for me, and it does not require a running emacs-server (but a running Python server…) . I know, this does not actually answer your question, but I thought I post it here in case there are other people that have problems with org-protocol and want a _quick_ working solution…
