I want org-protocol-store-link to paste the link in my current buffer and location, no questions asked. I've defined a function like this:
(defun va/org-protocol-store-link (info) "Process an org-protocol://store-link:// style url. Store a browser URL as an org link, automatically in the current buffer. Also saves marked text. The browser bookmark has to look like this: javascript:location.href='org-protocol://store-link://'+ encodeURIComponent(location.href)+'/' \\ encodeURIComponent(document.title)+'/'+encodeURIComponent(window.getSelection())" (let* ((parts (org-protocol-split-data info t org-protocol-data-separator)) (url (org-protocol-sanitize-uri (car parts))) (title (cadr parts)) (region (caddr parts))) ;; (set-buffer (car (buffer-list))) ; when called, a server buffer is current ;; (setq org-stored-links (cons (list uri title) org-stored-links)) ;; (org-insert-link) (insert "[[" url "]") (if title (insert "[" title "]")) (insert "]") (if region (insert " " region)) (raise-frame) nil ; no buffer to edit )) And attached it like that: (setq org-protocol-protocol-alist '(("org-store-link" :protocol "store-link" :function va/org-protocol-store-link :kill-client t))) Unfortunately it pastes the link in the most recent "server" buffer. The reason is that (org-protocol-check-filename-for-protocol) does (server-edit), which does "Switch to next server editing buffer; say "Done" for current buffer." If I set the :kill-client to nil, nothing happens (as far as I can see). Why does (org-protocol-check-filename-for-protocol) call (server-edit)? Cheers! Vladimir PS: the gmane search is pretty bad. I googled with this: +"org-protocol" +"server-edit" url:gmane.emacs.orgmode and found a slightly related article: http://blog.gmane.org/gmane.emacs.orgmode/month=20100901