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: Sun, 6 Jul 2003 11:24:00 -0500 (CDT) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200307061624.h66GO0G06676@raven.dms.auburn.edu> References: <200307051829.h65IT4d05636@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1057508683 6409 80.91.224.249 (6 Jul 2003 16:24:43 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 6 Jul 2003 16:24:43 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Jul 06 18:24:41 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 19ZCJd-0001fE-00 for ; Sun, 06 Jul 2003 18:24:41 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19ZCT5-0005iP-00 for ; Sun, 06 Jul 2003 18:34:27 +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 19ZCJk-0006Mo-OW for emacs-devel@quimby.gnus.org; Sun, 06 Jul 2003 12:24:48 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19ZCJO-0006CQ-HB for emacs-devel@gnu.org; Sun, 06 Jul 2003 12:24:26 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19ZCJM-0006B2-Vl for emacs-devel@gnu.org; Sun, 06 Jul 2003 12:24:25 -0400 Original-Received: from manatee.dms.auburn.edu ([131.204.53.104]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19ZCJM-00067I-JM for emacs-devel@gnu.org; Sun, 06 Jul 2003 12:24:24 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) h66GOKeQ013820; Sun, 6 Jul 2003 11:24:20 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id h66GO0G06676; Sun, 6 Jul 2003 11:24:00 -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 16:30:11 +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:15421 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:15421 Michael Albinus wrote: `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. You can always double up all $'s if your function only has access to an already substituted filename. (Putting a /: at the beginning would be easier, but that could probably cause remote filenames to be considered local.) All functions have to make clear in their documentation string what they are going to do to file names (if anything) and in which form they return them, if non-standard. If they do not, that is a bug. This is not madness. It is completely obvious. Functions need to say what they do. People who use functions need to know exactly what they do, not more or less what they do. It is usually easier to be able to find this out by reading documentation strings than by carefully reading through every single line of code of the function itself and of all indirectly called functions. A simpler approach would be: expand environment variables if possible. Don't worry if you cannot expand. The masquing with "$$" wouldn't be necessary this case. But I don't know whether there are other drawbacks with this approach. What if somebody has an environment variable FOO expanding to bar and another file named $FOO? Several operating systems, including GNU and Unix, allow people to essentially use any file names of their choosing, no matter how perverse. Programs have to be able to handle that, even though that might make life complicated. Sincerely, Luc.