emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: org-capture firefox extension broken [silently]
Date: Sat, 11 Jun 2022 09:30:11 +0700	[thread overview]
Message-ID: <t80unm$7ud$1@ciao.gmane.io> (raw)
In-Reply-To: <CAJcAo8tcRo91KYzT4Nj9Dq0MpugREnmFNhR370FtQaT4D2r3EA@mail.gmail.com>

On 11/06/2022 08:43, Samuel Wales wrote:
> On 6/10/22, Max Nikulin wrote:
>> - Have you tried to check that org-protocol still works on your system?
>>         xdg-open 'org-protocol:/org-capture?url=something'
> 
> i ran this from emacs shell mode bash cli as user.  it brought firefox
> to fg, opened a new tab, and the tab has a search page in my default
> search engine that says "org-protocol:/org-capture?url=something" in
> the search box.  is that correct?

First of all, I recommend to run such command in a terminal application 
instead of Emacs. I do not remember which of Emacs shell modes executes 
commands asynchronously (eshell?), so xdg-open fails e.g. for Gnome or 
KDE. Having fluxbox you should be affected in less degree. Another point 
is that when shell running emacsclient is associated with a terminal 
then emacs might try to create a frame inside this terminal. I am unsure 
concerning your preferences for capture windows, but it is better to 
factor out Emacs as shell here.

Actually you have found the source of the problem. A handler for 
org-protocol is not configured in your environment, so xdg-open falls 
back to a browser and firefox falls back to search engine. It is not a 
problem of the browser add-on.

>> Prevented navigation to “org-protocol://capture?template=p&url=https%3A%2F%2Fplanet.emacslife.com%2F&title=Planet%20Emacslife&body=This%20month” due to an unknown protocol.

"unknown protocol" confirms the conclusion.

Check that the ~/.config/mimeapps.list (or maybe 
~/.local/share/applications/mimeapps.list) file contains the following 
sections and entries therein (unsure exact name of your desktop file)

[Added Associations]
x-scheme-handler/org-protocol=org-protocol.desktop;
[Default Applications]
x-scheme-handler/org-protocol=org-protocol.desktop;

Or ~/.local/share/applications/mimeinfo.cache has
[MIME Cache]
x-scheme-handler/org-protocol=org-protocol.desktop;

I just have realized that for kde-open5 it is enough to have 
mimeinfo.cache entry. Gnome without "Default Application" entry shows 
its own application selection dialogue. When there is no handlers like 
kde-open5 specific to desktop environment, xdg-open may scan .desktop 
files. It seems, you have some problem with your .desktop file for 
org-protocol. Check that you have it in ~/.local/share/applications/ and 
try the command specified in the Exec field in a terminal (with some 
org-protocol URI).

An entry in ~/.local/share/applications/mimeinfo.cache is usually created by
     update-desktop-database ~/.local/share/applications
and entries to ~/.config/mimeapps.list may be added by
     xdg-mime default org-protocol.desktop x-scheme-handler/org-protocol
or something like
     xdg-settings set default-url-scheme-handler org-protocol 
org-protocol.desktop
The latter actually calls the former. To check that files are updated:
     xdg-mime query default x-scheme-handler/org-protocol
     xdg-settings get default-url-scheme-handler org-protocol

If it is still broken then it is time to inspect output of
     sh -x /usr/bin/xdg-open 'org-protocol:/org-capture?url=something'

>> - Have you tried to create a html page with an org-protocol link and to
>> click on it?
> 
> no clue what i would do to do that.

For example, create an org file with some link, export it as HTML, edit 
the result to use the URI from "Prevented navigation" error in <a 
href="..."> and open this html file in Firefox. Using org-protocol URI 
as link target in an org file is possible as well, but additional setup 
may be required to avoid treating it as unknown target.

By the way, https://github.com/sprig/org-capture-extension/ has some 
instructions. They are not perfect, but they are still in some points 
better than worg page for org-protocol.



  parent reply	other threads:[~2022-06-11  2:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 21:13 org-capture firefox extension broken [silently] Samuel Wales
2022-06-09 17:44 ` Richard Kim
2022-06-09 23:55   ` Samuel Wales
2022-06-10 12:33 ` Max Nikulin
2022-06-11  1:43   ` Samuel Wales
2022-06-11  1:53     ` Samuel Wales
2022-06-11  2:30     ` Max Nikulin [this message]
2022-06-10 17:59 ` Bhavin Gandhi

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to='t80unm$7ud$1@ciao.gmane.io' \
    --to=manikulin@gmail.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 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).