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: substitute-in-file-name and "$" Date: Sun, 06 Jul 2003 13:20:11 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200307061720.h66HKB8U004290@rum.cs.yale.edu> References: <20030706000741.GA27544@gnu.org> <5xr853j1td.fsf@kfs2.cua.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1057512107 17528 80.91.224.249 (6 Jul 2003 17:21:47 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 6 Jul 2003 17:21:47 +0000 (UTC) Cc: Miles Bader Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Jul 06 19:21:45 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19ZDCq-0004YR-00 for ; Sun, 06 Jul 2003 19:21:44 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19ZDMJ-0006I8-00 for ; Sun, 06 Jul 2003 19:31:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19ZDCF-0000iR-Ca for emacs-devel@quimby.gnus.org; Sun, 06 Jul 2003 13:21:07 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19ZDBr-0000WU-8J for emacs-devel@gnu.org; Sun, 06 Jul 2003 13:20:43 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19ZDBc-0000F2-Lr for emacs-devel@gnu.org; Sun, 06 Jul 2003 13:20:29 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19ZDBQ-00081C-FH; Sun, 06 Jul 2003 13:20:16 -0400 Original-Received: from rum.cs.yale.edu (localhost [127.0.0.1]) by rum.cs.yale.edu (8.12.8/8.12.8) with ESMTP id h66HKBHl004292; Sun, 6 Jul 2003 13:20:11 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.12.8/8.12.8/Submit) id h66HKB8U004290; Sun, 6 Jul 2003 13:20:11 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: storm@cua.dk (Kim F. Storm) Original-cc: Luc Teirlinck Original-cc: Michael Albinus Original-cc: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:15424 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:15424 > > > At least the examples in the Elisp manual give the feeling that > > > substitute-in-file-name could be called without special attention. The > > > trap with the "$" char isn't obvious. > > > > Consider that the environment-variable's _value_ could contain a `$', so it > > seems actually fairly obvious that you should only call > > substitute-in-file-name once... > > Maybe substitute-in-file-name could put a `substitute-in-file-name' > property on the return value and check for that property on its > argument (and do nothing if it is present). This definitely qualifies as over-engineering. substitute-in-file-name should be used very rarely anyway (in terms of number of times it shows up in source code), so it's not a big deal. Most uses of substitute-in-file-name are hidden inside read-file-name. I'm curious to know which other cases exist. substitute-in-file-name is basically the function that turns "user-typed" file names into their "internal" representation, so obviously it should be applied exactly once. As for having a filename that's made up of a user-typed part and an internal part, that's also most likely a bug: the user-typed part should be passed through substitute-in-file-name before being combined with the internal part (hopefully with expand-file-name). Stefan