Subject: bug#73728: closed (Re: bug#73728: 29.3; Specifing an --alternate-editor for emacscleintw.exe with custom --init-directory does not work on Windows)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 14 Oct 2024 14:21:03 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
73728: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73728
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#73728: 29.3; Specifing an --alternate-editor for emacscleintw.exe with custom --init-directory does not work on Windows
From: Eli Zaretskii <[email-masked]>
To: Jonas Großekathöfer <[email-masked]>
Cc: [email-masked]
Date: Mon, 14 Oct 2024 17:09:30 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Mon, 14 Oct 2024 10:14:45 +0200
> From: Jonas Großekathöfer <[email-masked]>
> Cc: [email-masked]
> 
>  Do you mean like how in the first example I gave?
>   
>  -a "%UserProfile%\bin\emacs-29.3\bin\runemacs.exe --init-directory
>  %AppData%\Dotfiles\emacs\.emacs.d\"
>   
>  That one gives "file name or Argument required. Try --help"
> 
>  First, remove the last backslash before the closing quote" it prevents
>  the closing quote from being recognized.  And if that doesn't help,
>  maybe we have a real bug.
>   
>  
> That was it! Thank you, it's working now. (:

Thanks, I'm therefore closing this non-bug.

Subject: 29.3; Specifing an --alternate-editor for emacscleintw.exe with custom --init-directory does not work on Windows
From: Jonas Großekathöfer <[email-masked]>
To: [email-masked]
Date: Thu, 10 Oct 2024 08:56:43 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi all,

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\"

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

And one additional observation: From my many attempts, related or not, I 
also got the impression, that I am closer to what I want ommiting the 
--daemon flag within the argument for the -a flag. However, I need it 
when linking to runemacs.exe directly.

This is my first bug report to this mailing list, hope it contributes a 
tiny tiny bit. (:

Best

Jonas

In GNU Emacs 29.3 (build 2, x86_64-w64-mingw32) of 2024-03-24 built on
  AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.19045
System Description: Microsoft Windows 10 Enterprise 
(v10.0.2009.19045.4894)

Configured using:
  'configure --with-modules --without-dbus --with-native-compilation=aot
  --without-compress-install --with-sqlite3 --with-tree-sitter
  CFLAGS=-O2'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB

(NATIVE_COMP present but libgccjit not available)

Important settings:
   value of $LANG: DEU
   locale-coding-system: cp1252

Major mode: Org-Agenda Week Ddl Grid

Minor modes in effect:
   hl-line-mode: t
   server-mode: t
   consult-notes-org-headings-mode: t
   consult-notes-denote-mode: t
   denote-menu-bar-mode: t
   eat-eshell-mode: t
   shell-dirtrack-mode: t
   vertico-mode: t
   savehist-mode: t
   winner-mode: t
   save-place-mode: t
   global-auto-revert-mode: t
   recentf-mode: t
   windmove-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   blink-cursor-mode: t
   buffer-read-only: t
   line-number-mode: t
   transient-mark-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t

Load-path shadows:
c:/Users/XXX/Dotfiles/emacs/.emacs.d/elpa/transient-0.7.4/transient 
hides c:/Users/gross20/bin/emacs-29.3/share/emacs/29.3/lisp/transient

Features:
(shadow sort mail-extr emacsbug mule-util cal-move crm time-stamp tabify
org-datetree org-capture timezone misearch multi-isearch cursor-sensor
hl-line org-duration diary-lib diary-loaddefs cal-iso vc-git diff-mode
easy-mmode vc-dispatcher org-indent oc-basic ol-eww eww url-queue
thingatpt mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr
pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo
parse-time gnus-spec gnus-int gnus-range message sendmail yank-media
puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mailabbrev gmm-utils mailheader gnus-win gnus nnheader gnus-util
mail-utils range mm-util mail-prsvr ol-docview doc-view jka-compr
image-mode exif ol-bibtex bibtex iso8601 ol-bbdb ol-w3m ol-doi
org-link-doi cl-extra help-mode face-remap org-agenda org-element
org-persist xdg avl-tree server consult-notes-denote
consult-notes-org-headings consult-notes consult-org consult denote
dired dired-loaddefs xref project org-bookmark-heading bookmark pp
mode-local ob-shell ob-R org-attach org-id org-refile org-tempo org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint
org-pcomplete org-list org-footnote org-faces org-entities time-date
noutline outline icons ob-emacs-lisp ob-core ob-eval org-cycle org-table
ol rx org-fold org-fold-core org-keys oc org-loaddefs find-func cal-menu
calendar cal-loaddefs org-compat tempo org-version org-macs format-spec
esh-var esh-mode esh-cmd generator esh-ext esh-opt esh-proc esh-io
esh-arg esh-module esh-groups esh-util files-x eat term ehelp shell
pcomplete color orderless vertico-directory vertico wgrep grep compile
text-property-search comint ansi-osc ansi-color savehist winner ring
saveplace autorevert filenotify recentf tree-widget wid-edit windmove
modus-operandi-theme modus-themes no-littering compat compat-30
finder-inf consult-notes-autoloads consult-recoll-autoloads
consult-autoloads denote-autoloads eat-autoloads elpa-mirror-autoloads
ess-autoloads magit-autoloads pcase git-commit-autoloads
magit-section-autoloads dash-autoloads no-littering-autoloads
orderless-autoloads org-bookmark-heading-autoloads quelpa-autoloads
s-autoloads transient-autoloads vertico-autoloads wgrep-autoloads
with-editor-autoloads info compat-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table
term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 1381967 381324)
  (symbols 48 31590 3)
  (strings 32 149124 80555)
  (string-bytes 1 4074814)
  (vectors 16 79509)
  (vector-slots 8 1761299 703656)
  (floats 8 492 1171)
  (intervals 56 74316 5304)
  (buffers 984 16))