Skip to content

How to reliably locate the executable of emacsclient #15

@akirak

Description

@akirak

Hello, thanks for creating this great package. I found it to be extremely useful, but I have encountered an issue relating to my installation.

I am using nix run (a feature from Nix flakes) to run Emacs without installing it. If you don't know nix run, think of it like docker run. It can start a program without installing its executable to a global location. emacs-everywhere tries to spawn emacsclient from inside an Emacs session, which fails, because emacsclient is unavailable in my PATH.

In my case, replacing the executable name with

(expand-file-name "emacsclient" invocation-directory)

would work. It would be possible to handle the issue by adding a custom variable named emacs-everywhere-emacsclient-executable. It can be done quickly.

A more thorough solution, however, would be to use with-editor package developed by tarsius, the person behind magit. This package contains with-editor-locate-emacsclient function which locates emacsclient executable in a reliable manner, which will be better than the solution I showed above.

It also seems to contain helper functions for emacsclient sessions, such as with-editor-finish, with-editor-cancel, etc. Those functions might be useful to you for a more consistent behaviour. At a first glance, it doesn't look easy to rewrite your package to utilize those utilities, due to some duplicated logic between the two packages. I haven't examined the idea in detail.

What do you think? Would you consider use of with-editor package? For me, use of with-editor-locate-emacsclient would probably be sufficient, so if you can accept the extra dependency, I will submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions