From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: substitute-in-file-name and "$" Date: Sat, 5 Jul 2003 18:58:21 -0500 (CDT) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200307052358.h65NwLs06030@raven.dms.auburn.edu> References: NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1057449697 16235 80.91.224.249 (6 Jul 2003 00:01:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 6 Jul 2003 00:01:37 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Jul 06 02:01:35 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 19Ywxx-0004Cs-00 for ; Sun, 06 Jul 2003 02:01:17 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19Yx74-0002yI-00 for ; Sun, 06 Jul 2003 02:10:42 +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 19YwwW-0007Lp-Bn for emacs-devel@quimby.gnus.org; Sat, 05 Jul 2003 19:59:48 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19Yww2-0006sG-6q for emacs-devel@gnu.org; Sat, 05 Jul 2003 19:59:18 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19Ywvt-0006b8-Ly for emacs-devel@gnu.org; Sat, 05 Jul 2003 19:59:11 -0400 Original-Received: from manatee.dms.auburn.edu ([131.204.53.104]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19YwvU-0006D9-72 for emacs-devel@gnu.org; Sat, 05 Jul 2003 19:58:44 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) h65NwbeQ013039; Sat, 5 Jul 2003 18:58:42 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id h65NwLs06030; Sat, 5 Jul 2003 18:58:21 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: Michael.Albinus@alcatel.de In-reply-to: (message from Michael Albinus on Sun, 06 Jul 2003 01:16:44 +0200) 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:15402 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:15402 Michael Albinus wrote: 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. None of the examples in the Elisp manual, (elisp)File Name Expansion, involves Elisp variables. Even when working with variables, it would seem that you can call (substitute-in-file-name filename) 1001 times without danger (it has no side effects). Danger arises from stuff like: 1. (setq filename (substitute-in-file-name filename)) or 2. (my-favorite-file-function (substitute-in-file-name filename)) The Elisp manual could point out that (1) should only be done if the user really knows what he is doing. Usually, using the return value of (substitute-in-file-name filename) only at the time it is actually needed (and _not_ changing filename itself at that time) or doing: (1b) (setq substituted-filename (substitute-in-file-name filename)) will be safer. In as far as (2) is concerned, the documentation string of `my-favorite-file-function' should clearly point out what operations it is going to perform on filename. If not, that is a bug in the documentation string. In that case, the Elisp user could try to figure it out by experimentation and file a bug report. If `my-favorite-file-function' is going to pass filename on to other functions it calls, it should exercise a similar care itself. And, btw, if substitute-in-file-name can be called only once, how do I know it where to perform this call? And what shall the others do, if they would like to perform substitute-in-file-name? Requote "$"? Or apply an optional parameter (to be introduced), which forces this? Do you have examples where there is a real need to do (1) instead of (1b)? I have a hard time thinking of examples in the abstract, let alone of examples occurring in actual situations. Unquoting and then requoting seems like a senseless circular operation to me. Sincerely, Luc.