"Ben Hyde" <[email protected]> writes:

 Hi Ben,

> I tried setting debug-on-entry for a few things; but I’ve yet to find
> something that fires only when it birthing a fresh *tramp… buffer.
> Not that I looked very hard.

A new Tramp buffer is created in function `tramp-get-buffer'. But this
is called many times; creation a new buffer is not its major
functionality.

You could apply the appended patch, which separates creating the buffer
into a new function `tramp-create-buffer'. This could be used for
`debug-on-entry' then.

> * ben

Best regards, Michael.

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/tramp.el b/lisp/tramp.el
index fc7fdd3..4ae9c4c 100644
--- a/lisp/tramp.el
+++ b/lisp/tramp.el
@@ -1300,10 +1300,13 @@ necessary only.  This function will be used in file 
name completion."
             tramp-postfix-host-format))
          (when localname localname)))
 
+(defun tramp-create-buffer (vec)
+  (get-buffer-create (tramp-buffer-name vec)))
+
 (defun tramp-get-buffer (vec)
   "Get the connection buffer to be used for VEC."
   (or (get-buffer (tramp-buffer-name vec))
-      (with-current-buffer (get-buffer-create (tramp-buffer-name vec))
+      (with-current-buffer (tramp-create-buffer vec)
        ;; We use the existence of connection property "process-buffer"
        ;; as indication, whether a connection is active.
        (tramp-set-connection-property
--8<---------------cut here---------------end--------------->8---

_______________________________________________
Tramp-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/tramp-devel

Reply via email to