unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Hadsell <ahadsell@mtdiablo.com>
To: gnu-emacs-bug@ftp.gnu.org
Subject: Re: Inconvenience with TRAMP and recentf
Date: Mon, 02 Jul 2007 17:31:04 -0400	[thread overview]
Message-ID: <uejjqa3xj.fsf@mtdiablo.com> (raw)
In-Reply-To: mailman.2973.1183405011.32220.bug-gnu-emacs@gnu.org

Michael Albinus <michael.albinus@gmx.de> writes:

> I did test it locally (Emacs 22.1.50.2, Tramp 2.0.56). If the remote
> file name in .recentf contains already an absolute local file name,
> expand-file-name does NOT open a connection. The connection is opened by
> file-readable-p.
>
> The remote connection is NOT opened with the following settings in my
> .emacs:
>
> (require 'recentf)
> (add-to-list 'recentf-keep 'file-remote-p)
> (recentf-mode 1)

You're right.  That works.  Clearly I missed something when I was
reviewing  the code; I'll have to re-read it.

>> Incidentally, maybe it would be a good idea to canonicalize the remote
>> filenames when they are first placed in the recentf-list, rather than
>> waiting for recentf-cleanup to do it.
>
> Yes. But it seems all file names in .recentf are already absolute; at
> least according to my tests. So the settings above might be sufficient,
> aren't they?

Yes, they show up in absolute format in .recentf, which is what
matters for this purpose.  I was fooled by the fact that they
initially show up in relative format in the recentf menu, and only
change to absolute format when emacs is restarted.

So the only problem with this approach is that a remote file that
disappears or becomes unreadable will not be removed from the recent
file list until it falls off the end.  I proposed an alternative
solution in another branch of this thread, but it was baroque and
tricky.

I suppose one could construct another predicate for the recentf-keep
list.  Rather than file-remote-p, one could use
tramp-remote-host-offline-p, which would return true if the file name
was remote and there was no session open to the remote host.  That
would allow the normal file-readable-p test to be performed if the
remote host was already online, but would not create a new session if
it was not.  Maybe I'll try this approach if I get sufficient tuits.

Thanks for your help.

-- 
Alan Hadsell

      parent reply	other threads:[~2007-07-02 21:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-01 22:15 Inconvenience with TRAMP and recentf Alan Hadsell
2007-07-02  3:15 ` Eli Zaretskii
2007-07-02  4:51 ` Michael Albinus
     [not found] ` <mailman.2935.1183346169.32220.bug-gnu-emacs@gnu.org>
2007-07-02 15:08   ` Alan Hadsell
     [not found] ` <mailman.2937.1183364176.32220.bug-gnu-emacs@gnu.org>
2007-07-02 15:31   ` Alan Hadsell
2007-07-02 19:37     ` Michael Albinus
     [not found]     ` <mailman.2973.1183405011.32220.bug-gnu-emacs@gnu.org>
2007-07-02 21:31       ` Alan Hadsell [this message]

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=uejjqa3xj.fsf@mtdiablo.com \
    --to=ahadsell@mtdiablo.com \
    --cc=gnu-emacs-bug@ftp.gnu.org \
    /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).