summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
authorTassilo Horn <tsdh@gnu.org>2019-09-22 11:02:39 +0200
committerTassilo Horn <tsdh@gnu.org>2019-09-22 11:02:39 +0200
commitaf0642a4cb220f33a43d1380be085bc0b7134bb8 (patch)
treee3b1b57bc42e712c77bd55fc4fc722cf93fe6c66 /lisp/net
parent8992bc7d1b7e7babbf2899b5c45e84b486f504e6 (diff)
parent37a4233a366797360c2f4f475591a3406586bcfb (diff)
downloademacs-scratch/tsdh-vc-list-files.tar.gz
Merge remote-tracking branch 'origin/master' into scratch/tsdh-vc-list-filesscratch/tsdh-vc-list-files
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/eww.el32
-rw-r--r--lisp/net/net-utils.el9
-rw-r--r--lisp/net/rfc2104.el2
-rw-r--r--lisp/net/shr.el16
-rw-r--r--lisp/net/tramp-adb.el12
-rw-r--r--lisp/net/tramp-gvfs.el4
-rw-r--r--lisp/net/tramp-rclone.el13
-rw-r--r--lisp/net/tramp-sh.el45
-rw-r--r--lisp/net/tramp-smb.el73
-rw-r--r--lisp/net/tramp-sudoedit.el25
-rw-r--r--lisp/net/tramp.el71
11 files changed, 166 insertions, 136 deletions
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 77e6cec9b04..fb495a98582 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -326,6 +326,18 @@ the default EWW buffer."
#'url-hexify-string (split-string url) "+"))))))
url)
+(defun eww--preprocess-html (start end)
+ "Translate all < characters that do not look like start of tags into &lt;."
+ (save-excursion
+ (save-restriction
+ (narrow-to-region start end)
+ (goto-char start)
+ (let ((case-fold-search t))
+ (while (re-search-forward "<[^0-9a-z!/]" nil t)
+ (goto-char (match-beginning 0))
+ (delete-region (point) (1+ (point)))
+ (insert "&lt;"))))))
+
;;;###autoload (defalias 'browse-web 'eww)
;;;###autoload
@@ -479,6 +491,7 @@ Currently this means either text/html or application/xhtml+xml."
;; Remove CRLF and replace NUL with &#0; before parsing.
(while (re-search-forward "\\(\r$\\)\\|\0" nil t)
(replace-match (if (match-beginning 1) "" "&#0;") t t)))
+ (eww--preprocess-html (point) (point-max))
(libxml-parse-html-region (point) (point-max))))))
(source (and (null document)
(buffer-substring (point) (point-max)))))
@@ -716,6 +729,7 @@ the like."
(condition-case nil
(decode-coding-region (point-min) (point-max) 'utf-8)
(coding-system-error nil))
+ (eww--preprocess-html (point-min) (point-max))
(libxml-parse-html-region (point-min) (point-max))))
(base (plist-get eww-data :url)))
(eww-score-readability dom)
@@ -1433,15 +1447,15 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
(push (cons name (plist-get input :value))
values)))
((equal (plist-get input :type) "file")
- (push (cons "file"
- (list (cons "filedata"
- (with-temp-buffer
- (insert-file-contents
- (plist-get input :filename))
- (buffer-string)))
- (cons "name" (plist-get input :name))
- (cons "filename" (plist-get input :filename))))
- values))
+ (when-let ((file (plist-get input :filename)))
+ (push (list "file"
+ (cons "filedata"
+ (with-temp-buffer
+ (insert-file-contents file)
+ (buffer-string)))
+ (cons "name" name)
+ (cons "filename" file))
+ values)))
((equal (plist-get input :type) "submit")
;; We want the values from buttons if we hit a button if
;; we hit enter on it, or if it's the first button after
diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index 4f68e5db61d..03ed4a59575 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -563,7 +563,7 @@ This command uses `nslookup-program' to look up DNS records."
(apply #'vector (mapcar #'string-to-number (split-string ip "\\."))))
(t (error "Invalid format: %s" format)))))
-(defun ipv6-expand (ipv6-vector)
+(defun nslookup--ipv6-expand (ipv6-vector)
(let ((len (length ipv6-vector)))
(if (< len 8)
(let* ((pivot (cl-position 0 ipv6-vector))
@@ -598,9 +598,10 @@ This command uses `nslookup-program' to look up DNS records."
(cond ((memq format '(string nil))
ip)
((eq format 'vector)
- (ipv6-expand (apply #'vector
- (cl-loop for hextet in (split-string ip "[:]")
- collect (string-to-number hextet 16)))))
+ (nslookup--ipv6-expand
+ (apply #'vector
+ (cl-loop for hextet in (split-string ip "[:]")
+ collect (string-to-number hextet 16)))))
(t (error "Invalid format: %s" format)))))
;;;###autoload
diff --git a/lisp/net/rfc2104.el b/lisp/net/rfc2104.el
index 5de8401d5b6..fadc979bc15 100644
--- a/lisp/net/rfc2104.el
+++ b/lisp/net/rfc2104.el
@@ -37,8 +37,6 @@
;; 64 is block length of hash function (64 for MD5 and SHA), 16 is
;; resulting hash length (16 for MD5, 20 for SHA).
;;
-;; Tested with Emacs 20.2 and XEmacs 20.3.
-;;
;; Test case reference: RFC 2202.
;;; History:
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 81c3fb4aa52..1dff129b9dc 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1180,8 +1180,24 @@ Return a string with image data."
;; so glitches may occur during this transformation.
(shr-dom-to-xml
(libxml-parse-xml-region (point) (point-max)))))
+ ;; SVG images often do not have a specified foreground/background
+ ;; color, so wrap them in styles.
+ (when (eq content-type 'image/svg+xml)
+ (setq data (svg--wrap-svg data)))
(list data content-type)))
+(defun svg--wrap-svg (data)
+ "Add a default foreground colour to SVG images."
+ (with-temp-buffer
+ (insert "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" "
+ "xmlns:xi=\"http://www.w3.org/2001/XInclude\" "
+ "style=\"color: "
+ (face-foreground 'default) ";\">"
+ "<xi:include href=\"data:image/svg+xml;base64,"
+ (base64-encode-string data t)
+ "\"></xi:include></svg>")
+ (buffer-string)))
+
(defun shr-image-displayer (content-function)
"Return a function to display an image.
CONTENT-FUNCTION is a function to retrieve an image for a cid url that
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index df4778c9c96..982522bdaf4 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1191,6 +1191,10 @@ FMT and ARGS are passed to `error'."
"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))
+
(let* ((buf (tramp-get-connection-buffer vec))
(p (get-buffer-process buf))
(host (tramp-file-name-host vec))
@@ -1204,14 +1208,6 @@ connection if a previous connection has died for some reason."
(tramp-error vec 'file-error "Cannot switch to user `%s'" user))
(unless (process-live-p p)
- ;; During completion, don't reopen a new connection. We check
- ;; this for the process related to `tramp-buffer-name';
- ;; otherwise `start-file-process' wouldn't run ever when
- ;; `non-essential' is non-nil.
- (when (and (tramp-completion-mode-p)
- (null (get-process (tramp-buffer-name vec))))
- (throw 'non-essential 'non-essential))
-
(save-match-data
(when (and p (processp p)) (delete-process p))
(if (zerop (length device))
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index b9b6b4b6d18..1036865e4ec 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1787,6 +1787,10 @@ This is relevant for GNOME Online Accounts."
"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))
+
;; We set the file name, in case there are incoming D-Bus signals or
;; D-Bus errors.
(setq tramp-gvfs-dbus-event-vector vec)
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
index 866e7791bf8..1f0c7eadbc5 100644
--- a/lisp/net/tramp-rclone.el
+++ b/lisp/net/tramp-rclone.el
@@ -520,19 +520,14 @@ file names."
"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))
+
(let ((host (tramp-file-name-host vec)))
(when (rassoc `(,host) (tramp-rclone-parse-device-names nil))
(if (zerop (length host))
(tramp-error vec 'file-error "Storage %s not connected" host))
-
- ;; During completion, don't reopen a new connection. We check
- ;; this for the process related to `tramp-buffer-name';
- ;; otherwise `start-file-process' wouldn't run ever when
- ;; `non-essential' is non-nil.
- (when (and (tramp-completion-mode-p)
- (null (get-process (tramp-buffer-name vec))))
- (throw 'non-essential 'non-essential))
-
;; We need a process bound to the connection buffer. Therefore,
;; we create a dummy process. Maybe there is a better solution?
(unless (get-buffer-process (tramp-get-connection-buffer vec))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index bcfac78ee65..8092f6a5cf1 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -525,7 +525,9 @@ based on the Tramp and Emacs versions, and should not be set here."
:type '(repeat string))
;;;###tramp-autoload
-(defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile"))
+(defcustom tramp-sh-extra-args
+ '(("/bash\\'" . "-norc -noprofile")
+ ("/zsh\\'" . "-f +Z"))
"Alist specifying extra arguments to pass to the remote shell.
Entries are (REGEXP . ARGS) where REGEXP is a regular expression
matching the shell file name and ARGS is a string specifying the
@@ -1198,18 +1200,22 @@ component is used as the target of the symlink."
(defun tramp-sh-handle-file-exists-p (filename)
"Like `file-exists-p' for Tramp files."
- (with-parsed-tramp-file-name filename nil
- (with-tramp-file-property v localname "file-exists-p"
- (or (not (null (tramp-get-file-property
- v localname "file-attributes-integer" nil)))
- (not (null (tramp-get-file-property
- v localname "file-attributes-string" nil)))
- (tramp-send-command-and-check
- v
- (format
- "%s %s"
- (tramp-get-file-exists-command v)
- (tramp-shell-quote-argument localname)))))))
+ ;; `file-exists-p' is used as predicate in file name completion.
+ ;; We don't want to run it when `non-essential' is t, or there is
+ ;; no connection process yet.
+ (when (tramp-connectable-p filename)
+ (with-parsed-tramp-file-name filename nil
+ (with-tramp-file-property v localname "file-exists-p"
+ (or (not (null (tramp-get-file-property
+ v localname "file-attributes-integer" nil)))
+ (not (null (tramp-get-file-property
+ v localname "file-attributes-string" nil)))
+ (tramp-send-command-and-check
+ v
+ (format
+ "%s %s"
+ (tramp-get-file-exists-command v)
+ (tramp-shell-quote-argument localname))))))))
(defun tramp-sh-handle-file-attributes (filename &optional id-format)
"Like `file-attributes' for Tramp files."
@@ -4762,6 +4768,10 @@ If there is just some editing, retry it after 5 seconds."
"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))
+
(let ((p (tramp-get-connection-process vec))
(process-name (tramp-get-connection-property vec "process-name" nil))
(process-environment (copy-sequence process-environment))
@@ -4806,15 +4816,6 @@ connection if a previous connection has died for some reason."
;; New connection must be opened.
(condition-case err
(unless (process-live-p p)
-
- ;; During completion, don't reopen a new connection. We
- ;; check this for the process related to
- ;; `tramp-buffer-name'; otherwise `start-file-process'
- ;; wouldn't run ever when `non-essential' is non-nil.
- (when (and (tramp-completion-mode-p)
- (null (get-process (tramp-buffer-name vec))))
- (throw 'non-essential 'non-essential))
-
(with-tramp-progress-reporter
vec 3
(if (zerop (length (tramp-file-name-user vec)))
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 5df26a1e33e..b008e6b25eb 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -832,12 +832,12 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
"Implement `file-attributes' for Tramp files using stat command."
(tramp-message
vec 5 "file attributes with stat: %s" (tramp-file-name-localname vec))
- (with-current-buffer (tramp-get-connection-buffer vec)
- (let* (size id link uid gid atime mtime ctime mode inode)
- (when (tramp-smb-send-command
- vec (format "stat \"%s\"" (tramp-smb-get-localname vec)))
+ (let* (size id link uid gid atime mtime ctime mode inode)
+ (when (tramp-smb-send-command
+ vec (format "stat \"%s\"" (tramp-smb-get-localname vec)))
- ;; Loop the listing.
+ ;; Loop the listing.
+ (with-current-buffer (tramp-get-connection-buffer vec)
(goto-char (point-min))
(unless (re-search-forward tramp-smb-errors nil t)
(while (not (eobp))
@@ -1628,40 +1628,40 @@ Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)."
(with-parsed-tramp-file-name (file-name-as-directory directory) nil
(setq localname (or localname "/"))
(with-tramp-file-property v localname "file-entries"
- (with-current-buffer (tramp-get-connection-buffer v)
- (let* ((share (tramp-smb-get-share v))
- (cache (tramp-get-connection-property v "share-cache" nil))
- res entry)
-
- (if (and (not share) cache)
- ;; Return cached shares.
- (setq res cache)
-
- ;; Read entries.
- (if share
- (tramp-smb-send-command
- v (format "dir \"%s*\"" (tramp-smb-get-localname v)))
- ;; `tramp-smb-maybe-open-connection' lists also the share names.
- (tramp-smb-maybe-open-connection v))
-
- ;; Loop the listing.
+ (let* ((share (tramp-smb-get-share v))
+ (cache (tramp-get-connection-property v "share-cache" nil))
+ res entry)
+
+ (if (and (not share) cache)
+ ;; Return cached shares.
+ (setq res cache)
+
+ ;; Read entries.
+ (if share
+ (tramp-smb-send-command
+ v (format "dir \"%s*\"" (tramp-smb-get-localname v)))
+ ;; `tramp-smb-maybe-open-connection' lists also the share names.
+ (tramp-smb-maybe-open-connection v))
+
+ ;; Loop the listing.
+ (with-current-buffer (tramp-get-connection-buffer v)
(goto-char (point-min))
(if (re-search-forward tramp-smb-errors nil t)
(tramp-error v 'file-error "%s `%s'" (match-string 0) directory)
(while (not (eobp))
(setq entry (tramp-smb-read-file-entry share))
(forward-line)
- (when entry (push entry res))))
+ (when entry (push entry res)))))
- ;; Cache share entries.
- (unless share
- (tramp-set-connection-property v "share-cache" res)))
+ ;; Cache share entries.
+ (unless share
+ (tramp-set-connection-property v "share-cache" res)))
- ;; Add directory itself.
- (push '("" "drwxrwxrwx" 0 (0 0)) res)
+ ;; Add directory itself.
+ (push '("" "drwxrwxrwx" 0 (0 0)) res)
- ;; Return entries.
- (delq nil res))))))
+ ;; Return entries.
+ (delq nil res)))))
;; Return either a share name (if SHARE is nil), or a file name.
;;
@@ -1855,6 +1855,10 @@ Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason.
If ARGUMENT is non-nil, use it as argument for
`tramp-smb-winexe-program', and suppress any checks."
+ ;; During completion, don't reopen a new connection.
+ (unless (tramp-connectable-p vec)
+ (throw 'non-essential 'non-essential))
+
(let* ((share (tramp-smb-get-share vec))
(buf (tramp-get-connection-buffer vec))
(p (get-buffer-process buf)))
@@ -1909,15 +1913,6 @@ If ARGUMENT is non-nil, use it as argument for
(string-equal
share
(tramp-get-connection-property p "smb-share" ""))))
-
- ;; During completion, don't reopen a new connection. We
- ;; check this for the process related to
- ;; `tramp-buffer-name'; otherwise `start-file-process'
- ;; wouldn't run ever when `non-essential' is non-nil.
- (when (and (tramp-completion-mode-p)
- (null (get-process (tramp-buffer-name vec))))
- (throw 'non-essential 'non-essential))
-
(save-match-data
;; There might be unread output from checking for share names.
(when buf (with-current-buffer buf (erase-buffer)))
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index 80ce8f78747..bfc9b3bdc3a 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -424,10 +424,14 @@ the result will be a local, non-Tramp, file name."
(defun tramp-sudoedit-handle-file-exists-p (filename)
"Like `file-exists-p' for Tramp files."
- (with-parsed-tramp-file-name filename nil
- (with-tramp-file-property v localname "file-exists-p"
- (tramp-sudoedit-send-command
- v "test" "-e" (tramp-compat-file-name-unquote localname)))))
+ ;; `file-exists-p' is used as predicate in file name completion.
+ ;; We don't want to run it when `non-essential' is t, or there is
+ ;; no connection process yet.
+ (when (tramp-connectable-p filename)
+ (with-parsed-tramp-file-name filename nil
+ (with-tramp-file-property v localname "file-exists-p"
+ (tramp-sudoedit-send-command
+ v "test" "-e" (tramp-compat-file-name-unquote localname))))))
(defun tramp-sudoedit-handle-file-name-all-completions (filename directory)
"Like `file-name-all-completions' for Tramp files."
@@ -760,18 +764,13 @@ Remove unneeded output."
"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))
+
;; 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)
-
- ;; During completion, don't reopen a new connection. We check
- ;; this for the process related to `tramp-buffer-name'; otherwise
- ;; `start-file-process' wouldn't run ever when `non-essential' is
- ;; non-nil.
- (when (and (tramp-completion-mode-p)
- (null (get-process (tramp-buffer-name vec))))
- (throw 'non-essential 'non-essential))
-
(let ((p (make-network-process
:name (tramp-get-connection-name vec)
:buffer (tramp-get-connection-buffer vec)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index ed0f1def181..aefb84bb4e4 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1566,25 +1566,27 @@ necessary only. This function will be used in file name completion."
tramp-postfix-host-format))
(when localname localname)))
-(defun tramp-get-buffer (vec)
+(defun tramp-get-buffer (vec &optional dont-create)
"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))
- ;; We use the existence of connection property "process-buffer"
- ;; as indication, whether a connection is active.
- (tramp-set-connection-property
- vec "process-buffer"
- (tramp-get-connection-property vec "process-buffer" nil))
- (setq buffer-undo-list t
- default-directory (tramp-make-tramp-file-name vec 'noloc 'nohop))
- (current-buffer))))
-
-(defun tramp-get-connection-buffer (vec)
+ (unless dont-create
+ (with-current-buffer (get-buffer-create (tramp-buffer-name vec))
+ ;; We use the existence of connection property "process-buffer"
+ ;; as indication, whether a connection is active.
+ (tramp-set-connection-property
+ vec "process-buffer"
+ (tramp-get-connection-property vec "process-buffer" nil))
+ (setq buffer-undo-list t
+ default-directory
+ (tramp-make-tramp-file-name vec 'noloc 'nohop))
+ (current-buffer)))))
+
+(defun tramp-get-connection-buffer (vec &optional dont-create)
"Get the connection buffer to be used for VEC.
In case a second asynchronous communication has been started, it is different
from `tramp-get-buffer'."
(or (tramp-get-connection-property vec "process-buffer" nil)
- (tramp-get-buffer vec)))
+ (tramp-get-buffer vec dont-create)))
(defun tramp-get-connection-name (vec)
"Get the connection name to be used for VEC.
@@ -1770,14 +1772,15 @@ applicable)."
;; Log only when there is a minimum level.
(when (>= tramp-verbose 4)
(let ((tramp-verbose 0))
- ;; Append connection buffer for error messages.
+ ;; Append connection buffer for error messages, if exists.
(when (= level 1)
- (with-current-buffer
- (if (processp vec-or-proc)
- (process-buffer vec-or-proc)
- (tramp-get-connection-buffer vec-or-proc))
- (setq fmt-string (concat fmt-string "\n%s")
- arguments (append arguments (list (buffer-string))))))
+ (ignore-errors
+ (with-current-buffer
+ (if (processp vec-or-proc)
+ (process-buffer vec-or-proc)
+ (tramp-get-connection-buffer vec-or-proc 'dont-create))
+ (setq fmt-string (concat fmt-string "\n%s")
+ arguments (append arguments (list (buffer-string)))))))
;; Translate proc to vec.
(when (processp vec-or-proc)
(setq vec-or-proc (process-get vec-or-proc 'vector))))
@@ -2517,16 +2520,21 @@ Add operations defined in `HANDLER-alist' to `tramp-file-name-handler'."
;; This variable has been obsoleted in Emacs 26.
tramp-completion-mode))
-(defun tramp-connectable-p (filename)
+(defun tramp-connectable-p (vec-or-filename)
"Check, whether it is possible to connect the remote host w/o side-effects.
This is true, if either the remote host is already connected, or if we are
not in completion mode."
- (let (tramp-verbose)
- (and (tramp-tramp-file-p filename)
- (or (not (tramp-completion-mode-p))
- (process-live-p
- (tramp-get-connection-process
- (tramp-dissect-file-name filename)))))))
+ (let (tramp-verbose
+ (vec
+ (cond
+ ((tramp-file-name-p vec-or-filename) vec-or-filename)
+ ((tramp-tramp-file-p vec-or-filename)
+ (tramp-dissect-file-name vec-or-filename)))))
+ (or ;; We check this for the process related to
+ ;; `tramp-buffer-name'; otherwise `start-file-process'
+ ;; wouldn't run ever when `non-essential' is non-nil.
+ (and vec (process-live-p (get-process (tramp-buffer-name vec))))
+ (not (tramp-completion-mode-p)))))
;; Method, host name and user name completion.
;; `tramp-completion-dissect-file-name' returns a list of
@@ -2606,8 +2614,7 @@ not in completion mode."
(try-completion
filename
(mapcar #'list (file-name-all-completions filename directory))
- (when (and predicate
- (tramp-connectable-p (expand-file-name filename directory)))
+ (when (and predicate (tramp-connectable-p directory))
(lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
;; I misuse a little bit the `tramp-file-name' structure in order to
@@ -3096,7 +3103,11 @@ User is always nil."
(defun tramp-handle-file-exists-p (filename)
"Like `file-exists-p' for Tramp files."
- (not (null (file-attributes filename))))
+ ;; `file-exists-p' is used as predicate in file name completion.
+ ;; We don't want to run it when `non-essential' is t, or there is
+ ;; no connection process yet.
+ (when (tramp-connectable-p filename)
+ (not (null (file-attributes filename)))))
(defun tramp-handle-file-in-directory-p (filename directory)
"Like `file-in-directory-p' for Tramp files."