From unknown Wed Jun 25 00:21:53 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#12517 <12517@debbugs.gnu.org> To: bug#12517 <12517@debbugs.gnu.org> Subject: Status: 24.2; (file-name-directory "~") returns nil Reply-To: bug#12517 <12517@debbugs.gnu.org> Date: Wed, 25 Jun 2025 07:21:53 +0000 retitle 12517 24.2; (file-name-directory "~") returns nil reassign 12517 emacs submitter 12517 Leo severity 12517 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 25 22:37:34 2012 Received: (at submit) by debbugs.gnu.org; 26 Sep 2012 02:37:34 +0000 Received: from localhost ([127.0.0.1]:55990 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TGhVF-0007ey-P2 for submit@debbugs.gnu.org; Tue, 25 Sep 2012 22:37:34 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57115) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TGhVD-0007es-1X for submit@debbugs.gnu.org; Tue, 25 Sep 2012 22:37:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGhTD-0006yJ-7k for submit@debbugs.gnu.org; Tue, 25 Sep 2012 22:35:27 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:57013) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGhTD-0006y6-4Q for submit@debbugs.gnu.org; Tue, 25 Sep 2012 22:35:27 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGhTC-0000U1-9O for bug-gnu-emacs@gnu.org; Tue, 25 Sep 2012 22:35:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGhTB-0006vZ-FP for bug-gnu-emacs@gnu.org; Tue, 25 Sep 2012 22:35:26 -0400 Received: from mail-da0-f41.google.com ([209.85.210.41]:40824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGhTB-0006uC-9N for bug-gnu-emacs@gnu.org; Tue, 25 Sep 2012 22:35:25 -0400 Received: by dadi14 with SMTP id i14so25627dad.0 for ; Tue, 25 Sep 2012 19:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=eVKrb/WbT228RfC5jA4ogP34qT8Sgk67oh+SaFKwjPc=; b=rBdxue1G2DyLBo9YgUrxavlgdYHUBLiLVfEbiRGEueLfuf/1UdrYXOq37y6Iq1dLeu 2WxjYRVCq3msHGfSBBLmL2MoLqyc/kcPMXozO8cm+B3/7UzbDppa3oG56Z69DKqKPjWI sDSFlvHXgDwyVqKP/iJ5FWe2WRdUt27E5G6E49J0QXJeGujne5FvPH/g8nZmPpiV2sJp lGxsU+zk1xw8tMoW/QqukSczX+9MWKDDk+LMB2QJykoDTfvDvxNg+nZCAw1LUWuZj9UA E53g/E18YZrTT7+QSW6RRJmYj8O0MjxdXHbcrIb5yC3SH3kRFWR5T/0fgjR9qhSDBlAA AVqQ== Received: by 10.68.197.167 with SMTP id iv7mr50753821pbc.113.1348626924165; Tue, 25 Sep 2012 19:35:24 -0700 (PDT) Received: from localhost ([182.48.109.8]) by mx.google.com with ESMTPS id qd9sm1242286pbb.31.2012.09.25.19.35.21 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 25 Sep 2012 19:35:23 -0700 (PDT) From: Leo To: bug-gnu-emacs@gnu.org Subject: 24.2; (file-name-directory "~") returns nil Date: Wed, 26 Sep 2012 10:35:10 +0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) I was bitten by this corner case that (file-name-directory "~") returns nil. I wonder if this is a bug/oversight? Leo From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 26 03:14:45 2012 Received: (at 12517) by debbugs.gnu.org; 26 Sep 2012 07:14:45 +0000 Received: from localhost ([127.0.0.1]:56219 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TGlpV-0007Q5-Bz for submit@debbugs.gnu.org; Wed, 26 Sep 2012 03:14:45 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:43899) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TGlpS-0007Pp-Hn for 12517@debbugs.gnu.org; Wed, 26 Sep 2012 03:14:43 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3XRVlS59Xpz4KK2M; Wed, 26 Sep 2012 09:14:44 +0200 (CEST) X-Auth-Info: yp7Yqx//IaNfSqsNgYMn07qAGt+FLTl//ChWmTRARlE= Received: from igel.home (ppp-88-217-99-78.dynamic.mnet-online.de [88.217.99.78]) by mail.mnet-online.de (Postfix) with ESMTPA id 3XRVlS3RgJzbbtf; Wed, 26 Sep 2012 09:14:44 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id EE67DCA2A5; Wed, 26 Sep 2012 09:14:43 +0200 (CEST) From: Andreas Schwab To: Leo Subject: Re: bug#12517: 24.2; (file-name-directory "~") returns nil References: X-Yow: YOW!! What should the entire human race DO?? Consume a fifth of CHIVAS REGAL, ski NUDE down MT. EVEREST, and have a wild SEX WEEKEND! Date: Wed, 26 Sep 2012 09:14:43 +0200 In-Reply-To: (Leo's message of "Wed, 26 Sep 2012 10:35:10 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12517 Cc: 12517@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Leo writes: > I was bitten by this corner case that (file-name-directory "~") returns > nil. I wonder if this is a bug/oversight? That's not different from (file-name-directory "a"). The function works purely textual and does not expand the argument, you have to call expand-file-name yourself. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 26 03:24:38 2012 Received: (at 12517) by debbugs.gnu.org; 26 Sep 2012 07:24:38 +0000 Received: from localhost ([127.0.0.1]:56224 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TGlz0-0007eI-Fn for submit@debbugs.gnu.org; Wed, 26 Sep 2012 03:24:36 -0400 Received: from mtaout21.012.net.il ([80.179.55.169]:34217) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TGlyw-0007e9-RE for 12517@debbugs.gnu.org; Wed, 26 Sep 2012 03:24:31 -0400 Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MAY00H0042HII00@a-mtaout21.012.net.il> for 12517@debbugs.gnu.org; Wed, 26 Sep 2012 09:24:32 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MAY00H784KVF580@a-mtaout21.012.net.il>; Wed, 26 Sep 2012 09:24:32 +0200 (IST) Date: Wed, 26 Sep 2012 09:24:29 +0200 From: Eli Zaretskii Subject: Re: bug#12517: 24.2; (file-name-directory "~") returns nil In-reply-to: X-012-Sender: halo1@inter.net.il To: Leo Message-id: <83k3vhgsb6.fsf@gnu.org> References: X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 12517 Cc: 12517@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Leo > Date: Wed, 26 Sep 2012 10:35:10 +0800 > > I was bitten by this corner case that (file-name-directory "~") returns > nil. As does (file-name-directory "a"). > I wonder if this is a bug/oversight? I think it is neither. file-name-directory works on the syntax of its argument, not on its semantics. The ELisp manual says: -- Function: file-name-directory filename This function returns the directory part of FILENAME, as a directory name (*note Directory Names::), or `nil' if FILENAME does not include a directory part. "FILENAME does not include a directory part" means literally that: the string FILENAME must _include_ a directory part for file-name-directory to return a non-nil result. If you want the directory of its argument, even if the argument is given as any kind of shorthand, run that argument through expand-file-name first. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 26 09:05:58 2012 Received: (at 12517) by debbugs.gnu.org; 26 Sep 2012 13:05:59 +0000 Received: from localhost ([127.0.0.1]:56497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TGrJK-0007qu-4i for submit@debbugs.gnu.org; Wed, 26 Sep 2012 09:05:55 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:47646) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TGrJD-0007qi-RB for 12517@debbugs.gnu.org; Wed, 26 Sep 2012 09:05:48 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09FxLT4/2dsb2JhbABEtBGBCIIVAQEEAVYjEAs0EhQYDSSIHAW6CZBEA6MzgViDBQ X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="200006494" Received: from 69-196-180-248.dsl.teksavvy.com (HELO pastel.home) ([69.196.180.248]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 26 Sep 2012 09:05:48 -0400 Received: by pastel.home (Postfix, from userid 20848) id 7D4115938D; Wed, 26 Sep 2012 09:05:48 -0400 (EDT) From: Stefan Monnier To: Andreas Schwab Subject: Re: bug#12517: 24.2; (file-name-directory "~") returns nil Message-ID: References: Date: Wed, 26 Sep 2012 09:05:48 -0400 In-Reply-To: (Andreas Schwab's message of "Wed, 26 Sep 2012 09:14:43 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12517 Cc: 12517@debbugs.gnu.org, Leo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> I was bitten by this corner case that (file-name-directory "~") returns >> nil. I wonder if this is a bug/oversight? I don't know if it should be treated as a misfeature, but at least I've already relies on it in code such as locate-dominating-file, which I quote: ;; Represent /home/luser/foo as ~/foo so that we don't try to look for ;; `name' in /home or in /. (setq file (abbreviate-file-name file)) -- Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 26 12:26:46 2012 Received: (at 12517-done) by debbugs.gnu.org; 26 Sep 2012 16:26:47 +0000 Received: from localhost ([127.0.0.1]:57268 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TGuRh-0004D8-Vt for submit@debbugs.gnu.org; Wed, 26 Sep 2012 12:26:46 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:36303) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TGuRg-0004D1-2m for 12517-done@debbugs.gnu.org; Wed, 26 Sep 2012 12:26:44 -0400 Received: by padfb11 with SMTP id fb11so584146pad.3 for <12517-done@debbugs.gnu.org>; Wed, 26 Sep 2012 09:26:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=XqfznKtlJKnQ5ujwIwtzMc0Iy+RjbhAt1ifKV/DoR5I=; b=fbLSz3iBckwOHAOqbzt5FgVBiCU66s73yY+rFHbbbCopi+9tkucfB4clRMJArkUd0x g0qePGWHLDP3/6jLBOyMfADKmkuyrgooOrTWzHFjM9FgGeUgzMSHuGnc3iHqJ6hyg3Ge O5yQhiaVWaHDgCf0VL5NC94fcsUOoX7IcQgZVNsH2Cg57tZRUNUNoA7+pi2KdDFTKKTd YXqDjy3pJPX1HEsF1ZGWv6d2oWig7Mi9M1gdHF/Tic1Y1TVYxAc7+9MUqJ+Qb1DXgF/c /GakpEAg1RzEblTquB9mJBRtKvFLkqLew7KffK2qrmG0raAFhwYt/MCtOP3GeiR0IhRJ Ttgw== Received: by 10.68.132.41 with SMTP id or9mr4127331pbb.67.1348676804152; Wed, 26 Sep 2012 09:26:44 -0700 (PDT) Received: from localhost ([182.48.109.8]) by mx.google.com with ESMTPS id w4sm2140186pav.27.2012.09.26.09.26.40 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 26 Sep 2012 09:26:43 -0700 (PDT) From: Leo To: 12517-done@debbugs.gnu.org Subject: Re: bug#12517: 24.2; (file-name-directory "~") returns nil References: Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAMFBMVEUaFRZLMy1dTENxVzKQ WiCrXQ97cmO/dSqSh3akjGTApXy5sJ7Sxo/Sz8Xo6eP9//xJbkruAAAAAWJLR0QAiAUdSAAAAAlw SFlzAAACxQAAAsUBidZ/7wAAAAd0SU1FB9cBBwMJOwHXewoAAAIBSURBVCjPVdNBiNNAFADQ6J4F x3hThHZBBC+WCFI8SS0iezRDcMHLHkLAg6gJH/fgYQ9xYlj2sLK4KHgqCgXFhda2Idmr4kkQPZQ0 nkQMbTypbMmMM2m7ZgYSmMef/5OZPwo7HFnx3uKPcmj0Dht1LWZJ+Hvr7dIFZXRUwl9VRTuuKDJ+ U44gjscknK4hhJaCkYRsWjmBtLqXlJAG2wipNe18OZJu1BBq1E8xafl4s6Jq2mUZGftU1y7CCxnp FVUDWJXx4C66BKBnErbuoaYNtoRTu6EZBsCbMn7W+5qOAR6WvxNOby9jHWC9hAf3n304CdiAByXs 3Nh9roLDkyb/sWV712vYwaLSAn8CPMHIAAzOPDKP2COAFm4Y4ODVWc6xG7KXsN7UeUJjjimx2uwd gCgNhr0i8C/xyCD5CiCKAMY3Bf5oDzx//w/fimscdcAZU2jv9sedx6+nYPPFIoWI/GK6QZ+EFGOR ErAjCnV3vPZ7XqlTIMbOLY7fLcvvmT7rXNWaGDexIY44N12TG2PDp7vqyl57dnCeuWwyNpnEURxk fTbDYeBnKRn4oejPYI4sH6WviBumEZ/GxX4X/x6EcURFZ7E071bjQGAxpcOAEOJuTiroDEea5Szv rVWLYfl7ZiQwSUToxrkux7OLixAWGz22+HIyWTRYcVfomOwvzusfjtVIGgLHf3MAAAAASUVORK5C YII= Date: Thu, 27 Sep 2012 00:26:35 +0800 In-Reply-To: (Leo's message of "Wed, 26 Sep 2012 10:35:10 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (OS X 10.8.2) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 12517-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Thanks to all for the explanations. Closing. From unknown Wed Jun 25 00:21:53 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 25 Oct 2012 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator