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")))))
@jaens
Copy link

jaens commented Oct 6, 2018

(on the develop branch)
Putting the require into user-init causes other org-mode modules to break with errors like Problems while trying to load feature ‘org-info’.
Putting it into user-config seems to work though.

@LaloHao
Copy link

LaloHao commented Sep 23, 2019

(on the develop branch)
Putting the require into user-init causes other org-mode modules to break with errors like Problems while trying to load feature ‘org-info’.
Putting it into user-config seems to work though.

Yes, you need to wait for spacemacs to finish loading, and then configure org mode, since they use their own version, otherwise you are loading old org mode with the require and then spacemacs tries to load it's own version

@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