emacs -Q for reconstruction of the following problem and the output of
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))