From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: abbreviate-file-name on Windows seems incorrect Date: Sat, 6 Jan 2007 08:22:09 -0800 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1168100596 8487 80.91.229.12 (6 Jan 2007 16:23:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 6 Jan 2007 16:23:16 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 06 17:23:15 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H3EK9-0004Ia-Sj for ged-emacs-devel@m.gmane.org; Sat, 06 Jan 2007 17:23:14 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H3EK9-0004na-88 for ged-emacs-devel@m.gmane.org; Sat, 06 Jan 2007 11:23:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H3EJw-0004mA-NW for emacs-devel@gnu.org; Sat, 06 Jan 2007 11:23:00 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H3EJu-0004le-IF for emacs-devel@gnu.org; Sat, 06 Jan 2007 11:22:59 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H3EJu-0004lb-Fo for emacs-devel@gnu.org; Sat, 06 Jan 2007 11:22:58 -0500 Original-Received: from [141.146.126.228] (helo=agminet01.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1H3EJt-00053U-Qr for emacs-devel@gnu.org; Sat, 06 Jan 2007 11:22:58 -0500 Original-Received: from rgmgw1.us.oracle.com (rgmgw1.us.oracle.com [138.1.186.110]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l06GMtd2017765 for ; Sat, 6 Jan 2007 10:22:55 -0600 Original-Received: from rcsmt251.oracle.com (rcsmt251.oracle.com [148.87.90.196]) by rgmgw1.us.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l06FgUUC000754 for ; Sat, 6 Jan 2007 09:22:55 -0700 Original-Received: from dhcp-amer-rmdc-csvpn-gw4-141-144-102-221.vpn.oracle.com by rcsmt250.oracle.com with ESMTP id 2342591871168100537; Sat, 06 Jan 2007 09:22:17 -0700 Original-To: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 In-Reply-To: Importance: Normal X-Whitelist: TRUE X-Whitelist: TRUE X-Brightmail-Tracker: AAAAAQAAAAI= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:64883 Archived-At: > > I would expect (abbreviate-file-name "c:/foo/bar") to return > > "~/foo/bar", but it returns "c:/foo/bar". > > This is a feature: the Windows port behaves here like the Unix version > does, and doesn't change the file name if the home directory is a root > directory. OK. > my $HOME's value is "d:/usr/eli": > (abbreviate-file-name "d:/usr/eli/foo/bar") => "~/foo/bar" I see. To tell the truth, I didn't bother to change $HOME outside Emacs and start emacs -Q again to test the case other than HOME = "c:\\". I did try using `setenv' to change "HOME", but that apparently doesn't have an effect here. That is: (setenv "HOME" "d:/usr/eli") (abbreviate-file-name "d:/usr/eli/foo/bar") => "d:/usr/eli/foo/bar" So, I didn't notice that it does work properly. Setting $HOME in Windows itself to "d:\eli\" and then starting emacs -Q, I do get what you showed: (abbreviate-file-name "d:/usr/eli/foo/bar") => "~/foo/bar" So, I was mistaken - no problem. Thx for the clear explanation. How about mentioning in the doc string that "~" is not substituted for the user's home dir if that is the root. ("/" in Unix or Linux, ":\" in Windows)? The doc string gives an incorrect idea of what the function does, in this case (which is common in Windows).