[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to make tramp forget a host?

From: Sam Steingold
Subject: Re: how to make tramp forget a host?
Date: Wed, 06 Apr 2022 11:43:38 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin)

Hi Michael,

> * Michael Albinus <zvpunry.nyovahf@tzk.qr> [2022-04-05 19:32:05 +0200]:
> If you set tramp-verbose to at least 10, you get a backtrace in the
> Tramp debug buffer for any call of tramp-error.

Right, this might be the 10th time you told me that ;-) Sorry.

Now, I am in the middle of this disaster again, and I started a new
emacs instance to send this message.

After (setq tramp-verbose 10), I get this:

--8<---------------cut here---------------start------------->8---
11:14:26.951748 tramp-process-actions (10) # 
  tramp-file-name-handler(file-directory-p "/scp:cloud-desktop...")
  gnus-mode-line-buffer-identification((#("Gnus: %b {}"; 0 29 
(face mode-line-buffer-id))))
11:14:26.951992 tramp-process-actions (1) # File error: Tramp failed to 
connect.  If this happens repeatedly, try
    ‘M-x tramp-cleanup-this-connection’
ssh: Could not resolve hostname cloud-desktop: nodename nor servname provided, 
or not known
11:14:31.268344 tramp-process-actions (3) # Waiting for prompts from remote 
11:14:31.268690 tramp-maybe-open-connection (3) # Opening connection nil for 
cloud-desktop using scp...failed
11:14:31.268777 tramp-flush-connection-properties (7) # *tramp/scp 
cloud-desktop* nil
11:14:31.268845 tramp-get-connection-property (7) # process-buffer nil; cache 
used: nil
--8<---------------cut here---------------end--------------->8---

in `*debug tramp/scp cloud-desktop*`
Since tramp kicks in on a local file name, the answer is
`default-directory' which `*Gnus*' buffer somehow inherited from a
remote buffer from which it was called.

So, I suppose this is my fault - I need to make sure that
`default-directory' is always local or at least valid.

However, you might want to modify the "Tramp failed to connect" message
when `default-directory' is remote, saying something like "please
check your `default-directory' which is remote and invalid", and maybe
even do something like

--8<---------------cut here---------------start------------->8---
(when (y-or-n-p "Make default-directory local? ")
  (dolist (b (buffer-list))
    (with-current-buffer b
      (when (and (null buffer-file-name)
                 (not (eq major-mode 'dired))
                 (tramp-tramp-file-p default-directory))
        (setq default-directory "~/")))))
--8<---------------cut here---------------end--------------->8---


reply via email to

[Prev in Thread] Current Thread [Next in Thread]