unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Michael Albinus'" <michael.albinus@gmx.de>
Cc: 10319@debbugs.gnu.org
Subject: bug#10319: 24.0.92; doc string of `file-remote-p'
Date: Mon, 19 Dec 2011 08:10:47 -0800	[thread overview]
Message-ID: <88D1EF1166814B70B0E2CD052362AA72@us.oracle.com> (raw)
In-Reply-To: <87bor5eyz0.fsf@gmx.de>

> > Do you just want to say that `file-remote-p' never opens
> > a new connection (i.e., a connection that is not already
> > established/open)?
> 
> Yes.
> 
> > 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.

> > Can the handler establish a _new_ connection?  If so, then
> > `file-remote-p' can do so. If not, then can't we just say
> > that `file-remote-p' never establishes (opens) a new
> > connection?
> 
> It is a promise to libraries using `file-remote-p'. It is guaranteed
> that the function call is cheap, and that it could be used here and
> there w/o remarkable overhead.

That is covered by what is said above: it never opens  new connection.

> 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 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.

> 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."

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.

Thx - Drew






  reply	other threads:[~2011-12-19 16:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-18  2:17 bug#10319: 24.0.92; doc string of `file-remote-p' Drew Adams
2011-12-18  8:33 ` Michael Albinus
2011-12-18 15:02   ` Drew Adams
2011-12-19  8:40     ` Michael Albinus
2011-12-19 16:10       ` Drew Adams [this message]
2011-12-19 18:26         ` Michael Albinus
2011-12-19 19:44           ` Drew Adams
2011-12-19 21:18             ` Michael Albinus
2011-12-19 21:29               ` Drew Adams
2011-12-20  9:15                 ` Michael Albinus
2011-12-20 15:53                   ` Drew Adams
2011-12-20 17:02                     ` Michael Albinus
2011-12-20 17:08                       ` Drew Adams
2011-12-20 17:14                         ` Michael Albinus
2011-12-20 17:33                           ` Drew Adams
2011-12-21 18:34                             ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=88D1EF1166814B70B0E2CD052362AA72@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=10319@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).