From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: substitute-in-file-name and "$" Date: Sun, 06 Jul 2003 16:30:11 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <200307051829.h65IT4d05636@raven.dms.auburn.edu> <200307052358.h65NwLs06030@raven.dms.auburn.edu> Reply-To: Michael Albinus NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1057502033 17470 80.91.224.249 (6 Jul 2003 14:33:53 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 6 Jul 2003 14:33:53 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Jul 06 16:33:52 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 19ZAaO-0004XT-00 for ; Sun, 06 Jul 2003 16:33:52 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19ZAjn-0004fj-00 for ; Sun, 06 Jul 2003 16:43:35 +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 19ZAa2-0000NS-2N for emacs-devel@quimby.gnus.org; Sun, 06 Jul 2003 10:33:30 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19ZAXK-0007T5-IJ for emacs-devel@gnu.org; Sun, 06 Jul 2003 10:30:42 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19ZAXG-0007Ok-VK for emacs-devel@gnu.org; Sun, 06 Jul 2003 10:30:40 -0400 Original-Received: from mailrelay2.alcatel.de ([194.113.59.71] helo=mailrelay1.alcatel.de) by monty-python.gnu.org with esmtp (Exim 4.20) id 19ZAX1-0007Br-Lj for emacs-devel@gnu.org; Sun, 06 Jul 2003 10:30:23 -0400 Original-Received: from slbh00.bln.sel.alcatel.de (mailhost.bln.sel.alcatel.de [149.204.49.8]) by mailrelay1.alcatel.de (8.9.3/8.9.3) with ESMTP id QAA05630; Sun, 6 Jul 2003 16:29:52 +0200 (MET DST) Original-Received: from slbwba.bln.sel.alcatel.de (albinus@slbwba [149.204.93.83]) by slbh00.bln.sel.alcatel.de (8.9.3/8.9.3) with ESMTP id QAA16267; Sun, 6 Jul 2003 16:30:13 +0200 (MET DST) Original-To: Luc Teirlinck In-Reply-To: <200307052358.h65NwLs06030@raven.dms.auburn.edu> (Luc Teirlinck's message of "Sat, 5 Jul 2003 18:58:21 -0500 (CDT)") User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/20.7 (hpux) X-Alcanet-MTA-scanned-and-authorized: yes X-Alcanet-MTA-scanned-and-authorized: yes 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:15414 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:15414 Luc Teirlinck writes: > 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 That's right. > 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. That's right, too. > 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. That wouldn't be possible. You know what `my-favorite-file-function' is doing the default case. You don't know what's going on with an alternative implementation within another file name handler. Would you like to say for every file name operation "substitute-in file-name is called" (or not)? And even if you do it, you cannot control, because it could be called indirectly, within another file name function you use. > 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. `PC-do-completion' must do it, because the result is shown in the minibuffer. Or a file name like this: "$NEXT_HOP:/share$$", where $NEXT_HOP has the value "/smb:next.hop.com". At least case (2) would be needed, because Tramp file name handler could be activated only after applying substitute-in-file-name to that file name. > Sincerely, > > Luc. Best regards, Michael.