Emacs Stuff
Make Emacs work on OSX Catalina
It's a bit of a mess. There's a security setting or something that nobody seems to be able to figure out, that stops Emacs opening files from Finder if it's already running.
To (hopefully temporarily) fix, open up Automator from launchpad, New -> Application.
Select Run Shell Script.
Use /bin/bash as the shell from the dropdown, and pick as arguments in the 'Pass input' dropdown.
Paste in the following:
if ! pgrep Emacs; then
open -a Emacs.app "$1"
sleep 1
shift
fi
for f in "$@"; do
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -c -n "$f"
done
and save it as 'Emacs-opener' or something in the Application folder. Use that app to open files instead of Emacs.app.
Use the following as an emacs alias in your shell:
emacs ()
{
open -a Emacs-opener.app "$@"
}
Change the default text editor in OSX
$ osascript -e 'id of app "Emacs"'
org.gnu.Emacs
$ defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add '{LSHandlerContentType=public.plain-text; LSHandlerRoleAll=org.gnu.Emacs;}'
<reboot>
Emacs commands
M-|
Pipe a region to a shell command/pipe. Prefix with C-u to replace the region with the output.