From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Vladimir Alexiev" Subject: (org-protocol-check-filename-for-protocol) should not (server-edit) Date: Thu, 11 Dec 2014 18:19:19 +0200 Message-ID: <1039.92477893389$1418314865@news.gmane.org> Reply-To: vladimir.alexiev@ontotext.com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz6TC-0008MW-3j for emacs-orgmode@gnu.org; Thu, 11 Dec 2014 11:20:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xz6T5-0001JM-Kf for emacs-orgmode@gnu.org; Thu, 11 Dec 2014 11:20:02 -0500 Received: from mail.ontotext.com ([93.123.21.89]:38946 helo=ontomail.ontotext.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz6T5-00019a-Eb for emacs-orgmode@gnu.org; Thu, 11 Dec 2014 11:19:55 -0500 Received: from localhost (localhost [127.0.0.1]) by ontomail.ontotext.com (Postfix) with ESMTP id A2EB957918 for ; Thu, 11 Dec 2014 18:19:43 +0200 (EET) Received: from ontomail.ontotext.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DG0sE85Lmh+J for ; Thu, 11 Dec 2014 18:19:19 +0200 (EET) Received: from vladoa (client-93-123-21-124.ip.daticum.com [93.123.21.124]) by ontomail.ontotext.com (Postfix) with ESMTPSA id 83943578FC for ; Thu, 11 Dec 2014 18:19:19 +0200 (EET) Content-Language: en-us List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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=3D'org-protocol://store-link://'+ = encodeURIComponent(location.href)+'/' \\ = encodeURIComponent(document.title)+'/'+encodeURIComponent(window.getSelec= tion())" (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),=20 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=3D20100901