emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [PATCH v2] Re: Bug in 9.5.3 org--file-default-apps


From: Max Nikulin
Subject: Re: [PATCH v2] Re: Bug in 9.5.3 org--file-default-apps
Date: Sun, 29 May 2022 14:07:38 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1

On 26/05/2022 11:23, Ihor Radchenko wrote:
diff --git a/lisp/org.el b/lisp/org.el
index d7da8efc4..45a179a8a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7975,7 +7975,12 @@ (defun org-open-file (path &optional in-emacs line 
search)
     (when (eq cmd 'mailcap)
       (require 'mailcap)
       (mailcap-parse-mailcaps)
-      (let* ((mime-type (mailcap-extension-to-mime (or ext "")))
+      (let* ((mime-type (if (executable-find "file")
+                            (shell-command-to-string
+                             (format "%s --brief --mime-type %s"

Another corner case:

   file --brief --mime-type tstorg-sh-symlink
   inode/symlink
   file --brief --mime-type --dereference tstorg-sh-symlink
   text/x-shellscript

+                                     (executable-find "file")
+                                     (shell-quote-argument 
(convert-standard-filename file))))
+                          (mailcap-extension-to-mime (or ext ""))))

Actually MIME type for shell scripts varies a lot

(mailcap-extension-to-mime "sh") => "text/x-sh"

run-mailcap --norun examples/org/script/tstorg.sh
Error: no "view" mailcap rules found for type "application/x-sh"

And "text/x-shellscript" as above.




reply via email to

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