Subject: bug#50187: 28.0.50; tramp is called from calendar

From: Michael Albinus <[email-masked]>
Date: Fri, 16 Sep 2022 16:38:27 +0200

Sam Steingold <[email-masked]> writes:

Hi Sam,

> (dolist (b (buffer-list))
>   (with-current-buffer b
>     (when (and (null buffer-file-name)
>                (not (eq major-mode 'dired-mode))
>                (not (string-match " ?\\*.*\\(tramp\\|vc\\|diff\\)" (buffer-name)))
>                (find-file-name-handler default-directory 'file-remote-p))
>       (message "Reset 'default-directory' in %s(%s) from %s"
>                b (or buffer-file-name list-buffers-directory) default-directory)
>       (setq default-directory (default-value 'default-directory))
>       )))

This works by sheer luck then. `default-directory' must not be nil; it
is fundamental that it is a string.

That code makes other packages useless for remote buffers, like shell or
compile. This cannot be the solution.

Best regards, Michael.