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: Re: Strange `file-name-sans-extension' behavior Date: Fri, 09 Aug 2002 03:38:45 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: <200208090738.g797clg11797@rum.cs.yale.edu> References: <200207271853.g6RIrf310840@aztec.santafe.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1028878702 18756 127.0.0.1 (9 Aug 2002 07:38:22 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 9 Aug 2002 07:38:22 +0000 (UTC) Cc: 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 17d4Ll-0004sJ-00 for ; Fri, 09 Aug 2002 09:38:21 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17d4iE-0006kE-00 for ; Fri, 09 Aug 2002 10:01:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17d4MT-0007es-00; Fri, 09 Aug 2002 03:39:05 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17d4ME-0007dx-00; Fri, 09 Aug 2002 03:38:50 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id g797clg11797; Fri, 9 Aug 2002 03:38:47 -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:6386 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:6386 > Does this fix it? > > *** files.el.~1.598.~ Fri Jul 26 11:47:31 2002 > --- files.el Sat Jul 27 14:16:42 2002 > *************** > *** 2468,2475 **** > (if (and (string-match "\\.[^.]*\\'" file) > (not (eq 0 (match-beginning 0)))) > (if (setq directory (file-name-directory filename)) > ! (expand-file-name (substring file 0 (match-beginning 0)) > ! directory) > (substring file 0 (match-beginning 0))) > filename)))) > > --- 2468,2476 ---- > (if (and (string-match "\\.[^.]*\\'" file) > (not (eq 0 (match-beginning 0)))) > (if (setq directory (file-name-directory filename)) > ! ;; Don't use expand-file-name here; if DIRECTORY is relative, > ! ;; we don't want to expand it. > ! (concat directory (substring file 0 (match-beginning 0))) > (substring file 0 (match-beginning 0))) > filename)))) Could we introduce a new function for that or some way to tell `expand-file-name' not to do the expansion if the dir is relative ? The current elisp primitives make it very difficult to reconstruct a file name that was just taken apart. The missing piece is indeed this "concat a (potentially relative) directory name and a file name but without making it absolute and without adding "./" in front". Stefan