[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master d3ead37: Remove compatibility hack in Tramp
From: |
Michael Albinus |
Subject: |
master d3ead37: Remove compatibility hack in Tramp |
Date: |
Fri, 31 Jan 2020 04:29:11 -0500 (EST) |
branch: master
commit d3ead375092e2690c1d1d6a5dd82e6e89cdf4f4c
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
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.
---
lisp/net/tramp-compat.el | 19 +++++--------------
lisp/net/tramp-gvfs.el | 4 ++--
lisp/net/tramp.el | 19 ++++++++++++++++---
3 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index ba1cb9e..87bcd08 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -77,20 +77,6 @@ Add the extension of F, if existing."
#'temporary-file-directory
#'tramp-handle-temporary-file-directory))
-(defun tramp-compat-process-running-p (process-name)
- "Return t if system process PROCESS-NAME is running for `user-login-name'."
- (when (stringp process-name)
- (let (result)
- (dolist (pid (tramp-compat-funcall 'list-system-processes) result)
- (let ((attributes (process-attributes pid)))
- (and (string-equal (cdr (assoc 'user attributes)) (user-login-name))
- (when-let ((comm (cdr (assoc 'comm attributes))))
- ;; The returned command name could be truncated to 15
- ;; characters. Therefore, we cannot check for
- ;; `string-equal'.
- (string-match-p (concat "^" (regexp-quote comm)) process-name))
- (setq result t)))))))
-
;; `file-attribute-*' are introduced in Emacs 26.1.
(defalias 'tramp-compat-file-attribute-type
@@ -296,4 +282,9 @@ A nil value for either argument stands for the current
time."
(provide 'tramp-compat)
+;;; TODO:
+;;
+;; * Starting with Emacs 27.1, there's no need to escape open
+;; parentheses with a backslash in docstrings anymore.
+
;;; tramp-compat.el ends here
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 4374dc0..2c117fe 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -125,8 +125,8 @@
(autoload 'zeroconf-init "zeroconf")
(tramp-compat-funcall 'dbus-get-unique-name :system)
(tramp-compat-funcall 'dbus-get-unique-name :session)
- (or (tramp-compat-process-running-p "gvfs-fuse-daemon")
- (tramp-compat-process-running-p "gvfsd-fuse"))))
+ (or (tramp-process-running-p "gvfs-fuse-daemon")
+ (tramp-process-running-p "gvfsd-fuse"))))
"Non-nil when GVFS is available.")
;;;###tramp-autoload
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 131681a..70d0fb0 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1999,9 +1999,9 @@ without a visible progress reporter."
(tm
;; We start a pulsing progress reporter after 3
;; seconds. Display only when there is a minimum level.
- (when (<= ,level (min tramp-verbose 3))
- (when-let ((pr (make-progress-reporter ,message nil nil)))
- (run-at-time 3 0.1 #'tramp-progress-reporter-update pr)))))
+ (when-let ((pr (and (<= ,level (min tramp-verbose 3))
+ (make-progress-reporter ,message nil nil))))
+ (run-at-time 3 0.1 #'tramp-progress-reporter-update pr))))
(unwind-protect
;; Execute the body.
(prog1 (progn ,@body) (setq cookie "done"))
@@ -4816,6 +4816,19 @@ verbosity of 6."
(tramp-message vec 6 "%s" result)
result))
+(defun tramp-process-running-p (process-name)
+ "Return t if system process PROCESS-NAME is running for `user-login-name'."
+ (when (stringp process-name)
+ (catch 'result
+ (dolist (pid (tramp-compat-funcall 'list-system-processes))
+ (let ((attributes (process-attributes pid)))
+ (and (string-equal (cdr (assoc 'user attributes)) (user-login-name))
+ (when-let ((comm (cdr (assoc 'comm attributes))))
+ ;; The returned command name could be truncated to 15
+ ;; characters. Therefore, we cannot check for `string-equal'.
+ (string-prefix-p comm process-name))
+ (throw 'result t)))))))
+
(defun tramp-read-passwd (proc &optional prompt)
"Read a password from user (compat function).
Consults the auth-source package.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master d3ead37: Remove compatibility hack in Tramp,
Michael Albinus <=