emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-protocol: Make org protocol defaults work on windows
@ 2020-11-20 16:26 Robert
  2020-11-25  6:18 ` Kyle Meyer
  2021-03-28 17:02 ` Maxim Nikulin
  0 siblings, 2 replies; 4+ messages in thread
From: Robert @ 2020-11-20 16:26 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Robert

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

Hei,

Attached a little patch to make the default org-protocol handlers work on windows.

Tested with Windows 10 and emacs 27.1

Best Regards

Robert


[-- Attachment #2: 0001-org-protocol-Make-org-protocol-defaults-work-on-wind.patch --]
[-- Type: application/octet-stream, Size: 1903 bytes --]

From 40257be885a73bc055195c52d2acd354ce2ba0f9 Mon Sep 17 00:00:00 2001
From: Robert Ewald <roew@iris.no>
Date: Fri, 20 Nov 2020 15:52:00 +0100
Subject: [PATCH] org-protocol: Make org protocol defaults work on windows

* org-protocol (org-protocol-protocol-alist-default): Make default org-protocol
handlers work on windows

Windows inserts a slash in the protocol handler. By defining these
protocols with a trailing slash we are able to handle this case.

TINYCHANGE
---
 lisp/org-protocol.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
index 4bc7cee31..5b6862b78 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -138,10 +138,15 @@ for `org-protocol-the-protocol' and sub-protocols defined in
 
 ;;; Variables:
 
+;; Windows inserts a slash in the protocol handler. Handle this case with the constants
+
 (defconst org-protocol-protocol-alist-default
-  '(("org-capture"     :protocol "capture"     :function org-protocol-capture  :kill-client t)
-    ("org-store-link"  :protocol "store-link"  :function org-protocol-store-link)
-    ("org-open-source" :protocol "open-source" :function org-protocol-open-source))
+  '(("org-capture"     :protocol "capture/"     :function org-protocol-capture  :kill-client t)
+    ("org-capture"     :protocol "capture"      :function org-protocol-capture  :kill-client t)
+    ("org-store-link"  :protocol "store-link/"  :function org-protocol-store-link)
+    ("org-store-link"  :protocol "store-link"   :function org-protocol-store-link)
+    ("org-open-source" :protocol "open-source/" :function org-protocol-open-source)
+    ("org-open-source" :protocol "open-source"  :function org-protocol-open-source))
   "Default protocols to use.
 See `org-protocol-protocol-alist' for a description of this variable.")
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] org-protocol: Make org protocol defaults work on windows
  2020-11-20 16:26 [PATCH] org-protocol: Make org protocol defaults work on windows Robert
@ 2020-11-25  6:18 ` Kyle Meyer
  2021-03-28 17:02 ` Maxim Nikulin
  1 sibling, 0 replies; 4+ messages in thread
From: Kyle Meyer @ 2020-11-25  6:18 UTC (permalink / raw)
  To: Robert; +Cc: emacs-orgmode

Robert writes:

> Hei,
>
> Attached a little patch to make the default org-protocol handlers work on windows.
>
> Tested with Windows 10 and emacs 27.1

Thank you for the patch.

Any org-protocol and/or Windows users out there that can provide
feedback?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] org-protocol: Make org protocol defaults work on windows
  2020-11-20 16:26 [PATCH] org-protocol: Make org protocol defaults work on windows Robert
  2020-11-25  6:18 ` Kyle Meyer
@ 2021-03-28 17:02 ` Maxim Nikulin
  2021-05-01 10:15   ` Bastien
  1 sibling, 1 reply; 4+ messages in thread
From: Maxim Nikulin @ 2021-03-28 17:02 UTC (permalink / raw)
  To: emacs-orgmode

On 20/11/2020 23:26, Robert wrote:
> Attached a little patch to make the default org-protocol
> handlers work on windows.

Unsure, but the issue might be addressed by the following change:
https://code.orgmode.org/bzg/org-mode/commit/928e67df
org-protocol: Allow slashes after sub-protocol

I am curious if alternative approach could help. Have you tried
one or three slashes after "org-protocol:"? E.g.
org-protocol:/capture?template=... or
org-protocol:///capture?template=... instead of
org-protocol://capture?template=...

I suspect that with double slash subprotocol is considered as a name
of some host so "/" as path before query part is added. With other
number of slashes subprotocol does not look like a host name
similar to file:/// scheme. See
https://orgmode.org/list/s3flvl$a48$1@ciao.gmane.io/



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] org-protocol: Make org protocol defaults work on windows
  2021-03-28 17:02 ` Maxim Nikulin
@ 2021-05-01 10:15   ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2021-05-01 10:15 UTC (permalink / raw)
  To: Maxim Nikulin; +Cc: emacs-orgmode

Hi,

Maxim Nikulin <manikulin@gmail.com> writes:

> On 20/11/2020 23:26, Robert wrote:
>> Attached a little patch to make the default org-protocol
>> handlers work on windows.
>
> Unsure, but the issue might be addressed by the following change:
> https://code.orgmode.org/bzg/org-mode/commit/928e67df
> org-protocol: Allow slashes after sub-protocol

I'm optimistically closing this patch.  If the OP confirmes it is
still needed and Maxim confirms it is correct, we can apply a new 
one.

Thanks,

-- 
 Bastien


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-01 10:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-20 16:26 [PATCH] org-protocol: Make org protocol defaults work on windows Robert
2020-11-25  6:18 ` Kyle Meyer
2021-03-28 17:02 ` Maxim Nikulin
2021-05-01 10:15   ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).