Add Applescript code to register org-protocol on Darwin

This commit is contained in:
Gerard Vermeulen 2022-04-30 12:07:34 +02:00
parent e8341891e7
commit 99c82b0fc1

View File

@ -776,6 +776,10 @@ may hang or die.
#+end_src
** TODO Look into: org-protocol handling with other browser on Darwin
:PROPERTIES:
:CUSTOM_ID: sec:org-protocol-darwin
:END:
1. [[http://rwx.io/posts/osx-uri-protocol-handler/][Patrick Goddi: macOS URI protocol handler]] and his [[https://github.com/fooqri/uri-handler][URI-Handler]].
2. [[https://www.hammerspoon.org/][Hammerspoon]]
3. [[https://vritser.github.io/posts/capture-anywhere/][Emacs Capture Anywhere]]
@ -787,6 +791,31 @@ may hang or die.
(when (ensure-package-installation 'applescript-mode))
#+end_src
#+caption[Applescript code to register =org-protocol= on Darwin]:
#+caption: Applescript code to register =org-protocol= on Darwin.
#+name: lst:applescript-org-protocol
#+begin_src applescript :tangle no
on emacsclient(input)
do shell script "/usr/local/bin/emacsclient -n -c '" & input & "'"
tell application "Emacs" to activate
end emacsclient
on open location input
emacsclient(input)
end open location
on open inputs
repeat with raw_input in inputs
set input to POSIX path of raw_input
emacsclient(input)
end repeat
end open
on run
do shell script emacsclient("")
end run
#+end_src
* Completion
:PROPERTIES:
:CUSTOM_ID: sec:completion