From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Add a predicate for canonical file name Date: Mon, 12 Sep 2016 20:13:27 +0300 Message-ID: <838tux9h3c.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1473700571 17493 195.159.176.226 (12 Sep 2016 17:16:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Sep 2016 17:16:11 +0000 (UTC) Cc: emacs-devel@gnu.org To: Tino Calancha Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 12 19:16:06 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjUpr-0003IV-SN for ged-emacs-devel@m.gmane.org; Mon, 12 Sep 2016 19:15:59 +0200 Original-Received: from localhost ([::1]:44286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjUpp-0002F2-MI for ged-emacs-devel@m.gmane.org; Mon, 12 Sep 2016 13:15:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjUnW-0001J9-Lr for emacs-devel@gnu.org; Mon, 12 Sep 2016 13:13:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjUnQ-0004VF-Js for emacs-devel@gnu.org; Mon, 12 Sep 2016 13:13:33 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40014) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjUnQ-0004V1-GQ; Mon, 12 Sep 2016 13:13:28 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1883 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bjUnN-0007Xy-Tv; Mon, 12 Sep 2016 13:13:27 -0400 In-reply-to: (message from Tino Calancha on Mon, 12 Sep 2016 17:23:03 +0900 (JST)) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207389 Archived-At: > From: Tino Calancha > Date: Mon, 12 Sep 2016 17:23:03 +0900 (JST) > Cc: tino.calancha@gmail.com > > i dont see in Emacs a predicate for a file name being canonical. Keeping in mind that just running a file name through expand-file-name will guarantee an absolute (and "canonical") file name as result, what problem would such a predicate solve that invoking expand-file-name doesn't? Especially given that your implementation calls expand-file-name anyway? > We have a predicate for absolute file names, `file-name-absolute-p'. I personally never had a problem with the notion of "absolute file name". Yes, file names like "~/foo/bar" and "~user/foo" cause file-name-absolute-p to return non-nil, but this is so obscure and marginal feature that I doubt many Lisp programmers even remember that. > (defsubst myfile-name-canonical-p (filename) > "Return non-nil if FILENAME specifies an absolute canonical file name." > (string= filename (expand-file-name filename))) Using string= here will cause false negatives, e.g. with Windows file names that use backslashes vs forward slashes, or due to letter-case differences on case-insensitive file systems. Did you really mean that? But anyway, the need for this is not clear to me. Thanks.