reddit / emacs

Improving on Emacs macOS sharing (via completing-read)

xenodium · 2022-10-12 19:45
xenodium · 2022-10-12 19:49
Quick update with [improvements](https://xenodium.com/emacs-macos-sharing-dwim-style-improved) to [macOS sharing (DWIM style)](https://www.reddit.com/r/emacs/comments/y1tneh/macos_sharing_dwim_style)
Jack-o-tall-tales · 2022-10-12 22:24
Really cool! You might want to look into transient (the library used for magit's popups) too. You could map over the lost of sharing methods and produce different transient commands for each one (this would allow for rich options as well). I could see that working really well.
__karlota__ · 2022-10-12 23:28
Fantastic!
Silentroar23 · 2022-10-13 01:15
Is the frame shown in your video by plain Emacs? It looks utterly amazing!
[deleted] · 2022-10-13 04:58
Nice. Do you build Emacs with native macOS tab support? Here's the very basic patch I use: https://git.paulwrankin.com/dotfiles/tree/emacs/fix-tabs.patch I've tried to get this adopted upstream but emacs-devel are, well, you know...
xenodium · 2022-10-13 06:18
Ah thanks. Didn’t know about it. You prolly already know this, but Emacs plus makes it fairly easy to manage additional macOS patches. I did a tiny one here https://xenodium.com/no-emacs-frame-refocus-on-macos/
xenodium · 2022-10-13 06:23
Emacs plus with native comp https://xenodium.com/emacs-plus-with-native-comp/
[deleted] · 2022-10-13 07:17
Excellent, that is a patch I will be applying! I just build from source. Used to track the git repo but now just fetch the release tarball.
tdstoff7 · 2022-10-13 10:20
This is great! I'm selfishly quite happy you push these features for MacOS, I upgrade the package every time I see your posts on Reddit now. Have you considered the idea of a similar "Open with" command where you can pick a (non-default) application from the completion list? I always thought that could be a cool little productivity boost.
xenodium · 2022-10-13 10:27
Thanks. Gives me an excuse to play with transient. Been meaning to take a look.
xenodium · 2022-10-13 10:30
That works too. Emacs plus has a bunch of optional patches controlled with flags. They have a ton of icons too. I like the one in https://xenodium.com/emacs-plus-with-native-comp
Jack-o-tall-tales · 2022-10-13 10:37
Brief word of advice: I found it *much* easier to grok by looking at some simple examples in other's work. The Transient manual is very dense and technical -- great if you need it, but a portable introduction to writing anything basic.
xenodium · 2022-10-13 11:15
>This is great! I'm selfishly quite happy you push these features for MacOS Nice to hear. Glad you like them. >Have you considered the idea of a similar "Open with" command where you can pick a (non-default) application Not done much testing, but this seems to kinda work. (defun dwim-shell-commands-macos-open-with () "Convert all marked images to jpg(s)." (interactive) (let* ((apps (seq-sort #'string-lessp (seq-mapcat (lambda (paths) (directory-files-recursively paths "\\.app$" t (lambda (path) (not (string-suffix-p ".app" path))))) '("/Applications" "~/Applications" "/System/Applications")))) (selection (progn (cl-assert apps nil "No apps found") (completing-read "Open with: " (mapcar (lambda (path) (propertize (file-name-base path) 'path path)) apps))))) (dwim-shell-command-on-marked-files "Open with" (format "open -a '%s' '<<*>>'" (get-text-property 0 'path selection)) :silent-success t :no-progress t :utils "open"))) edit: Removed paths from completing-read and sorted list. Also added it to dwim-shell-commands.el because why not.
xenodium · 2022-10-13 11:18
Makes sense > looking at some simple examples in other's work Got concrete ones handy?
tdstoff7 · 2022-10-13 13:12
Very nice. Shouldn't that 3rd-to-last line should be: (dwim-shell-commands--macos-apps file)) Otherwise it pulls up the completing-read for me, but get an error as follows after selection. Must not be grabbing the application name correctly. Can dig into it a little later. +zsh:1> open -a nil /Users/Shared/articles/allaire2002five.pdf Unable to find application named 'nil'
xenodium · 2022-10-13 13:53
Oops, forgot to rename function invoked. Updated.
takeonrules · 2022-10-15 23:40
In my dotemacs, I have a few transient-prefixes and one or two transient suffixes: https://github.com/jeremyf/dotemacs/blob/7ea0aa5a6db6a0217f345413033188f2dfa7cdfa/emacs.d/configuration.org?plain=1#L4322
xenodium · 2022-10-16 08:17
Thanks