Zamansky 71: Openwith

Mike Zamansky, freshly back from a bout with COVID-19, has a new video in his Using Emacs Series that considers the openwith package. The backstory is a long standing annoyance in Zamansky’s workflow: although he can open non-text files such as PDFs, PNGs, docx, and others, he can’t edit them and Emacs will choke if the file is too large.

What he wanted was an easy way to choose a file from Dired and open it with an external app—LibreOffice for docx, for example. That would save him from cluttering his desktop with a bevy of unneeded windows. The openwith package lets you associate an application with a list of file extensions and Emacs will use that application to open any files with that extension. In particular, if you type Return on a file in Dired, it will be opened in the external application instead of Emacs.

There is, I think, a problem with this solution: it’s all or nothing. Either the file is opened normally in Emacs or it is always opened by the external app. You can’t choose. Even if you open the file normally with find-file, the external application will be invoked. In some cases, it’s convenient to use the external app, and it others it’s more convenient to open the file in Emacs but with openwith you can’t choose. Zamansky also sees this as a problem but feels he can live with it and, of course, he can always turn off openwith. To be sure, that’s a pain but the need to use both Emacs and an external application on the same file type is apparently rare in Zamansky’s workflow.

In the comments, Zamansky offers an update saying that he’s discovered that openwith interferes with his mail client, mu4e. That’s a deal breaker and Zamansky will probably hunt for another solution. If you aren’t a mu4e user, you may find openwith a useful addition to your workflow.

The video is 14 minutes long so schedule some time. As usual with Zamansky’s videos, you won’t want to miss watching it.

This entry was posted in General and tagged . Bookmark the permalink.