From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: `concat' a dir and a file (was: Strange `file-name-sans-extension' behavior ) Date: Fri, 16 Aug 2002 13:17:32 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: <200208161717.g7GHHWw31172@rum.cs.yale.edu> References: <200207271853.g6RIrf310840@aztec.santafe.edu> <200208090738.g797clg11797@rum.cs.yale.edu> <200208101716.g7AHGqc05959@wijiji.santafe.edu> <200208121558.g7CFw0K29043@rum.cs.yale.edu> <8011-Mon12Aug2002202814+0300-eliz@is.elta.co.il> <200208132247.g7DMl0607244@wijiji.santafe.edu> <2593-Wed14Aug2002140316+0300-eliz@is.elta.co.il> <200208142314.g7ENEMX07736@wijiji.santafe.edu> <2110-Thu15Aug2002195139+0300-eliz@is.elta.co.il> <200208160231.g7G2Vb508088@wijiji.santafe.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1029518242 340 127.0.0.1 (16 Aug 2002 17:17:22 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 16 Aug 2002 17:17:22 +0000 (UTC) Cc: eliz@is.elta.co.il, Jens.Schmidt27@epost.de, emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17fkiu-00005N-00 for ; Fri, 16 Aug 2002 19:17:20 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17fl8y-00018Z-00 for ; Fri, 16 Aug 2002 19:44:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17fkjs-00057S-00; Fri, 16 Aug 2002 13:18:20 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17fkjA-00054V-00 for emacs-devel@gnu.org; Fri, 16 Aug 2002 13:17:36 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17fkj8-00054H-00 for emacs-devel@gnu.org; Fri, 16 Aug 2002 13:17:36 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17fkj8-00054B-00; Fri, 16 Aug 2002 13:17:34 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id g7GHHWw31172; Fri, 16 Aug 2002 13:17:32 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Richard Stallman Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:6584 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:6584 > > The directory it uses is the one that was in the argument file name. > > If it was valid there, it should be equally valid in the result. > > If it is not valid in the result, I guess it was not valid in > > the argument. > > The problem is the slash you append to the directory if it doesn't > end in a slash. > > I don't see any code in file-name-sans-extension to append a slash to > the directory name. It gets the directory name with > file-name-directory and uses it without further change. > > Where is the slash appended? The `Subject:' had not been updated, so it was misleading. The discussion is about whether or not we need a new function that is like expand-file-name but does not necessarily return an absolute file name. Currently when you need to combine a relative dir with a file name, you need to use (concat (file-name-as-directory foo) bar), but the fact that `concat' works for this is purely accidental (and might not even be always true for currently supported systems, according to Eli). I've sometimes tried to use (let ((default-directory nil)) (expand-file-name bar foo)) or (let ((default-directory "")) (expand-file-name bar foo)) but it prepends "/" or "./" to the result. Stefan