From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#4819: file-truename's undocumented behavior Date: Wed, 28 Oct 2009 20:37:53 -0400 Message-ID: References: Reply-To: Stefan Monnier , 4819@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1256777255 12450 80.91.229.12 (29 Oct 2009 00:47:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Oct 2009 00:47:35 +0000 (UTC) Cc: 4819@emacsbugs.donarmstrong.com, bug-gnu-emacs@gnu.org To: MON KEY Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 29 01:47:28 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N3JAl-0007WT-TN for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Oct 2009 01:47:28 +0100 Original-Received: from localhost ([127.0.0.1]:59798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N3JAl-0002hO-9D for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Oct 2009 20:47:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N3JAg-0002gv-Rk for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2009 20:47:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N3JAc-0002fr-Cd for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2009 20:47:22 -0400 Original-Received: from [199.232.76.173] (port=52102 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N3JAc-0002fY-3q for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2009 20:47:18 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:33451) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N3JAb-0004w1-Cr for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2009 20:47:17 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n9T0lE2D013100; Wed, 28 Oct 2009 17:47:14 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n9T0j6xn012829; Wed, 28 Oct 2009 17:45:06 -0700 Resent-Date: Wed, 28 Oct 2009 17:45:06 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Stefan Monnier Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Thu, 29 Oct 2009 00:45:06 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 4819 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 4819-submit@emacsbugs.donarmstrong.com id=B4819.125677668112116 (code B ref 4819); Thu, 29 Oct 2009 00:45:06 +0000 Original-Received: (at 4819) by emacsbugs.donarmstrong.com; 29 Oct 2009 00:38:01 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from ironport2-out.pppoe.ca (ironport2-out.teksavvy.com [206.248.154.183]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n9T0bx3E012113 for <4819@emacsbugs.donarmstrong.com>; Wed, 28 Oct 2009 17:38:01 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqgEAMiA6EpLd/xb/2dsb2JhbACBT9oAhD8EgmSFZw X-IronPort-AV: E=Sophos;i="4.44,642,1249272000"; d="scan'208";a="48337267" Original-Received: from 75-119-252-91.dsl.teksavvy.com (HELO pastel.home) ([75.119.252.91]) by ironport2-out.pppoe.ca with ESMTP; 28 Oct 2009 20:37:53 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 946D98013; Wed, 28 Oct 2009 20:37:53 -0400 (EDT) In-Reply-To: (MON KEY's message of "Wed, 28 Oct 2009 16:01:32 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Wed, 28 Oct 2009 20:47:22 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:32267 Archived-At: > I assumed nil. That would be very unexpected, since file-truename otherwise always returns a string when passed a string. > However, discarding the state of my "least surprisedness", I would > _not_ expect that file-truename would step all over the match-data, > and where it does so not before first: Most functions don't preserve the match-data, and even more so for functions that manipulate strings or buffers. > b) Noting that it does so in the documention. i.e. as per `split-string'. It's the other way around: the few functions that preserve the match-data should be documented as such (better yet: the byte-compiler should be taught about them, so it can detect when we use the match-data after it got clobbered). >>> I just spent 2 1/2 hours in a break-loop three functions away trying >>> to debug _undocumented_ behavior. >> Which part of the documentation do you think this behavior contradicts? > This part: > (file-name-absolute-p "") ;=> nil > (file-symlink-p "") ;=> nil That's not a part of the documentation. > Why not mention in the docs that on w32 `w32-long-file-name' may be > a more suitable alternative esp. as it is a primitive and as it will > expand "8.3 DOS" short name aliases in the process. (Again, per > _existing_ comments in body of `file-truename's definition). Elisp should generally not be w32-specific, so ratehr than use w32-long-file-name we should maybe change file-truename correspondingly. That doesn't mean I think it's the right thing to do: I know next to nothing about this issue. > ! ((and (string= (substring filename 0 1) "~") > ! (string-match-p "~[^/]*/?" filename)) > ! (string-match "~[^/]*/?" filename) > ! (let ((first-part > ! (substring filename 0 (match-end 0))) > ! (rest (substring filename (match-end 0)))) What's the point? If you're going to use string-match in the end, you might as well do it right away. Stefan