Subject: bug#76417: [PATCH] Add tramp-cleanup-bufferless-connections

From: Michael Albinus <[email-masked]>
Date: Thu, 20 Feb 2025 15:03:37 +0100

Ship Mints <[email-masked]> writes:

Hi,

tramp-cleanup-some-buffers is intended as frame to be customized for
different use cases.

> I did look. What concerned me was that tramp-cleanup-some-buffers-hook
> could be altered by users, where tramp-cleanup-bufferless-connections
> does one and only one thing without interference from potentially
> modified hooks.

You can write a wrapper function for your package, which binds
tramp-cleanup-some-buffers-hook with proper functions, and which calls
tramp-cleanup-some-buffers then.

> It looks to me, though, that tramp-cleanup-some-buffers does things
> differently.

It is a new command of Emacs 30, so it is not very known to
users. There's much room to customize it for different use cases.

> It does (tramp-cleanup-all-connections) which is not
> what I want.  I want only to kill unused tramp connections, not all
> tramp connections.

I've seen this also today. Hmm, perhaps we can move this call to a hook
function, added by default, which you can suppress in your own binding
of tramp-cleanup-some-buffers-hook.

> It also kills user buffers which is not what my
> function does--it kills only tramp-related objects not user buffers.

This should also be configurable.

> I could take a second look today, but it doesn't seem like they solve
> the same problem?

Yes, please do. I'm interested in pimp up this command with alternative
scenarios.

Best regards, Michael.