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

From: Sam Steingold <[email-masked]>
Date: Fri, 16 Sep 2022 12:56:39 -0400

> * Gregory Heytings <[email-masked]> [2022-09-16 15:02:04 +0000]:
>
>> calendar is far from being the only problem.
>
> That wasn't clear from the bug title and the discussion.

I am pretty sure I mentioned this a few time here and elsewhere but you
don't have to track my pet peeves ;-)

>>
>> I run this:
>>
>> (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))
>>      )))
>>
>> every now and then.
>>
>
> I think you can achieve a similar effect automatically, by adding a
> function in buffer-list-update-hook that does the above on the first
> element of buffer-list.

Wow, thanks Gregory, didn't even think about it.

1. This hook seems to be called far too often; but I do not see a
`create-buffer-hook' - any reason for that? (there is a
`kill-buffer-hook')

2. It appears that I can use (current-buffer) instead of (car
(buffer-list))

> But as Michael said you should probably not use nil.

I am not sure what you mean, could you please clarify?

-- 
Sam Steingold (https://aphar.dreamwidth.org/) on darwin Ns 10.3.2113
https://lastingimpactpsychology.com https://steingoldpsychology.com
https://www.dhimmitude.org https://jihadwatch.org https://camera.org
Time would have been the best Teacher, if it did not kill all its students.