-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
broken when using xdg-open #16
Comments
I had it working fine on linux. What is your setup? |
Debian GNU/Linux testing + Chrome. |
@malb this is not enough information unfortunately. What version of chrome? What desktop environment (or window manager)? What version? |
Chrome: |
How did you register org-protocol? |
I did:
I also tried without the quotes. |
Could you temporarily change the line Also, to confirm - is xdg-utils version 1.1.1-1 installed? |
I get:
|
So, it appears that xdg-open is not swallowing the third '/'. When you use two slashes rather than three, does the extension not work everywhere or urls? What are your emacs and org versions? What are your capture templates? |
You're right. Repeating the experiment without my patch, I get:
It seem the problem isn't the |
What exactly is your patch? I'm looking at the code and there is a colon after 'capture'. Please right click a page which you want to capture, and press 'inspect'. Then, click on the capture button. There should appear a log line in the console with the message:
Please paste it. |
Furthermore, I find it highly doubtful that the extension itself behaves differently under different OSs, and right now, on an OSX machine, I see that Please open up a shell and type:
and then paste the contents of the org-protocol.log |
using two `/` leads to the second `:` being eaten by xdg-open fixes sprig#16
@malb I am happy to help you debug this, but the extension works fine on my linux machines so this is probably a problem with your specific setup. Furthermore, there is no evidence that your proposed patch won't cause degradation to other users. |
Update: This is outdated. Turns out
|
Here is a (more) legitimate workaround: Wrap emacsclient with a script that adjusts its arguments. _emacs-capture #!/bin/sh
# HACK: workaround for a kde-open bug (feature?) that might have
# eaten a colon from our argument, om nom nom
argv=()
for arg in "$@"; do
re='s_^org-protocol:/+capture:?/+_org-protocol://capture://_'
argv+=("$(echo -n "$arg" | sed -Ez "$re")")
done
# Note: feel free to add any other arguments you want,
# e.g. emacsclient --alternate-editor= -c "${argv[@]}"
emacsclient "${argv[@]}" $HOME/.local/share/applications/emacs-capture.desktop #!/usr/bin/env xdg-open
[Desktop Entry]
Name=Emacs Client
Exec=_emacs-capture "%u"
Icon=emacs-icon
Type=Application
Terminal=false
MimeType=x-scheme-handler/org-protocol; (and don't forget to |
Awesome! Thanks for the detailed explanation and workaround, @ExpHP. I will add it to the readme. |
Thanks to @ExpHP for that detailed analysis! I had no idea KDE was involved; I'm still on KDE 4, so I guess it does the same thing. FYI, with the Org 9 org-protocol URL syntax, I think this shouldn't be an issue, as the colon is not necessary, e.g.:
|
Thank goodness! Though I suppose the problem now shifts to plugins like this that might need to support multiple versions. I notice that on issue #30 where this issue was recently referenced, there's a report of the colon problem occurring on a non-KDE system, so it looks like this rabbit hole goes even deeper yet! |
Yeah, sometimes the efforts to abstract differences create the need for more abstraction downstream. D: |
Hi there,
I had to change the URI to
var uri = 'org-protocol:///';
(note the three/
) in order to make the extension work on Linux where it calls xdg-open. This seems to be a known problem, cf. https://github.com/alphapapa/org-protocol-capture-html#chromeThe text was updated successfully, but these errors were encountered: