Closed simonmichael closed 5 years ago
Usually the issue is that the proper emacsclient
executable cannot be determined. It appears that the issue in this case is that the server cannot even be started.
The relevant part of the output should look something like this:
server:
server-running-p: t
server-process: #<process server>
server-use-tcp: nil
server-name: server
server-socket-dir: /tmp/emacs1000
server
server-auth-dir: ~/.emacs.d/server/
WARNING: not an accessible directory
Try starting the server manually and take note of the errors doing that throws at you. It probably has something to do with /var/folders/r7/f9j9c2zd1k97v47cr84j_qvc0000gn/T//emacs501
not being an accessible directory. That's probably a Nix thing--it probably should just use /tmp/emacs<PID>
like everyone else.
Thanks for the hints @tarsius. I believe that long tmp folder path is a mac thing. It does seem accessible, my user can read/write there. I found that M-x server-start works without error, and then I could use /Users/simon/.nix-profile/bin/emacsclient without error. /usr/bin/emacsclient does not work of course. This one is first in path, at least for GUI-invoked apps, and I think that might be the issue. Unfortunately it's hard to remove in OSX Mojave.
I found that M-x server-start works without error,
However this part
server:
server-running-p: nil
indicates that with-editor
failed to start the server.
You could probably add (server-start)
to your init file to work around that. If that does work, then you might also want to investigate why doing that explicitly succeeds but fails when done by with-editor--setup
.
But maybe the failure to start the server is due to the failure to locate the appropriate emacsclient
; I didn't have to deal with such issues in a while. Even if it is not, then the latter is simply another issue we have to deal with before you can start committing.
with-editor
has to find the emacsclient
executable based on the location of the emacs
executable from which the current instance was started (and by comparing their version strings). While not trivial that is simple enough on reasonable operating systems, where the two executables are located in the same directory and we only have to compare the versions. On macOS this is a whole other story because here the two executables are not located in the same directory. To add insult to injury the relative path from the emacs
to the emacsclient
executable is different depending on who did the packaging and the phase of the moon.
Your emacs
executable is at /nix/store/XXXX-emacs-26.1/Applications/Emacs.app/Contents/MacOS/Emacs
. Search nearby directories for the emacsclient
executable and report your findings. We probably have to add yet another kludge for this particular packaging of Emacs on macOS.
It does seem accessible, my user can read/write there.
file-accessible-directory-p
disagrees.
Thanks for with-editor and magit. Emacs installed with nix-env fails to find an emacsclient here. (I removed emacs-plus from homebrew but that didn't help.)