From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#10319: 24.0.92; doc string of `file-remote-p' Date: Mon, 19 Dec 2011 19:26:31 +0100 Message-ID: <87ehw0e7u0.fsf@gmx.de> References: <87wr9uuvn3.fsf@gmx.de> <1C247F238CC24F6F9A0A3D077D3E09FE@us.oracle.com> <87bor5eyz0.fsf@gmx.de> <88D1EF1166814B70B0E2CD052362AA72@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1324319245 28138 80.91.229.12 (19 Dec 2011 18:27:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 19 Dec 2011 18:27:25 +0000 (UTC) Cc: 10319@debbugs.gnu.org To: "Drew Adams" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 19 19:27:21 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Rchve-0002nM-Kk for geb-bug-gnu-emacs@m.gmane.org; Mon, 19 Dec 2011 19:27:14 +0100 Original-Received: from localhost ([::1]:59189 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rchvd-0007KX-HE for geb-bug-gnu-emacs@m.gmane.org; Mon, 19 Dec 2011 13:27:13 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:44214) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rchva-0007KG-2r for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2011 13:27:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RchvY-0003IL-Uz for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2011 13:27:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44791) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RchvY-0003IH-TR for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2011 13:27:08 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RchxO-0003GI-7G for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2011 13:29:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Dec 2011 18:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10319 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10319-submit@debbugs.gnu.org id=B10319.132431931412506 (code B ref 10319); Mon, 19 Dec 2011 18:29:02 +0000 Original-Received: (at 10319) by debbugs.gnu.org; 19 Dec 2011 18:28:34 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Rchww-0003Ff-LD for submit@debbugs.gnu.org; Mon, 19 Dec 2011 13:28:34 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.22]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1Rchwt-0003FV-0a for 10319@debbugs.gnu.org; Mon, 19 Dec 2011 13:28:32 -0500 Original-Received: (qmail invoked by alias); 19 Dec 2011 18:26:34 -0000 Original-Received: from p57BB978C.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.151.140] by mail.gmx.net (mp034) with SMTP; 19 Dec 2011 19:26:34 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18ppWBiAQ8pwaMgarSM197aCG2/j6i4pgFbiMJORE KP+PDAjxgvgJXR In-Reply-To: <88D1EF1166814B70B0E2CD052362AA72@us.oracle.com> (Drew Adams's message of "Mon, 19 Dec 2011 08:10:47 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 19 Dec 2011 13:29:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:55068 Archived-At: "Drew Adams" writes: >> > If so, let's just say that: It never opens a new remote >> > connection. It can only reuse a connection that is >> > already open. >> >> Sounds OK to me. > > Let's do that then. IMO, that will avoid some misunderstanding. > >> It is also an implementation hint. Any handler that provides an own >> implementation of `file-remote-p' shall behave like this. >> `tramp-handle-file-remote-p' and `ange-ftp-file-remote-p' do so. > > I doubt that trying to hint that in the doc string will help more than > hurt user understanding. IMO we would either need to spell that out > clearly or put it in comments in the code. I didn't intend to include it as such. It is an implicit implementation hint. > I think the latter is preferable. The doc string should be aimed > mainly at users of the function, not at implementors of substitute > definitions of it. But all of that kind of thing can be stated > clearly in the source file for those to whom it is useful. OK. >> As a consequence, the result might differ whether a connection is >> already open, or not. If the connection is not established yet, we get >> (file-remote-p "/ssh::" 'localname) => "" >> If there is an established connection, we see >> (file-remote-p "/ssh::" 'localname) => "/home/albinus" > > That might be worth pointing out in the doc string. It might be > useful to users of the function. Perhaps you could just add text like > this: > > "The return value can differ depending on whether there > is an existing connection." We shall mention that the return value is still a string. And the difference happens only for localname parts. > Do we want to say more than that? Is there some rule about this? > E.g., if no existing connection is the return value _always_ ""? If > no rule, then just adding that sentence (or similar) should be enough. I wouldn't give a rule. There are other cases, like (file-remote-p "/ssh::" 'localname), which returns "~" when there is no connection, and "/home/albinus" otherwise. Combining your proposals, the docstring could be "Test whether FILE specifies a location on a remote system. Returns nil or a string identifying the remote connection (ideally a prefix of FILE). For example, the remote identification for filename "/user@host:/foo" could be "/user@host:". A file is considered "remote" if accessing it is likely to be slower or less reliable than accessing local files. Furthermore, relative file names do not work across remote connections. IDENTIFICATION specifies which part of the identification shall be returned as string. IDENTIFICATION can be the symbol `method', `user', `host' or `localname'; any other value is handled like nil and means to return the complete identification string. The string returned for IDENTIFICATION `localname' can differ depending on whether there is an existing connection." If CONNECTED is non-nil, the function returns an identification only if FILE is located on a remote system, and a connection is established to that remote system. `file-remote-p' never opens a new remote connection. It can only reuse a connection that is already open." > Thx - Drew Best regards, Michael.