- Download Emacs from https://emacsformacosx.com or use your favorite distribution, but then make sure to have an
EMACSCLIENTpath exported - Create
~/bin/emacsclient - Create
~/bin/edit - Make sure
~/binis on yourPATHand has precedence over/usr/bin(otherwise the default MacOSemacsclientwill be visible, which you should avoid) - Edit your
emacs.el
Last active
May 14, 2017 22:41
-
-
Save alexandru/9cfe4bf1db629b7a7065146fdeb0e12e to your computer and use it in GitHub Desktop.
Getting emacsclient to work with https://emacsformacosx.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| exec emacsclient -c -n $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (load "server") | |
| (unless (server-running-p) (server-start)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| path="${EMACSCLIENT:-/Applications/Emacs.app/Contents/MacOS/bin/emacsclient}" | |
| if [ ! -f "$(which lsof)" ]; then | |
| osascript -e 'tell application "System Events" to display dialog "Make sure you have `lsof` installed on your system." buttons "OK" default button 1 with title "Unable to locate system utility"' >/dev/null 2>&1 & | |
| exit 1 | |
| fi | |
| if [ ! -f "$path" ]; then | |
| osascript -e 'tell application "System Events" to display dialog "Make sure you have Emacs for Mac installed on your system, go to emacsformacosx.com" buttons "OK" default button 1 with title "Unable to locate Emacs"' >/dev/null 2>&1 & | |
| exit 2 | |
| fi | |
| socket_file=$(lsof -c Emacs | grep server | tr -s " " | cut -d' ' -f8) | |
| if [[ $socket_file == "" ]]; then | |
| exec "$path" --alternate-editor="" $@ | |
| else | |
| exec "$path" -s $socket_file $@ | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment