emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: Samuel Wales <samologist@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Emacs launched from Firefox
Date: Mon, 2 May 2022 15:26:09 +0700	[thread overview]
Message-ID: <62673cdd-14da-8526-c1eb-ca4c74592476@gmail.com> (raw)
In-Reply-To: <CAJcAo8uuWo=umJOMPz4527bUxqWDj8xqDm-ovUJLZ_4mXS5Scw@mail.gmail.com>

On 02/05/2022 09:03, Samuel Wales wrote:
> thank you.  there is no emacs in my ~/.config/mimeapps.list.  where
> are those desktop files found or put?  i use fluxbox.
> [i realize this is not org related.  non-list email ok.]

Perhaps emacs-help is more suitable for this discussion, but I do not 
read that mail list due to rather high traffic there. On the other hand 
I do not know if there is a resource describing such configuration 
taking into account details specific to Emacs (I have not tried to find 
it though).

I am not sure from which site you downloaded that attachment, MIME type 
may vary depending on the HTTP server configuration. You yay check 
Content-Type response header in the browser development tools or using

     curl -I '<URL>'

command. It may be "text/plain", "text/x-patch", "application/x-patch", etc.

In Firefox settings (about:preferences page) check that "Applications" 
section either does not contain an entry for the MIME type (is unlikely 
in your case since you already opened a file) or its handler is 
configured to "Always ask" till you select your new handler.

System-wide .desktop file may reside e.g. in 
"/usr/share/applications/emacs.desktop". You can put your customized 
file in e.g. "~/.local/share/applications/" directory 
("$XDG_DATA_HOME/applications/") or into "applications" subdirectory of 
"$XDG_DATA_DIRS" entry. For details see
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Customize "Exec" entry in the .desktop file to add your options, e.g. 
create "emacs-a11y.desktop"

---- >8 ----
[Desktop Entry]
Version=1.0
Name=Accessible Emacs (GUI)
GenericName=Text Editor
Comment=GNU Emacs is an extensible, customizable text editor - and more
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
TryExec=/usr/bin/emacs
Exec=/usr/bin/emacs %F
Icon=emacs
Type=Application
Terminal=false
Categories=Utility;Development;TextEditor;
StartupWMClass=Emacs
Keywords=Text;Editor;
---- 8< ----

It is better to set unique "Name" to distinguish it from the default 
Emacs launcher. Desktop file format reference:
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

Notice that browser launcher script may reset PATH environment to some 
safe value, so executables from custom directories may be unavailable 
without specifying of the full path.

MIME type should be among the values of the MimeType field inside the 
".desktop" file or in the "mimeapps.list" file. In the former case run 
(with proper directory)

     update-desktop-database ~/.local/share/applications

In the latter case add to "~/config/mimeapps.list" mapping from the MIME 
type to your .desktop file

---- >8 ----
[Added Associations]
text/plain=emacs-a11y.desktop;
---- 8< ----

And maybe

---- >8 ----
[Default Applications]
text/plain=emacs-a11y.desktop;
---- 8< ----

With such recipe a new instance of Emacs will be launched for each 
downloaded file. Likely you would prefer to use you main Emacs session 
or a special session of Emacs for untrusted content fetched from web. In 
such case you can use "emacsclient" command in the ".desktop" file and 
maybe systemd user socket+service units pair to run Emacs on demand.

If you are still using emacs-25 then e.g. "--fg-daemon" option is 
unavailable and related files are not included in the package. For 
inspiration you may check
http://git.savannah.gnu.org/cgit/emacs.git/tree/etc/emacsclient.desktop
http://git.savannah.gnu.org/cgit/emacs.git/tree/etc/emacs.service
https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html

Finally a rather unrelated question. Do you find accessibility tools in 
Gnome or KDE inconvenient? I believed that it should be more difficult 
to arrange setup from scratch for fluxbox. However I never tried any of 
these options.

> On 5/1/22, Max Nikulin wrote:
>> On 01/05/2022 11:53, Samuel Wales wrote:
>>>
>>> [firefox did not offer to allow a command line to run my shell script
>>> which sets up emacs correctly, and idk if it even ran with my .emacs.
>>> does it do -q?  not sure because emacs is too unusable to even find
>>> that out.  so firefox fails to be accessible in that dialog box.
>>
>> Samuel, I think, firefox does exactly what it can find in MIME
>> associations (e.g. ~/.config/mimeapps.list) and in the .desktop file of
>> the selected application.
>>
>> There is an emacsclient.desktop file in Emacs git master that tries to
>> connect to the existing Emacs session. It is a relatively new addition,
>> so packages for Linux distributions may miss it.
>>
>> You can either use standard Emacs initialization to get all your
>> customization available through default emacs.desktop or create a custom
>> .desktop file that contain all CLI options specific to your setup.


  reply	other threads:[~2022-05-02  8:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-01  3:03 [PATCH] Add make target to ease creating reproducers and testing them Ihor Radchenko
2022-05-01  3:47 ` Samuel Wales
2022-05-01  4:20   ` Ihor Radchenko
2022-05-01  4:53     ` Samuel Wales
2022-05-01  5:01       ` Samuel Wales
2022-05-01 11:36       ` Emacs launched from Firefox Max Nikulin
2022-05-02  2:03         ` Samuel Wales
2022-05-02  8:26           ` Max Nikulin [this message]
2022-05-26  0:25             ` Samuel Wales
2022-05-26  2:59               ` Ihor Radchenko
2022-06-01 12:26                 ` Max Nikulin
2022-05-01 14:03 ` [PATCH] Add make target to ease creating reproducers and testing them Christopher M. Miles
2022-07-22 13:37 ` Ihor Radchenko
2023-04-22  8:37   ` Max Nikulin

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=62673cdd-14da-8526-c1eb-ca4c74592476@gmail.com \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=samologist@gmail.com \
    /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).