reddit / emacs
macOS DWIM "Open with" command (ok, last one for a while)
xenodium · 2022-10-14 16:35
xenodium · 2022-10-14 16:37
Inspired by u/tdstoff7's [comment](https://www.reddit.com/r/emacs/comments/y2dfma/comment/is4ygl8/?context=3), here's an "Open with" command. [https://xenodium.com/emacs-open-with-macos-app](https://xenodium.com/emacs-open-with-macos-app).
eleven_cupfuls · 2022-10-14 16:45
I've never really gotten into the groove of using dired, but these integrations of yours might make me try it again. Nice work!
xenodium · 2022-10-14 16:59
Hey, nice to hear. Dired is a powerhouse. I only scratch the surface and still get plenty out of it.
I've written about some dired customizations before:
* [Show/hide Emacs dired details in style](https://xenodium.com/showhide-emacs-dired-details-in-style)
* [Batch file renaming with counsel, find-dired, and wdired](https://xenodium.com/batch-renaming-with-counsel-find-dired-and-wdired)
* [Emacs dired for batch byte compilation](https://xenodium.com/emacs-dired-for-batch-byte-compilation)
* [Drill down Emacs dired with dired-subtree](https://xenodium.com/drill-down-emacs-dired-with-dired-subtree)
Also the [Emacs Rocks dired video](https://emacsrocks.com/e16.html) is great.
ps. If you aren't spending much time on dired, [dwim-shell-command](https://github.com/xenodium/dwim-shell-command) also operates on current buffer files.
edit: typo
HumanBrainMapper · 2022-10-14 20:07
I use dired a lot and I am always up for new developments, but I just don't get DWIM as I feel a lot of functions that you built specialized commands for can be done without the need for DWIM. Your current example for instance:
1) Mark the files in dired \`m
2) \`0 w\` copy their full paths to the clipboard
3) M-x shell-command
4) type 'gimp' and paste the paths
Again, I am not saying that there is no use for your package. I just feel that a lot of it can be done without all the overhead. Happy to hear your thoughts on this.
xenodium · 2022-10-14 20:55
Ah yeah, for a simple case, it's somewhat equivalent (yet some saving still):
`m 0 w M-x shell ↵ gimp C-y ↵`
vs
`m M-x dw with ↵ gi ↵`
It's the more involved commands I can never remember that I get the most benefit from. Say convert video to webp:
`ffmpeg -i '<<f>>' -vcodec libwebp -filter:v fps=fps=10 -compression_level 3 -lossless 1 -loop 0 -preset default -an -vsync 0 '<<fne>>'.webp`
It's easier for me to dired select files and `M-x dw to-webp`.
edit: typo
[deleted] · 2022-10-15 03:13
Very cool again!
Although this is a case where I'd find it simpler to configure `dired-guess-shell-alist-user` from `dired-x` ([manual entry](https://www.gnu.org/software/emacs/manual/html_node/dired-x/Shell-Command-Guessing.html)).
Then it's just a case of `!` on the file.
DefiantAverage1 · 2022-10-15 03:29
Nooo, please keep posting!
xenodium · 2022-10-15 12:10
Ah yes, `dired-guess-shell-alist-user ` is handy, but it needs setting in advance. The new command offers completion from all apps, so can easily change mind to open with a different app. These dwim commands also operate on files associated with buffers, giving a little consistency.
xenodium · 2022-10-15 12:21
Glad you like the posts. https://github.com/xenodium/dwim-shell-command/blob/main/dwim-shell-commands.el has a handful of commands I haven’t posted about. There’s also all previous posts at https://xenodium.com
terminal_cope · 2022-10-15 13:57
For involved commands I want to reuse I just append a comment to the end to make it searchable. This goes for in the terminal too. An extra benefit is they're editable (though remove the comment if you don't want it to be the new default).
xenodium · 2022-10-15 14:28
Ah, neat. I hadn't considered appending comments for searchability. I'm currently getting searchabiity from `M-x dwim-...` and [ivy](https://github.com/abo-abo/swiper) completion.
HumanBrainMapper · 2022-10-16 18:54
Thanks for your feedback.
tdstoff7 · 2022-10-23 11:55
u/xenodium How did you handle the aliasing issue where `open -a` doesn't work with the argument `GIMP-2.10`, but needs [`GIMP-2.10.app`](https://GIMP-2.10.app)? [Link](https://gitlab.gnome.org/GNOME/gimp/-/issues/1952)
xenodium · 2022-10-23 13:52
Ah, I hadn’t but can likely add a bit of logic to compensate. Pull request totally welcome, otherwise will give it a try later today.
xenodium · 2022-10-23 14:01
Saw the bug filed. Thank you. Will give it a try later on.
xenodium · 2022-10-23 15:27
Looking into it, but cant' reproduce with GIMP-2.10. How did you install it on your mac? I installed via \`brew install gimp\`. May be better to follow-up in the [issue](https://github.com/xenodium/dwim-shell-command/issues/5) itself.