[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 78a9d15 2/2: Minor Tramp cleanup
From: |
Michael Albinus |
Subject: |
master 78a9d15 2/2: Minor Tramp cleanup |
Date: |
Tue, 14 Dec 2021 08:40:28 -0500 (EST) |
branch: master
commit 78a9d151b5c53ddcd1408e0ab38b1a53d58fad85
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>
Minor Tramp cleanup
* lisp/net/tramp.el (tramp-get-buffer-string): Simplify.
(tramp-lock-pid): Fix docstring.
---
lisp/net/tramp.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 6b05dad..940e25e 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1874,8 +1874,9 @@ version, the function does nothing."
(defsubst tramp-get-buffer-string (&optional buffer)
"Return contents of BUFFER.
-If BUFFER is not a buffer, return the contents of `current-buffer'."
- (with-current-buffer (if (bufferp buffer) buffer (current-buffer))
+If BUFFER is not a buffer or a buffer name, return the contents
+of `current-buffer'."
+ (with-current-buffer (or buffer (current-buffer))
(substring-no-properties (buffer-string))))
(put #'tramp-get-buffer-string 'tramp-suppress-trace t)
@@ -3964,7 +3965,7 @@ Return nil when there is no lockfile."
(defvar tramp-lock-pid nil
"A random nunber local for every connection.
-Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'")
+Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.")
(defun tramp-get-lock-pid (file)
"Determine pid for lockfile of FILE."
@@ -3985,9 +3986,11 @@ Do not set it manually, it is used buffer-local in
`tramp-get-lock-pid'")
"Like `file-locked-p' for Tramp files."
(when-let ((info (tramp-get-lock-file file))
(match (string-match tramp-lock-file-info-regexp info)))
- (or (and (string-equal (match-string 1 info) (user-login-name))
+ (or ; Locked by me.
+ (and (string-equal (match-string 1 info) (user-login-name))
(string-equal (match-string 2 info) (system-name))
(string-equal (match-string 3 info) (tramp-get-lock-pid file)))
+ ; User name.
(match-string 1 info))))
(defun tramp-handle-lock-file (file)