I use emacs -Q
for reconstruction of the following problem and the output of emacs-version
is
GNU Emacs 25.1.1 (x86_64-unknown-cygwin, GTK+ Version 3.18.9) of 2016-09-17
.
If one tries to complete file-names of files in the root directory "/"
, e.g. by M-:
(file-name-all-completions "cyg" "/")
,
one obtains the error (file-error "Reading directory" "No such file or directory" "/")
.
I would very much appreciate if someone with a working copy of the last git-version of cygwin-emacs could try to reconstruct this problem and report here whether it is fixed in that version of emacs.
Where can I report this problem? Should I report it directly to http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs or rather to https://cygwin.com/ml/cygwin/?
I am asking because file-name-all-completions
is actually a built-in c-function.
My current clumsy workaround is:
(defvar cygwin-root "/cygdrive/c/cygwin64/"
"Reference of the root directory within /cygpath/...")
(defun cygwin-handle-root-dir (operation &rest args)
"Several functions don't work for the root-directory \"/\" in cygwin.
We map this directory here to "
(cond ((eq operation 'file-name-all-completions)
;; second arg is the directory "/"
(when (string-equal (nth 1 args) "/")
(setf (nth 1 args) cygwin-root)
)))
;; Handle any operation we don’t know about.
(let ((inhibit-file-name-handlers
(cons 'cygwin-handle-root-dir
(and (eq inhibit-file-name-operation operation)
inhibit-file-name-handlers)))
(inhibit-file-name-operation operation))
(apply operation args)))
(add-to-list 'file-name-handler-alist '("^/$" . cygwin-handle-root-dir))
cygwin-mount.el
,setup-cygwin
. – Drew Nov 17 '16 at 16:30cygwin-mount.el
. I think this package needs a serious update since there are now built-in functionscygwin-convert-file-name-to-windows
andcygwin-convert-file-name-from-windows
that can partially replace calls tocygpath
. The problems that I describe in the question are very low level. Providing a lisp package to circumvent these problems would be a big hack IMHO. – Tobias Nov 17 '16 at 17:57"Cyg"
, not"cyg"
, in the test:M-: (file-name-all-completions "Cyg" "/")
. That shows("Cygwin.ico" "Cygwin.bat" "Cygwin-Terminal.ico")
. – Drew Nov 17 '16 at 18:07(file-name-all-completions "cyg" "/")
should return at least "cygmount". Under cygwin it makes a big difference whether you call commands ascygpath
or you use built-in commands. External commands can be extremely slow under cygwin. By the way could you test whether you have the built-in functionscygwin-convert-file-name-to-windows
andcygwin-convert-file-name-from-windows
? – Tobias Nov 17 '16 at 18:12cygwin-mount.el
:cygwin-mount-convert-file-name
, which converts, e.g.,//x/
tox:/
and/cygdrive/x/
tox:/
. – Drew Nov 17 '16 at 18:16