Apologies about the cc snafu! Your new defun does indeed fix the issue, I get t now, not nil anymore. Thanks for looking I to this! Bryan On Fri, 19 Jun 2015 09:35 Eli Zaretskii wrote: > [Please keep the bug address on the CC list.] > > > Date: Fri, 19 Jun 2015 08:27:11 +0100 > > From: Bryan Childs > > > > Okay, the results of the four (file-attributes) calls : > > > > (file-attributes "~/.emacs.d/elpa/magit-20150608.1139" 'string) > > > > (t 1 "myuserid" "Domain Users" (21891 47052 0 0) (21889 5593 0 0) (21886 > 44757 > > 0 0) 0 "drwxrwxrwx" t 0 4203876596) > > > > (file-attributes "~/.emacs.d/elpa" 'string) > > > > (t 1 "myuserid" "Domain Users" (21891 47051 0 0) (21889 7125 0 0) (21886 > 43973 > > 0 0) 0 "drwxrwxrwx" t 0 4203876596) > > > > (file-attributes "~/.emacs.d" 'string) > > > > (t 1 "myuserid" "Domain Users" (21891 47351 0 0) (21890 58800 0 0) > (21434 30664 > > 0 0) 0 "drwxrwxrwx" t 0 4203876596) > > > > (file-attributes "~" 'string) > > > > (t 1 "myuserid" "Domain Users" (21889 6715 0 0) (21889 5641 0 0) (21416 > 1847 0 > > 0) 16384 "drwxrwxrwx" t 0 4203876596) > > > > And yes, I still get nil when running the (file-in-directory-p) call > from emacs > > -Q > > > > As I said last night, my "~" directory is a UNC path, starting with an > FQDN. > > Based on the naming of that FQDN, I suspect it's a windows DFS share, > rather > > than going to a specific server. > > > > Hope that helps. > > Thanks. > > I think I see the problem, and it isn't really specific to MS-Windows. > > Please try the replacement for file-in-directory-p below. If it > solves your problem, I will push the changes required to fix this. > > (defun file-in-directory-p (file dir) > "Return non-nil if FILE is in DIR or a subdirectory of DIR. > A directory is considered to be \"in\" itself. > Return nil if DIR is not an existing directory." > (let ((handler (or (find-file-name-handler file 'file-in-directory-p) > (find-file-name-handler dir 'file-in-directory-p)))) > (if handler > (funcall handler 'file-in-directory-p file dir) > (when (file-directory-p dir) ; DIR must exist. > (setq file (file-truename file) > dir (file-truename dir)) > (let ((ls1 (split-string file "/" t)) > (ls2 (split-string dir "/" t)) > (root > (cond > ;; A UNC on Windows systems, or a "super-root" on Apollo. > ((string-match "\\`//" file) "//") > ((string-match "\\`/" file) "/") > (t ""))) > (mismatch nil)) > (while (and ls1 ls2 (not mismatch)) > (if (string-equal (car ls1) (car ls2)) > (setq root (concat root (car ls1) "/")) > (setq mismatch t)) > (setq ls1 (cdr ls1) > ls2 (cdr ls2))) > (unless mismatch > (file-equal-p root dir))))))) >