Hi @nobiot, and thank you for your messages. I decided to delete bookmarklet and app that I created and to redo everything from scratch documenting all the steps. I apologise in advance for the long post, but I documented everything I did (sorry I do not know how to use edebug
. In the steps below you also find the answers to your questions. I hope this helps in giving you a clue why configuration/set-up is not working. Thank you!
- From command line I run
emacs âdaemon
- From command line I do
which emacsclient
, and get /opt/homebrew/bin/emacsclient
- I launch the Script Editor and paste in the following script:
on open location this_URL
set EC to "/opt/homebrew/bin/emacsclient --no-wait "
set filePath to quoted form of this_URL
do shell script EC & filePath
tell application "Emacs" to activate
end open location
- I save that script as
/Applications/OrgProtocolClient.app
⌠I notice that saving this causes emacs to start up with the default Welcome text.
- I add the following XML snippet in
/Applications/OrgProtocolClient.app/Contents/Info.plist
, before the last tag
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>org-protocol handler</string>
<key>CFBundleURLSchemes</key>
<array>
<string>org-protocol</string>
</array>
</dict>
</array>
- I save the XML and double click on
OrgProtocolClient.app
to run it and register the protocol
- I restart my computer
- I run again
emacs âdaemon
- I test org-protocol with
open org-protocol://roam-ref\?template=r\&ref=test\&title=this
: this starts the OrgProtocolClient.app
(I can see it among my running apps when I do Command+TAB, but nothing else happens ⌠I think this is already means that something is wrong. Interestingly, at this stage if I do the following from the command line
emacsclient -e '(kill-emacs)âthen emacs start up with the usual Welcome page. No file is ever created in the path specified by my template in
org-roam-capture-ref-templates(see
.emacs` file posted above).
- I restart
emacs âdaemon
- I try
open org-protocol://roam-node\?node=a33e3f37-7bea-4780-b62e-c6683f984d46
(where a33e3f37-7bea-4780-b62e-c6683f984d46
is the node-id of an existing org-roam note in my computer): an emacs window with the default Welcome message appears, but my note is not loaded.
- I kill again emacs daemon with
emacsclient -e '(kill-emacs)â
, and restart it with emacs âdaemon
- I create a bookmarklet in Firefox: Bookmarks â Manage Bookmarks, right-click on âBookmarks Toolbar, and âAdd bookmarkâ: Name âOrgRoamâ, URL:
âjavascript:location.href = 'org-protocol://roam-ref?template=r&ref=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title) + '&body=' + encodeURIComponent(window.getSelection())
, and then I save it.
- I go to Org-roam User Manual and click on
OrgRoam
: emacs window opens with Welcome message. In the directory specified by my template in org-roam-capture-ref-templates
I see the following:
ll -lart
total 0
drwxr-xr-x@ 7 marco staff 224B 16 May 14:49 ../
lrwxr-xr-x@ 1 marco staff 35B 20 May 09:56 .#20240520095652-org_roam_user_manual.org@ -> marco@Marcos-MacBook-Pro.local.2914
drwxr-xr-x@ 3 marco staff 96B 20 May 09:56 ./
Also, I try to check the symbolic link with file
and this is what I get:
file .#20240520095652-org_roam_user_manual.org
.#20240520095652-org_roam_user_manual.org: broken symbolic link to marco@Marcos-MacBook-Pro.local.2914
I also try cat
:
cat .#20240520095652-org_roam_user_manual.org
cat: .#20240520095652-org_roam_user_manual.org: No such file or directory
- I do
emacsclient -e '(kill-emacs)â
and then check again the directory specified by my template in org-roam-capture-ref-templates
I see the following:
ll -lart
total 8
drwxr-xr-x@ 7 marco staff 224B 16 May 14:49 ../
-rw-r--r--@ 1 marco staff 418B 20 May 10:00 #20240520095652-org_roam_user_manual.org#
drwxr-xr-x@ 3 marco staff 96B 20 May 10:00 ./
Now the file is not a symbolic link and there is no dot at the beginning.
I try cat
and this is what I see:
cat \#20240520095652-org_roam_user_manual.org\#
:PROPERTIES:
:ID: 6aeb62ad-6fbf-4068-b9e5-a4fbdfcfb2e9
:ROAM_REFS: https://www.orgroam.com/manual.html#Mac-OS
:END:
#+title: Org-roam User Manual
#+date: [2024-05-20 Mon 09:56]
javascript:location.href =
'org-protocol://roam-ref?template=r&ref='
+ encodeURIComponent(location.href)
+ '&title='
+ encodeURIComponent(document.title)
+ '&body='
+ encodeURIComponent(window.getSelection())
- I kill emacs daemon and restart it and try removing the `${body} part of the template as suggested, so my template is now:
("r" "ref" plain "%?" :target
(file+head "private/from_web/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+date: %U")
:unnarrowed t)
I repeat step 14, and get another symbolic link .#20240520100759-org_roam_user_manual.org@ -> marco@Marcos-MacBook-Pro.local.3359
.
I repeat step 15, and I get a file with the following content:
cat \#20240520100759-org_roam_user_manual.org\# (base)
:PROPERTIES:
:ID: 79cca87a-9ae7-488d-adc8-b92102925f9e
:ROAM_REFS: https://www.orgroam.com/manual.html#Mac-OS
:END:
#+title: Org-roam User Manual
#+date: [2024-05-20 Mon 10:07]