all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Vladimir Alexiev" <vladimir.alexiev@ontotext.com>
To: emacs-orgmode@gnu.org
Subject: (org-protocol-check-filename-for-protocol) should not (server-edit)
Date: Thu, 11 Dec 2014 18:19:19 +0200	[thread overview]
Message-ID: <1039.92477893389$1418314865@news.gmane.org> (raw)

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

                 reply	other threads:[~2014-12-11 16:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='1039.92477893389$1418314865@news.gmane.org' \
    --to=vladimir.alexiev@ontotext.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.