Function: tramp-sudoedit-maybe-open-connection
tramp-sudoedit-maybe-open-connection is a byte-compiled function
defined in tramp-sudoedit.el.gz.
Signature
(tramp-sudoedit-maybe-open-connection VEC)
Documentation
Maybe open a connection VEC.
Does not do anything if a connection is already open, but re-opens the connection if a previous connection has died for some reason.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp-sudoedit.el.gz
(defun tramp-sudoedit-maybe-open-connection (vec)
"Maybe open a connection VEC.
Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason."
;; During completion, don't reopen a new connection.
(unless (tramp-connectable-p vec)
(throw 'non-essential 'non-essential))
(unless (string-match-p tramp-local-host-regexp (tramp-file-name-host vec))
(tramp-error
vec 'remote-file-error "%s is not a local host" (tramp-file-name-host vec)))
(with-tramp-debug-message vec "Opening connection"
;; We need a process bound to the connection buffer. Therefore,
;; we create a dummy process. Maybe there is a better solution?
(unless (tramp-get-connection-process vec)
(let ((p (make-network-process
:name (tramp-get-connection-name vec)
:buffer (tramp-get-connection-buffer vec)
:server t :host 'local :service t :noquery t)))
(tramp-post-process-creation p vec)
;; Set connection-local variables.
(tramp-set-connection-local-variables vec)
;; Mark it as connected.
(tramp-set-connection-property p "connected" t)))))