summaryrefslogtreecommitdiff
path: root/lisp/net/tramp.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2021-08-11 15:34:43 +0200
committerMichael Albinus <michael.albinus@gmx.de>2021-08-11 15:34:43 +0200
commit244acc5a057b0d6ff03754af14d71808b6f20233 (patch)
tree0946a5198a6d37cc375fc278a602ce2d0ff0eb5b /lisp/net/tramp.el
parent1ab9fa60e75a15e09ca28966dd1e4cb364ca3809 (diff)
downloademacs-244acc5a057b0d6ff03754af14d71808b6f20233.tar.gz
emacs-244acc5a057b0d6ff03754af14d71808b6f20233.tar.bz2
emacs-244acc5a057b0d6ff03754af14d71808b6f20233.zip
Replace some `string-match-p' calls in Tramp
* lisp/net/tramp.el (tramp-debug-message, tramp-set-completion-function) (tramp-get-completion-methods, tramp-get-completion-user-host): * lisp/net/tramp-adb.el (tramp-adb-handle-make-process): * lisp/net/tramp-sh.el (tramp-sh-handle-make-process) (tramp-open-connection-setup-interactive-shell) (tramp-convert-file-attributes): Use `string-prefix-p'. * lisp/net/tramp.el (tramp-dissect-file-name) (tramp-progress-reporter-update, tramp-handle-insert-directory): * lisp/net/tramp-cache.el (tramp-get-hash-table) (tramp-flush-directory-properties): * lisp/net/tramp-cmds.el (tramp-append-tramp-buffers): * lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory) (tramp-call-local-coding-command, tramp-get-inline-coding): * lisp/net/tramp-smb.el (tramp-smb-handle-file-attributes) (tramp-smb-handle-file-name-all-completions) (tramp-smb-handle-file-writable-p) (tramp-smb-handle-insert-directory) (tramp-smb-handle-start-file-process, ) (tramp-smb-read-file-entry): Use `tramp-compat-string-search'.
Diffstat (limited to 'lisp/net/tramp.el')
-rw-r--r--lisp/net/tramp.el25
1 files changed, 10 insertions, 15 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index fd426960fd2..6fc0ac8e1ef 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1625,7 +1625,8 @@ default values are used."
(setq v (tramp-dissect-hop-name hop)
hop (and hop (tramp-make-tramp-hop-name v))))
(let ((tramp-default-host
- (or (and v (not (string-match-p "%h" (tramp-file-name-host v)))
+ (or (and v (not (tramp-compat-string-search
+ "%h" (tramp-file-name-host v)))
(tramp-file-name-host v))
tramp-default-host)))
(setq method (tramp-find-method method user host)
@@ -1973,7 +1974,7 @@ ARGUMENTS to actually emit the message (if applicable)."
(if (not btf)
(setq fn "")
(and (symbolp btf) (setq fn (symbol-name btf))
- (or (not (string-match-p "^tramp" fn))
+ (or (not (string-prefix-p "tramp" fn))
(get btf 'tramp-suppress-trace))
(setq fn nil))
(setq btn (1+ btn))))
@@ -2225,7 +2226,7 @@ If VAR is nil, then we bind `v' to the structure and `method', `user',
"Report progress of an operation for Tramp."
(let* ((parameters (cdr reporter))
(message (aref parameters 3)))
- (when (string-match-p message (or (current-message) ""))
+ (when (tramp-compat-string-search message (or (current-message) ""))
(tramp-compat-progress-reporter-update reporter value suffix))))
(defmacro with-tramp-progress-reporter (vec level message &rest body)
@@ -2339,7 +2340,7 @@ Example:
(unless (and (functionp (nth 0 (car v)))
(cond
;; Windows registry.
- ((string-match-p "^HKEY_CURRENT_USER" (nth 1 (car v)))
+ ((string-prefix-p "HKEY_CURRENT_USER" (nth 1 (car v)))
(and (memq system-type '(cygwin windows-nt))
(zerop
(tramp-call-process
@@ -2998,8 +2999,7 @@ remote host and localname (filename on remote host)."
"Return all method completions for PARTIAL-METHOD."
(mapcar
(lambda (method)
- (and method
- (string-match-p (concat "^" (regexp-quote partial-method)) method)
+ (and method (string-prefix-p partial-method method)
(tramp-completion-make-tramp-file-name method nil nil nil)))
(mapcar #'car tramp-methods)))
@@ -3011,8 +3011,7 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match HOST."
(cond
((and partial-user partial-host)
- (if (and host
- (string-match-p (concat "^" (regexp-quote partial-host)) host)
+ (if (and host (string-prefix-p partial-host host)
(string-equal partial-user (or user partial-user)))
(setq user partial-user)
(setq user nil
@@ -3020,16 +3019,12 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match HOST."
(partial-user
(setq host nil)
- (unless
- (and user
- (string-match-p (concat "^" (regexp-quote partial-user)) user))
+ (unless (and user (string-prefix-p partial-user user))
(setq user nil)))
(partial-host
(setq user nil)
- (unless
- (and host
- (string-match-p (concat "^" (regexp-quote partial-host)) host))
+ (unless (and host (string-prefix-p partial-host host))
(setq host nil)))
(t (setq user nil
@@ -3707,7 +3702,7 @@ User is always nil."
(list filename switches wildcard full-directory-p))
;; `ls-lisp' always returns full listings. We must remove
;; superfluous parts.
- (unless (string-match-p "l" switches)
+ (unless (tramp-compat-string-search "l" switches)
(save-excursion
(goto-char (point-min))
(while (setq start