magit / with-editor

Use the Emacsclient as the $EDITOR of child processes
http://magit.vc/manual/with-editor
GNU General Public License v3.0
185 stars 45 forks source link

Have `with-editor-emacsclient-path` look in lib-src? #67

Closed girzel closed 4 years ago

girzel commented 4 years ago

I often run Emacs directly out of a build directory, and it is especially in this situation that I need with-editor to be smartest about finding the right "emacsclient"!

In my build (I would assume this is the same for everyone?), the emacsclient is in ./lib-src, and not in ./src, where with-editor seems to be looking.

Thanks!

tarsius commented 4 years ago

Do you actually experience issues because of this, or do you just assume that it is a problem that things are the way you observe them to be?

I also usually run emacs without installing. Lets have a look:

with-editor: /home/jonas/.emacs.d/lib/with-editor/with-editor.el
emacs: /home/jonas/git/src/emacs/master/src/emacs (27.0.50)
system:
  system-type: gnu/linux
  system-configuration: x86_64-pc-linux-gnu
  system-configuration-options: --without-compress-install --with-imagemagick --with-x-toolkit=gtk3 --with-modules CFLAGS=-no-pie
server:
  server-running-p: t
  server-process: #<process server>
  server-use-tcp: nil
  server-name: server
  server-socket-dir: /run/user/1000/emacs
    server
  server-auth-dir: ~/.emacs.d/server/
    WARNING: not an accessible directory
with-editor-emacsclient-executable:
 value:   /home/jonas/git/src/emacs/master/lib-src/emacsclient (27.0.50)
 default: /home/jonas/git/src/emacs/master/lib-src/emacsclient (27.0.50)
 funcall: /home/jonas/git/src/emacs/master/lib-src/emacsclient (27.0.50)
path:
  $PATH: "/home/jonas/git/src/git-cinnabar:/home/jonas/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin:/home/jonas/git/src/go/bin"
  exec-path: (/home/jonas/git/src/git-cinnabar /home/jonas/bin /usr/local/bin /usr/bin /bin /usr/local/games /usr/games /usr/local/go/bin /home/jonas/git/src/go/bin /home/jonas/git/src/emacs/master/lib-src)
  with-editor-emacsclient-path:
    /home/jonas/git/src/emacs/master/src (t)
    /home/jonas/git/src/git-cinnabar (t)
    /home/jonas/bin (t)
    /usr/local/bin (t)
      /usr/local/bin/emacsclient (26.3)
      /usr/local/bin/emacsclient-25.1 (25.1)
      /usr/local/bin/emacsclient-26.1.92 (26.1.92)
      /usr/local/bin/emacsclient-26.2 (26.2)
      /usr/local/bin/emacsclient-26.2.90 (26.2.90)
      /usr/local/bin/emacsclient-26.3 (26.3)
    /usr/bin (t)
    /bin (t)
    /usr/local/games (t)
    /usr/games (t)
    /usr/local/go/bin (t)
    /home/jonas/git/src/go/bin (t)
    /home/jonas/git/src/emacs/master/lib-src (t)
      /home/jonas/git/src/emacs/master/lib-src/emacsclient (27.0.50)
      /home/jonas/git/src/emacs/master/lib-src/emacsclient.c (nil)

In my build (I would assume this is the same for everyone?), the emacsclient is in ./lib-src, and not in ./src, where with-editor seems to be looking.

Actually both src and lib-src are on the exec-path. Also it is emacs who puts them there, not with-editor.

I don't know why emacs puts lib-src at the end of exec-path, but it does not make a difference because with-editor looks at the emacsclients that it finds earlier on the path (here the /usr/local/bin/emacsclient from 26.3) and decides to not use them because they are for an older emacs version. Eventually it looks at the emacsclient in lib-src and decides to use that.

Does something else happen with your setup?

girzel commented 4 years ago

with-editor can't currently find the emacsclient executable at all, and I had to hard-code with-editor-emacsclient-executable in order to stop it complaining every time I switched to a different magit project. If I eval (with-editor-emacsclient-path) I get:

I didn't see any mention of lib-src inside with-editor.el, so I just assumed that wasn't being checked. But now I've checked with "emacs -Q" and (package-initialize), and the result of the above call is exactly the same, but with "/home/eric/dev/emacs/lib-src" added at the end.

Sorry -- should have checked that first. I don't know why any other packages would be messing with this process, but obviously it's something in my config. I'll figure it out on my own time!

Thanks, Eric