unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Bryan Childs <godeater@gmail.com>
Cc: 20844@debbugs.gnu.org
Subject: bug#20844: 25.0.50; Packages installed with package.el show up as status 'External' in the list-packages buffer
Date: Fri, 19 Jun 2015 11:35:42 +0300	[thread overview]
Message-ID: <83vbekjdsx.fsf@gnu.org> (raw)
In-Reply-To: <CAFMvb4u5_9eY+29pPt-6RO3KdwM=9WnXCRkJpTftW5hffF_7Wg@mail.gmail.com>

[Please keep the bug address on the CC list.]

> Date: Fri, 19 Jun 2015 08:27:11 +0100
> From: Bryan Childs <godeater@gmail.com>
> 
> 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)))))))





  parent reply	other threads:[~2015-06-19  8:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-18 12:45 bug#20844: 25.0.50; Packages installed with package.el show up as status 'External' in the list-packages buffer Bryan Childs
2015-06-18 16:13 ` Eli Zaretskii
2015-06-18 19:21   ` Bryan Childs
2015-06-18 20:13     ` Eli Zaretskii
     [not found]       ` <CAFMvb4u5_9eY+29pPt-6RO3KdwM=9WnXCRkJpTftW5hffF_7Wg@mail.gmail.com>
2015-06-19  8:35         ` Eli Zaretskii [this message]
2015-06-19  8:57           ` Bryan Childs
2015-06-19 17:49             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83vbekjdsx.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=20844@debbugs.gnu.org \
    --cc=godeater@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).