emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DISCUSSION, default settings] Using mailcap as default handler for


From: Max Nikulin
Subject: Re: [DISCUSSION, default settings] Using mailcap as default handler for opening file links
Date: Mon, 6 Jun 2022 19:50:10 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

On 04/06/2022 20:42, Ihor Radchenko wrote:

It appears that using mailcap is giving us more trouble than benefits.
I am not sure about the situation on Windows and Mac though.

Should we change the default file handlers to Emacs globally (unless
user customizes otherwise)? Should we continue efforts to work around
mailcap issues? Maybe there is yet another alternative generic way to
open files?

First of all, does someone has reproducible examples when `org-open-file' behaves against expectations in *default* configuration?

My current impression is that even despite serious problems with wiping of `mailcap-mime-data' in Emacs-27, "most" files are still opened in Emacs due to `auto-mode-alist'. Mailcap is used more rare than I expected.

I believe, there are enough issues with mailcap implementation in Emacs, but do we have some alternative? There is no support of queries to mimeapps.list files in Emacs (XDG). Like Chrome it is possible to call xdg-open for any type that can not be handled internally. Maybe it possible to leave it in Org as is or with the patch to call "file" utility (after some fixes).

At least Arch and Debian with Ubuntu have packages for SEMI (emacs-mime), but I am unsure what it is
http://git.chise.org/elisp/semi/
http://git.chise.org/gitweb/?p=elisp/semi.git;a=tree

P.S. Some observations.

MIME is mess. On my system I have in the /etc/mime.types file
application/x-sh                                sh
application/x-shellscript
text/x-sh                                       sh

Notice that for a file with no extension MIME type is different. The "file" utility reports another variant: "text/x-shellscript". To be on the safe side users should configure all variants...

Unsure if the latest version is the same
https://gitlab.freedesktop.org/xdg/shared-mime-info/-/raw/master/data/freedesktop.org.xml.in
  <mime-type type="application/x-shellscript">
    <comment>shell script</comment>
    <sub-class-of type="application/x-executable"/>
    <sub-class-of type="text/plain"/>
    <alias type="text/x-sh"/>
    <generic-icon name="text-x-script"/>
    <magic>
      <!-- ... -->
    </magic>
    <glob pattern="*.sh"/>
  </mime-type>

Emacs behavior for (mailcap-mime-info "text/plain") when no mailcap files are present in the system
- 26: view-mode
- 27: nil since initial value of `mailcap-mime-data' erased
- 28: fundamental-mode because when `mailcap-mime-data' is copied to `mailcap--computed-mime-data' order of fundamental-mode and view-mode is reverted.

By default user's ~/.mailcap has higher priority than initial `mailcap-mime-data' configuration in Emacs-28, but it was not so in Emacs-26.

Though it should not matter due to `auto-mode-alist'.

P.P.S. I had a hope that recent Fedora-36 release has Emacs-28 packaged, so it would be possible to test live image in qemu to quickly check behavior in full-fledged desktop environment, but version 27 is really packaged there.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]