aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2020-01-31 10:29:02 +0100
committerMichael Albinus2020-01-31 10:29:02 +0100
commitd3ead375092e2690c1d1d6a5dd82e6e89cdf4f4c (patch)
tree917ed5f0309542cdf49414ed6c7f79520118c245
parent78b87263920e9ba73b37c5014acf6c88b745764f (diff)
downloademacs-d3ead375092e2690c1d1d6a5dd82e6e89cdf4f4c.tar.gz
emacs-d3ead375092e2690c1d1d6a5dd82e6e89cdf4f4c.zip
Remove compatibility hack in Tramp
* lisp/net/tramp-compat.el (tramp-compat-process-running-p): Remove. * lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Use `tramp-process-running-p'. * lisp/net/lisp/net/tramp.el (with-tramp-progress-reporter): Simplify. (tramp-process-running-p): New defun.
-rw-r--r--lisp/net/tramp-compat.el19
-rw-r--r--lisp/net/tramp-gvfs.el4
-rw-r--r--lisp/net/tramp.el19
3 files changed, 23 insertions, 19 deletions
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index ba1cb9e4310..87bcd08b85a 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -77,20 +77,6 @@ Add the extension of F, if existing."
77 #'temporary-file-directory 77 #'temporary-file-directory
78 #'tramp-handle-temporary-file-directory)) 78 #'tramp-handle-temporary-file-directory))
79 79
80(defun tramp-compat-process-running-p (process-name)
81 "Return t if system process PROCESS-NAME is running for `user-login-name'."
82 (when (stringp process-name)
83 (let (result)
84 (dolist (pid (tramp-compat-funcall 'list-system-processes) result)
85 (let ((attributes (process-attributes pid)))
86 (and (string-equal (cdr (assoc 'user attributes)) (user-login-name))
87 (when-let ((comm (cdr (assoc 'comm attributes))))
88 ;; The returned command name could be truncated to 15
89 ;; characters. Therefore, we cannot check for
90 ;; `string-equal'.
91 (string-match-p (concat "^" (regexp-quote comm)) process-name))
92 (setq result t)))))))
93
94;; `file-attribute-*' are introduced in Emacs 26.1. 80;; `file-attribute-*' are introduced in Emacs 26.1.
95 81
96(defalias 'tramp-compat-file-attribute-type 82(defalias 'tramp-compat-file-attribute-type
@@ -296,4 +282,9 @@ A nil value for either argument stands for the current time."
296 282
297(provide 'tramp-compat) 283(provide 'tramp-compat)
298 284
285;;; TODO:
286;;
287;; * Starting with Emacs 27.1, there's no need to escape open
288;; parentheses with a backslash in docstrings anymore.
289
299;;; tramp-compat.el ends here 290;;; tramp-compat.el ends here
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 4374dc0a10d..2c117fe630b 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -125,8 +125,8 @@
125 (autoload 'zeroconf-init "zeroconf") 125 (autoload 'zeroconf-init "zeroconf")
126 (tramp-compat-funcall 'dbus-get-unique-name :system) 126 (tramp-compat-funcall 'dbus-get-unique-name :system)
127 (tramp-compat-funcall 'dbus-get-unique-name :session) 127 (tramp-compat-funcall 'dbus-get-unique-name :session)
128 (or (tramp-compat-process-running-p "gvfs-fuse-daemon") 128 (or (tramp-process-running-p "gvfs-fuse-daemon")
129 (tramp-compat-process-running-p "gvfsd-fuse")))) 129 (tramp-process-running-p "gvfsd-fuse"))))
130 "Non-nil when GVFS is available.") 130 "Non-nil when GVFS is available.")
131 131
132;;;###tramp-autoload 132;;;###tramp-autoload
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 131681a8fdc..70d0fb070d8 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1999,9 +1999,9 @@ without a visible progress reporter."
1999 (tm 1999 (tm
2000 ;; We start a pulsing progress reporter after 3 2000 ;; We start a pulsing progress reporter after 3
2001 ;; seconds. Display only when there is a minimum level. 2001 ;; seconds. Display only when there is a minimum level.
2002 (when (<= ,level (min tramp-verbose 3)) 2002 (when-let ((pr (and (<= ,level (min tramp-verbose 3))
2003 (when-let ((pr (make-progress-reporter ,message nil nil))) 2003 (make-progress-reporter ,message nil nil))))
2004 (run-at-time 3 0.1 #'tramp-progress-reporter-update pr))))) 2004 (run-at-time 3 0.1 #'tramp-progress-reporter-update pr))))
2005 (unwind-protect 2005 (unwind-protect
2006 ;; Execute the body. 2006 ;; Execute the body.
2007 (prog1 (progn ,@body) (setq cookie "done")) 2007 (prog1 (progn ,@body) (setq cookie "done"))
@@ -4816,6 +4816,19 @@ verbosity of 6."
4816 (tramp-message vec 6 "%s" result) 4816 (tramp-message vec 6 "%s" result)
4817 result)) 4817 result))
4818 4818
4819(defun tramp-process-running-p (process-name)
4820 "Return t if system process PROCESS-NAME is running for `user-login-name'."
4821 (when (stringp process-name)
4822 (catch 'result
4823 (dolist (pid (tramp-compat-funcall 'list-system-processes))
4824 (let ((attributes (process-attributes pid)))
4825 (and (string-equal (cdr (assoc 'user attributes)) (user-login-name))
4826 (when-let ((comm (cdr (assoc 'comm attributes))))
4827 ;; The returned command name could be truncated to 15
4828 ;; characters. Therefore, we cannot check for `string-equal'.
4829 (string-prefix-p comm process-name))
4830 (throw 'result t)))))))
4831
4819(defun tramp-read-passwd (proc &optional prompt) 4832(defun tramp-read-passwd (proc &optional prompt)
4820 "Read a password from user (compat function). 4833 "Read a password from user (compat function).
4821Consults the auth-source package. 4834Consults the auth-source package.