GNU bug report logs - #73728
29.3; Specifing an --alternate-editor for emacscleintw.exe with custom --init-directory does not work on Windows

Previous Next

Package: emacs;

Reported by: Jonas Großekathöfer <jonas <at> grszkth.fr>

Date: Thu, 10 Oct 2024 10:56:01 UTC

Severity: normal

Found in version 29.3

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jonas Großekathöfer <jonas <at> grszkth.fr>
Cc: 73728 <at> debbugs.gnu.org
Subject: bug#73728: 29.3; Specifing an --alternate-editor for emacscleintw.exe with custom --init-directory does not work on Windows
Date: Thu, 10 Oct 2024 14:39:55 +0300
> Date: Thu, 10 Oct 2024 08:56:43 +0200
> From:  Jonas Großekathöfer via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> I want emacsclientw.exe to start up an emacs daemon with a custom --init-directory in case no server is
> running. For that case, I think, I need to explicitly set the value for the "--alternate-editor"-flag to something
> like:
> 
> -a "%UserProfile%\bin\emacs-29.3\bin\runemacs.exe --init-directory
> %APPDATA%\Dotfiles\emacs\.emacs.d\"

Can you explain why you need a custom --init-directory in that case?

> However, doing so results in the following error: "file name or argument required". This is also true when
> specifing a relative path (i.e. AppData\Dotfiles\emacs\.emacs.d\).
> 
> After some more trials with single and/or double qoutes (details see below), I got the impression that this
> behavior is unlikely intentional. And I am somewhat confident, that more then one oy my many attempts
> should've been successful. (Note that I raised this issue first here:
> https://emacs.stackexchange.com/a/82355/30098)
> 
> For completeness, the full comand ("Target") I am trying to run is: 
> 
> %UserProfile%\bin\emacs-29.3\bin\emacsclientw.exe -a '%UserProfile%\bin\emacs-29.3\bin\runemacs.exe -
> -init-directory "AppData\Dotfiles\emacs\.emacs.d\"' -n -c --server-file
> %APPDATA%\Dotfiles\emacs\.emacs.d\server\server 
> 
> that command starts in
> 
> %UserProfile%
> 
> ATM, I have as a work around a shortcut to emacscleintw.exe without an -a flag. Before using it, I once have
> to run:
> 
> %UserProfile%\bin\emacs-29.3\bin\runemacs.exe --daemon ----init-directory
> %APPDATA%\Dotfiles\emacs\.emacs.d\
> 
> Obviously, I would rather have to have it all in one place.
> 
> And here are the Details, regarding the use of quotes with or without relative path for --init-directory:
> 
> For the several options using quotes, I got the following problems, depending on whether I put single or
> double quoutes for the whole argument or just the path:
> 
> Double quotes around the argmument and single quotes for the path, using the full path:
> 
> -a "%UserProfile%\bin\emacs-29.3\bin\runemacs.exe --init-directory
> '%APPDATA%\Dotfiles\emacs\.emacs.d\'"
> 
> --> Warning: "Warning (initialization): Unable to create `user-emacs-directory'
> (c:/Users/gross20/'C:/Users/gross20/AppData/Roaming/Dotfiles/emacs/.emacs.d/'/)."
> 
> Single quotes around the argmument and double quotes for the path, using the full path:
> 
> -a '%UserProfile%\bin\emacs-29.3\bin\runemacs.exe --init-directory
> "%APPDATA%\Dotfiles\emacs\.emacs.d\"'
> 
> --> Error: Try --help for more information
> 
> Double quotes around the argmument and single quotes for the path, using a relative path:
> 
> -a "%UserProfile%\bin\emacs-29.3\bin\runemacs.exe --init-directory
> 'AppData\Roaming\Dotfiles\emacs\.emacs.d\'"
> 
> --> Strarts without errors or warning, but the user-emacs-directory is
> "c:/Users/XXX/'AppData/Roaming/Dotfiles/emacs/.emacs.d/'/" (Note the single quote in the folder name for
> AppData)
> 
> Single quotes around the argmument and single quotes for the path, using a relative path:
> 
> -a '%UserProfile%\bin\emacs-29.3\bin\runemacs.exe --init-directory "AppData\Dotfiles\emacs\.emacs.d\"'
> 
> --> Error: Try --help for more information

Don't use single quotes, they are not supported by Windows.

But I admit I don't understand why you needed nested quotes at all.
What happens if you use double quotes around the entire argument of
the -a option?




This bug report was last modified 220 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.