Skip to content

Instantly share code, notes, and snippets.

@cjp
Last active May 15, 2023 09:40
Show Gist options
  • Save cjp/64ac13f5966456841c197f70c7d3a53a to your computer and use it in GitHub Desktop.
Save cjp/64ac13f5966456841c197f70c7d3a53a to your computer and use it in GitHub Desktop.
How to get org-protocol to work with spacemacs
;; I have no idea why it works. This is the product of 4 hours of trial-and-error.
(defun dotspacemacs/user-init ()
"Initialization function for user code.
It is called immediately after `dotspacemacs/init'. You are free to put almost
any user code here. The exception is org related code, which should be placed
in `dotspacemacs/user-config'."
(server-start)
(require 'org-protocol)
)
(defun dotspacemacs/user-config ()
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration. You are free to put any user code."
(with-eval-after-load 'org
(add-to-list 'org-modules 'org-protocol)
(setq org-capture-templates '(
("p" "Protocol" entry (file+headline "~/org/notes.org" "Inbox")
"* %^{Title}\nSource: %u, %c\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?")
("L" "Protocol Link" entry (file+headline "~/org/notes.org" "Inbox")
"* %? [[%:link][%:description]] \nCaptured On: %U")))))
@mprokopov
Copy link

also no need to (server-start),
use

 ;; If non-nil, start an Emacs server if one is not already running.
   ;; (default nil)
   dotspacemacs-enable-server t

instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment