2

openwith seems to kill replying in mu4e.

Is there a similar/alternative solution for easy defining default apps per extensions in dired?

  • Can you clarify what you mean when you say that "openwith seems to kill replying in mu4e"? I use both and have no problem with them. Does this problem persist if you start Emacs without your init file (emacs -Q)? – Dan Apr 23 '16 at 16:54
  • Hi Dan. when i hit 'R' the reply dosent launch and i get this error: error in process filter: Opening input file. any clue? – zeltak Apr 23 '16 at 17:25
  • Try (add-to-list 'mm-inhibit-file-name-handlers 'openwith-file-handler) . – Joe Corneli Sep 8 '16 at 10:37
1

You might find that dired-launch is of some value. I developed it as a launcher specifically for dired-mode (unlike openwith... which tries to work in a variety of settings). dired-launch provides a keybinding (J) which allows one to launch the default external application corresponding to that file.

| improve this answer | |
3

On Debian, this is how I do it:

(defun mu-open-in-external-app ()
  "Open the file where point is or the marked files in Dired in external
app. The app is chosen from your OS's preference."
  (interactive)
  (let* ((file-list
          (dired-get-marked-files)))
    (mapc
     (lambda (file-path)
       (let ((process-connection-type nil))
         (start-process "" nil "xdg-open" file-path))) file-list)))

And then I have this:

(define-key dired-mode-map (kbd "C-<return>") #'mu-open-in-external-app)

You can bind RET instead.

(define-key dired-mode-map (kbd "RET") #'mu-open-in-external-app)
| improve this answer | |
2

Yes, vanilla Dired has help for this, and Dired+ provides some more help.

  1. You can use ! on a file (or marked files) to run a shell program on it. Use M-n to cycle among possible commands. These commands to choose from come from the MIME type of the file (see non-option variable mailcap-mime-data). They can also come from entries that you make in user option dired-guess-shell-alist-user (you will need to load standard library dired-x.el for this).

  2. If you use Emacs on MS Windows and you have both Dired+ and library w32-browser.el (see Ms Shell Execute) then you can use M-RET in Dired to open a file or directory using its Windows file association (i.e., its "open" program).

| improve this answer | |
  • thx Drew! i use linux (arch linux). I have been using ! with the dired-x and it works great but what i really want is to press ENTER and launch the app (im lazy i guess). openwith works great in that sense. best, Z – zeltak Apr 23 '16 at 17:34
  • Then bind a key that does that: invokes the app. Usually the question is which app? That's what dired-guess-default is about. It is used by dired-guess-shell-command which is used by via M-n (dired-read-shell-command) from ! (dired-do-shell-command). It just looks through dired-guess-shell-alist-user and dired-guess-shell-alist-default` for a match for your filename, to get the app. If you know the shell command you want for a given file, then do (dired-do-shell-command THE-SHELL-COMMAND current-prefix-arg THE-FILES-TO-ACT-ON) in the Emacs command you bind to a key. – Drew Apr 23 '16 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.