compute/emacs-stuff.md
... ...
@@ -1,5 +1,32 @@
1 1
# Emacs Stuff
2 2
3
+### Make [Emacs](https://emacsformacosx.com/) work on OSX Catalina
4
+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.
5
+
6
+To (hopefully temporarily) fix, open up Automator from launchpad, New -> Application.
7
+Select Run Shell Script.
8
+Use `/bin/bash` as the shell from the dropdown, and pick `as arguments` in the 'Pass input' dropdown.
9
+Paste in the following:
10
+```
11
+if ! pgrep Emacs; then
12
+ open -a Emacs.app "$1"
13
+ sleep 1
14
+ shift
15
+fi
16
+for f in "$@"
17
+do
18
+ /Applications/Emacs.app/Contents/MacOS/bin/emacsclient -c -n "$f"
19
+done
20
+```
21
+and save it as 'Emacs-opener' or something in the Application folder. Use that app to open files instead of Emacs.app.
22
+Use the following as an emacs alias in your shell:
23
+```
24
+emacs ()
25
+{
26
+ open -a Emacs-opener.app "$@"
27
+}
28
+```
29
+
3 30
### Change the default text editor in OSX
4 31
5 32
```