summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-sudoedit.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2023-01-15 17:50:17 +0100
committerMichael Albinus <michael.albinus@gmx.de>2023-01-15 17:50:17 +0100
commitead86da14bffe1ce7471745bc9f443b7001f362a (patch)
tree428885fb944e9af8485ae301976be0b1f3be5867 /lisp/net/tramp-sudoedit.el
parent77ca6aa56e3425c87861cab8abce52bee3697cf4 (diff)
downloademacs-ead86da14bffe1ce7471745bc9f443b7001f362a.tar.gz
Upgrade to length* functions in Tramp
* lisp/net/tramp-compat.el (tramp-compat-replace-regexp-in-region): Move up. (tramp-compat-length<, tramp-compat-length>) (tramp-compat-length=): New defaliases. (tramp-compat-file-name-unquote, tramp-compat-take) (tramp-compat-ntake): Use them. * lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst. (tramp-find-host, tramp-buffer-name, tramp-make-tramp-file-name) (tramp-completion-make-tramp-file-name, tramp-debug-buffer-name) (tramp-completion-handle-file-name-all-completions) (tramp-handle-directory-file-name) (tramp-handle-expand-file-name) (tramp-handle-file-name-as-directory) (tramp-handle-file-name-completion) (tramp-direct-async-process-p, tramp-call-process) (tramp-read-passwd): * lisp/net/tramp-adb.el (tramp-adb-get-device) (tramp-adb-execute-adb-command, tramp-adb-maybe-open-connection): * lisp/net/tramp-archive.el (tramp-archive-handle-directory-file-name): * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name) (tramp-gvfs-monitor-process-filter) (tramp-gvfs-handle-get-home-directory) (tramp-gvfs-handler-askpassword) (tramp-gvfs-maybe-open-connection, tramp-get-media-devices): * lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection): * lisp/net/tramp-sh.el (tramp-sh-handle-file-directory-p) (tramp-sh-handle-insert-directory) (tramp-sh-handle-expand-file-name, tramp-sh-handle-make-process) (tramp-sh-gio-monitor-process-filter, tramp-set-remote-path) (tramp-open-connection-setup-interactive-shell) (tramp-maybe-open-connection, tramp-make-copy-program-file-name): * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory) (tramp-smb-handle-expand-file-name, tramp-smb-handle-file-acl) (tramp-smb-handle-insert-directory) (tramp-smb-handle-set-file-acl) (tramp-smb-handle-get-home-directory) (tramp-smb-maybe-open-connection): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-expand-file-name) (tramp-sudoedit-handle-file-name-all-completions): Use the new functions. * test/lisp/net/tramp-archive-tests.el (tramp-archive-test43-file-system-info): * test/lisp/net/tramp-tests.el (tramp-test26-file-name-completion) (tramp-test31-memory-info, tramp-test35-remote-path) (tramp-test43-file-system-info): Use new compat functions.
Diffstat (limited to 'lisp/net/tramp-sudoedit.el')
-rw-r--r--lisp/net/tramp-sudoedit.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index 2660dbb1fac..ce080918e0f 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -363,7 +363,8 @@ the result will be a local, non-Tramp, file name."
;; If DIR is not given, use `default-directory' or "/".
(setq dir (or dir default-directory "/"))
;; Handle empty NAME.
- (when (zerop (length name)) (setq name "."))
+ (when (string-empty-p name)
+ (setq name "."))
;; Unless NAME is absolute, concat DIR and NAME.
(unless (file-name-absolute-p name)
(setq name (tramp-compat-file-name-concat dir name)))
@@ -374,7 +375,7 @@ the result will be a local, non-Tramp, file name."
;; Tilde expansion if necessary. We cannot accept "~/", because
;; under sudo "~/" is expanded to the local user home directory
;; but to the root home directory.
- (when (zerop (length localname))
+ (when (tramp-string-empty-or-nil-p localname)
(setq localname "~"))
(unless (file-name-absolute-p localname)
(setq localname (format "~%s/%s" user localname)))
@@ -383,7 +384,7 @@ the result will be a local, non-Tramp, file name."
(let ((uname (match-string 1 localname))
(fname (match-string 2 localname))
hname)
- (when (zerop (length uname))
+ (when (tramp-string-empty-or-nil-p uname)
(setq uname user))
(when (setq hname (tramp-get-home-directory v uname))
(setq localname (concat hname fname)))))
@@ -471,7 +472,7 @@ the result will be a local, non-Tramp, file name."
(with-tramp-file-property v localname "file-name-all-completions"
(tramp-sudoedit-send-command
v "ls" "-a1" "--quoting-style=literal" "--show-control-chars"
- (if (zerop (length localname))
+ (if (tramp-string-empty-or-nil-p localname)
"" (file-name-unquote localname)))
(mapcar
(lambda (f)