* (org-protocol-check-filename-for-protocol) should not (server-edit)
@ 2014-12-11 16:19 Vladimir Alexiev
0 siblings, 0 replies; only message in thread
From: Vladimir Alexiev @ 2014-12-11 16:19 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-12-11 16:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-11 16:19 (org-protocol-check-filename-for-protocol) should not (server-edit) Vladimir Alexiev
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.