5

So I'm getting some pretty strange behaviour when I try to use an Automator service to open new emacs (GNU Version 25.2 with spacemacs) buffers.

In my terminal, the command emacsclient -a '' -c works as expected, opening a new buffer through emacsclient. However, when I make a service in Automator which simply runs a (/bin/bash) shell script: emacsclient -a '' -c I get an error message: The action “Run Shell Script” encountered an error: “emacsclient: could not get terminal name”

On suspicions that this was due to Automator not using some default PATH variable, I tried the following instead: PATH=/usr/local/bin:$PATH emacsclient -c which produced the same error as before.

Next I tried PATH=/usr/bin:/usr/local/bin export PATH; emacsclient -c which produced a different error message: The action “Run Shell Script” encountered an error: “emacsclient: invalid option -- c Try `emacsclient --help' for more information” however why I try that script in my terminal it also gives a similar error which doesn't make much sense to me.

If anyone has suggestions for how to fix this I'd really appreciate it.

Mason
  • 2,981
  • 9
  • 29

1 Answers1

3

The problem is the shell script is running an old version of emacsclient in /usr/bin you need to run the one in Emacs.app/Contents/MacOS/bin/emacsclient. Delete the PATH line and you can use a solution listed here for running emacsclient inside automator Running a macOS service for open with emacs failed with "emacsclient: could not get terminal name mac"

Brett M
  • 178
  • 6