GNU bug report logs -
#76417
[PATCH] Add tramp-cleanup-bufferless-connections
Previous Next
Reported by: Ship Mints <shipmints <at> gmail.com>
Date: Wed, 19 Feb 2025 17:45:02 UTC
Severity: wishlist
Tags: patch
Fixed in version 31.1
Done: Michael Albinus <michael.albinus <at> gmx.de>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Latest patch attached including texi update.
-Stephane
On Sun, Feb 23, 2025 at 7:18 AM Michael Albinus <michael.albinus <at> gmx.de>
wrote:
> Ship Mints <shipmints <at> gmail.com> writes:
>
> > Hi, Michael, take a look at this version of the patch. -Stephane
>
> Done. Finally, you're right. It is worth an own command. What I do miss
> is its documentation in tramp.texi, node "Cleanup remote connections".
>
> Some further remarks:
>
> > --- a/etc/NEWS
> > +++ b/etc/NEWS
> > @@ -888,6 +888,14 @@ we invite Flyspell users to enable this new option
> and report issues.
> >
> > ** Tramp
> >
> > ++++
> > +*** New command tramp-cleanup-bufferless-connections.
>
> 'tramp-cleanup-bufferless-connections'
>
> > +Connection-related objects for which no associated buffers exist are
>
> ... for which no associated buffers except Tramp internal ones exist ...
>
> > --- a/lisp/net/tramp-cmds.el
> > +++ b/lisp/net/tramp-cmds.el
> > +(defsubst tramp-get-buffer-file-name (buffer)
> > + "Return `buffer-file-name' for BUFFER."
> > + (buffer-local-value 'buffer-file-name buffer))
>
> I've proposed this. But thinking about, there is already the exact same
> function 'buffer-file-name'. We shall use it instead.
>
> > +(defsubst tramp-get-buffer-default-directory (buffer)
> > + "Return `default-directory' for BUFFER."
> > + (buffer-local-value 'default-directory buffer))
>
> Not needed here. This is defined in tramp.el.
>
> > +A buffer is considered remote if either its `default-directory' or its
> > +buffer file name is considered remote by the function
> > +`tramp-tramp-file-p'."
>
> ... "is a remote file name."
>
> > (tramp-compat-seq-keep
> > - (lambda (x)
> > - (when (tramp-tramp-file-p (tramp-get-default-directory x)) x))
> > + (lambda (buffer)
> > + (when (or
> > + (tramp-tramp-file-p (tramp-get-buffer-file-name buffer))
> > + (tramp-tramp-file-p (tramp-get-buffer-default-directory
> buffer)))
> > + buffer))
>
> Simplify as
>
> --8<---------------cut here---------------start------------->8---
> (when (tramp-tramp-file-p
> (or (buffer-file-name buffer)
> (tramp-get-buffer-default-directory buffer)))
> buffer)
> --8<---------------cut here---------------end--------------->8---
>
> > +(defun tramp-list-remote-buffer-connections ()
> > + "Return a list of all remote buffer connections.
> > +A buffer is considered remote if either its `default-directory' or the
> > +function `buffer-file-name' is considered remote by
> > +`tramp-tramp-file-p'."
>
> ... "is a remote file name."
>
> Best regards, Michael.
>
[Message part 2 (text/html, inline)]
[0001-Add-tramp-cleanup-bufferless-connections-bug-76417.patch (application/octet-stream, attachment)]
This bug report was last modified 142 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.