Subject: bug#20015: 25.0.50; Slow Emacs startup after recent TRAMP changes

From: Michael Albinus <[email-masked]>
Date: Sat, 07 Mar 2015 12:35:20 +0100

Daniel Colascione <[email-masked]> writes:

> It's also unacceptable to start six (by my count) ssh subprocesses,
> especially on systems like Cygwin, where process creation is very slow.

The code calls it only 3 times. Due to the autoload, the code of the
defconst was eval'ed twice, so it ends up in 6 calls.

I've changed it to a defcustom and checked it again. Now it is called
only 3 times, and it is called only when you open a remote file
(tramp.el is loaded).

> At the very least, this work needs to be delayed until someone tries to
> use an ssh connection method, and the result should be called.

As said above. Also not called when Emacs compiles in batch mode, and alike.

I would like to avoid these calls completely, if somebody could tell me
a robust test for knowing which kind of ControlMaster, ControlPath and
ControlPersist options are supported by the local ssh stanza. And no, I
don't want to check the ssh version; this isn't robust.

Would it be safe to install the patch in the emacs-24 branch? The change
which made Tassilo annoyed was introduced for Emacs 24.5, see Bug#19702.

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs-24/lisp/net/tramp.el.~emacs-24~	2015-03-07 12:31:29.053902763 +0100
--- /home/albinus/src/emacs-24/lisp/net/tramp.el	2015-03-07 12:23:14.799675963 +0100
***************
*** 307,313 ****
  useful only in combination with `tramp-default-proxies-alist'.")
  
  ;;;###tramp-autoload
! (defconst tramp-ssh-controlmaster-options
    (let ((result "")
  	(case-fold-search t))
      (ignore-errors
--- 307,313 ----
  useful only in combination with `tramp-default-proxies-alist'.")
  
  ;;;###tramp-autoload
! (defcustom tramp-ssh-controlmaster-options
    (let ((result "")
  	(case-fold-search t))
      (ignore-errors
***************
*** 333,339 ****
  	      (setq result (concat result " -o ControlPersist=no")))))))
      result)
      "Call ssh to detect whether it supports the Control* arguments.
! Return a string to be used in `tramp-methods'.")
  
  ;;;###tramp-autoload
  (defcustom tramp-use-ssh-controlmaster-options
--- 333,342 ----
  	      (setq result (concat result " -o ControlPersist=no")))))))
      result)
      "Call ssh to detect whether it supports the Control* arguments.
! Return a string to be used in `tramp-methods'."
!     :group 'tramp
!     :version "24.5"
!     :type 'string)
  
  ;;;###tramp-autoload
  (defcustom tramp-use-ssh-controlmaster-options
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.