all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jonas Bernoulli <jonas@bernoul.li>
Cc: stefankangas@gmail.com, emacs-devel@gnu.org, rms@gnu.org
Subject: Re: Adding with-editor to Emacs?
Date: Sat, 02 Sep 2023 09:19:06 +0300	[thread overview]
Message-ID: <8334zxayhx.fsf@gnu.org> (raw)
In-Reply-To: <87a5u5wskw.fsf@bernoul.li> (message from Jonas Bernoulli on Fri,  01 Sep 2023 22:23:43 +0200)

> From: Jonas Bernoulli <jonas@bernoul.li>
> Cc: stefankangas@gmail.com, emacs-devel@gnu.org, rms@gnu.org
> Date: Fri, 01 Sep 2023 22:23:43 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> > Emacs knows very well where to find its corresponding emacsclient.
> >> 
> >> I wasn't aware of that.  How can I make use of that knowledge?  I.e.,
> >> is there a function that answers the question "what is the path of the
> >> emacsclient that was installed with this version of emacs"?
> >
> > When Emacs runs installed, emacsclient is in the same directory where
> > we install the Emacs binary, so emacsclient should be in
> > invocation-directory.
> 
> "I have seen things you wouldn't believe..."
> 
> I wish this was true, but unfortunately keep coming up with new and
> innovative ways of not doing that.  The worst platform is macOS, but I
> also had to add a special case for Debian.  Users or distributions may
> install emacs in a weird location, and then symlink emacs onto $PATH
> (but without doing the same for emacsclient).  It is also possible to
> install multiple versions of emacs in the same directory and append
> version strings to the installed binaries.  To select one of these
> versions a user/distribution may add a symlink named symlink in the
> same directory.  One may or may not do the same for emacsclient.  If
> emacsclient isn't a symlink, then an ancient emacsclient may still be
> leftover from an earlier manual installed that was not properly
> uninstalled. ...

Then I guess you should describe all those atrocities in detail, so
that we could perhaps devise ways of handling it.

Also, since the client-server protocol doesn't change much, there's
usually no need to insist on invoking the emacsclient that came with
this particular Emacs, you can use any other.

> > If Emacs runs uninstalled, emacsclient is in ../lib-src/ relative to
> > invocation-directory.  Whether Emacs runs installed or not is
> > determined by the value of installation-directory: if it's nil, Emacs
> > runs installed.
> 
> ... and that too.

What do you mean? the value of installation-directory is calculated
internally by Emacs.

> >> I agree that there theoretically isn't a need for this library, but it
> >> turned out that just setting EDITOR=emacsclient in the environment of
> >> the sub process also doesn't cut it, because for many users (who never
> >> use emacsclient directly), would have to add some configuration to make
> >> it work.  The core and original functionality provided by with-editor,
> >> is making the configuration unnecessary by using heuristics.
> >
> > Can you elaborate on the configuration that is needed?  I always
> > thought that emacsclient worked for everybody OOTB.
> 
> Sadly that isn't the case, see above.

In what ways does "the above" mean that emacsclient doesn't work OOTB?
Do you mean that emacsclient is installed in a place that just typing
"emacsclient RET" at the shell prompt fails to run it?  If so, that's
a broken installation, and Emacs shouldn't really try to fix that.  Or
do you mean something else?

> Normally these complications are the user's problem.  They may not even
> use emacsclient.  If they don't actively choose to use emacsclient, they
> will never know it is actually broken for them.  If they try to use it
> and it doesn't work, they can decide whether it is worth trying to
> figure out to work around those mistakes.  If they want to use it but
> cannot fix it for themselves, they can contact the people who packaged
> Emacs for them.
> 
> For me the situation was different, I started with something like this
> in one of my packages, effectively forcing users to use "emacsclient":
> 
>   (let ((process-environment process-environment))
>     (setenv "EDITOR"
>             (expand-file-name "emacsclient" invocation-directory))
>     (call-process "git" nil nil nil "commit"))
> 
> Like you I assumed this was a solved problem.
> 
> And then the "I cannot commit anymore" reports started pouring in.

We need to understand better the problems which caused this.  The
usual fallback for

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

is

  (expand-file-name "emacsclient"
                    (expand-file-name "../lib-src/" invocation-directory))

and if that also fails, just use "emacsclient", i.e. find some version
of the client on PATH.  If you are saying this doesn't work, either,
then we need to understand why and in what cases, and then decide
what, if anything, to do about that.



  reply	other threads:[~2023-09-02  6:19 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <85msy98sni.fsf@elpa.gnu.org>
     [not found] ` <E1qbslO-0006oK-RA@fencepost.gnu.org>
2023-09-01 14:38   ` Adding with-editor to Emacs? Jonas Bernoulli
2023-09-01 16:12     ` Eli Zaretskii
2023-09-01 17:25       ` Jim Porter
2023-09-01 17:44       ` Jonas Bernoulli
2023-09-01 18:42         ` Eli Zaretskii
2023-09-01 20:23           ` Jonas Bernoulli
2023-09-02  6:19             ` Eli Zaretskii [this message]
2023-09-02 18:12               ` Jonas Bernoulli
2023-09-02 18:57                 ` Eli Zaretskii
2023-09-02 21:04                   ` Jonas Bernoulli
2023-09-03 17:02                   ` Lynn Winebarger
2023-09-03 17:21                     ` Eli Zaretskii
2023-09-03 18:21                       ` Lynn Winebarger
2023-09-03 18:37                         ` Eli Zaretskii
2023-09-02 19:56                 ` Stefan Kangas
2023-09-02 21:26                   ` Jonas Bernoulli
2023-09-02 23:07                     ` Stefan Kangas
2023-09-03  5:00                   ` Eli Zaretskii
2023-09-02 11:39             ` Michael Albinus
2023-09-02 16:52               ` Jonas Bernoulli
2023-10-17 10:23             ` Michael Albinus
2023-10-17 17:18               ` Manuel Giraud via Emacs development discussions.
2023-10-17 18:09                 ` Michael Albinus
2023-10-17 19:26                   ` Manuel Giraud via Emacs development discussions.
2023-10-17 18:24               ` bug#66598: Missing options from emacsclient man page Peter Oliver
2023-10-18  5:16                 ` Michael Albinus
2023-10-21 13:05                   ` Peter Oliver
2023-10-21 13:31                     ` Eli Zaretskii
2023-10-21 14:35                     ` Michael Albinus
2023-10-29 11:27                       ` Eli Zaretskii
2023-12-17 12:58                         ` Peter Oliver
2023-12-23  9:51                           ` Eli Zaretskii
2023-09-03 14:36           ` Adding with-editor to Emacs? Manuel Giraud via Emacs development discussions.
2023-09-03 15:34             ` Eli Zaretskii
2023-09-03 18:54               ` Manuel Giraud via Emacs development discussions.
2023-09-03 19:26                 ` Eli Zaretskii
2023-09-04  8:21                   ` Manuel Giraud via Emacs development discussions.
2023-09-04 12:18                     ` Eli Zaretskii
2023-09-04 12:44                       ` Manuel Giraud via Emacs development discussions.
2023-09-04 13:18                       ` Manuel Giraud via Emacs development discussions.
2023-09-06  0:59                     ` Richard Stallman
2023-09-05  0:27                   ` Richard Stallman
2023-09-15 21:59                     ` Björn Bidar
2023-09-17 23:03                       ` Richard Stallman
2023-09-18  8:59                         ` Philip Kaludercic
2023-09-20 18:35                           ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8334zxayhx.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jonas@bernoul.li \
    --cc=rms@gnu.org \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.