Open yalfg opened 3 weeks ago
This would address the issue, I think, but you would still have to set the new variable, and I don't currently have the time to make sure this wouldn't cause any breakage and that there isn't a better way that would not require that users set that variable.
@@ -111,6 +111,9 @@ (defun with-editor-locate-emacsclient ()
current Emacs instance failed. For more information
please see https://github.com/magit/magit/wiki/Emacsclient."))))
+(defvar with-editor-invocation-suffixes
+ (list "-snapshot" ".emacs-snapshot"))
+
(defun with-editor-locate-emacsclient-1 (path depth)
(let* ((version-lst (cl-subseq (split-string emacs-version "\\.") 0 depth))
(version-reg (concat "^" (string-join version-lst "\\."))))
@@ -128,7 +131,7 @@ (defun with-editor-locate-emacsclient-1 (path depth)
(setq v (string-join (reverse v) "."))
(list v (concat "-" v) (concat ".emacs" v)))
(reverse version-lst))
- (list "" "-snapshot" ".emacs-snapshot")))
+ (cons "" with-editor-invocation-suffixes)))
(lambda (exec)
(ignore-errors
(string-match-p version-reg
Thanks! I've just compiled the Emacs 30 pre-release and besides a suffix (the only thing I've used) it's possible to add a prefix and even a general modifier. Extracted from the configure help:
Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
So trying to second guess all this and in particular the sed
option seems too brittle. And it may not be much used too.
There's a variable emacsclient-program-name
(new in Emacs 30), which seems perfect. Unfortunately it doesn't take into account the above transformation: on my build with the -fsf
suffix its value is still emacsclient
and not emacsclient-fsf
as it should. So maybe it would be best to take this upstream, and make sure this variable reflects the actual client name? Then there would be a simple and reliable way from then on, and the current heuristics can remain for older Emacsen?
New work is arriving at an unsustainable rate right now, so I won't be able to deal with this for the foreseeable future.
Not a problem at all, I actually forgot about this and noticed it again while doing a clean-up pass on my init.el
. And nobody else mentioned it before. So it can definitely wait some ;)
I submitted an upstream bug on the content of emacsclient-program-name
. A proper value would really be the nicest way to deal with this: why doing fancy heuristics when Emacs should be able to tell us the right value? I'll update here if there's some follow-up (I guess it'll also be low prio for upstream. But it may be an easier fix there. We'll see).
Thanks
FYI, now covered by upstream Emacs bug #74157. But not as simple as it may seem, so too late for Emacs 30 and to be improved in version 31.
Hi,
When Emacs is compiled with a suffix (configure option "--program-suffix=-fsf" in my case), with-editor cannot find the matching emacsclient. I work-around the issue with the following code in my init:
FYI, I'm using the suffix to be able to co-install my distribution version of Debian and a manually compiled upstream Debian, for which I use the "-fsf" suffix. In this configuration, with-editor picks the distribution emacsclient instead of the matching one with same suffix.
Here's the debug output FYI:
And by the way, thanks for both Magit and with-editor ;)