(name (match-string 6))
(symlink-target
(and is-symlink
- (cadr (split-string name (rx (group (| " -> " "\n"))))))))
+ (cadr (split-string name (rx (| " -> " "\n")))))))
(push (list
(if is-symlink
- (car (split-string name (rx (group (| " -> " "\n")))))
+ (car (split-string name (rx (| " -> " "\n"))))
name)
(or is-dir symlink-target)
1 ;link-count
;; (introduced in POSIX.1-2008) fails.
(tramp-adb-send-command-and-check
v (format
- (eval-when-compile
- (concat "touch -d %s %s %s 2>%s || "
- "touch -d %s %s %s 2>%s || "
- "touch -t %s %s %s"))
+ (concat "touch -d %s %s %s 2>%s || "
+ "touch -d %s %s %s 2>%s || "
+ "touch -t %s %s %s")
(format-time-string "%Y-%m-%dT%H:%M:%S.%NZ" time t)
nofollow quoted-name (tramp-get-remote-null-device v)
(format-time-string "%Y-%m-%dT%H:%M:%S" time t)
(tramp-message vec 5 "Checking system information")
(tramp-adb-send-command
vec
- (eval-when-compile
- (concat
- "echo \\\"`getprop ro.product.model` "
- "`getprop ro.product.version` "
- "`getprop ro.build.version.release`\\\"")))
+ (concat
+ "echo \\\"`getprop ro.product.model` "
+ "`getprop ro.product.version` "
+ "`getprop ro.build.version.release`\\\""))
(let ((old-getprop (tramp-get-connection-property vec "getprop"))
(new-getprop
(tramp-set-connection-property
(progn (defmacro tramp-archive-autoload-file-name-regexp ()
"Regular expression matching archive file names."
'(rx bos
- ;; \1
+ ;; This group is used in `tramp-archive-file-name-archive'.
(group
(+ nonl)
;; Default suffixes ...
"." (regexp (regexp-opt tramp-archive-suffixes))
;; ... with compression.
(? "." (regexp (regexp-opt tramp-archive-compression-suffixes))))
- ;; \2
+ ;; This group is used in `tramp-archive-file-name-localname'.
(group "/" (* nonl))
eos)))
This is suppressed for temporary buffers."
(save-match-data
(unless (or (null (buffer-name))
- (string-match-p (rx bos (| " " "*")) (buffer-name)))
+ (string-match-p (rx bos (| space "*")) (buffer-name)))
(let ((bfn (if (stringp (buffer-file-name))
(buffer-file-name)
default-directory))
(dir (tramp-rename-read-file-name-dir default))
(init (tramp-rename-read-file-name-init default))
(tramp-ignored-file-name-regexp
- (regexp-quote (file-remote-p source))))
+ (rx (literal (file-remote-p source)))))
(read-file-name-default
"Enter new Tramp connection: "
dir default 'confirm init #'file-directory-p)))))
(dir (tramp-rename-read-file-name-dir default))
(init (tramp-rename-read-file-name-init default))
(tramp-ignored-file-name-regexp
- (regexp-quote (file-remote-p source))))
+ (rx (literal (file-remote-p source)))))
(read-file-name-default
(format "Change Tramp connection `%s': " source)
dir default 'confirm init #'file-directory-p)))))
(defconst tramp-gvfs-password-anonymous-supported 16
"Operation supports anonymous users.")
+;; Since: 2.58
+(defconst tramp-gvfs-password-tcrypt 32
+ "Operation takes TCRYPT parameters.")
+
;; For the time being, we just need org.goa.Account and org.goa.Files
;; interfaces. We document the other ones, just in case.
"unix::device")
"GVFS file attributes."))
-(eval-and-compile
- (defconst tramp-gvfs-file-attributes-with-gvfs-ls-regexp
- (rx blank (group (regexp (regexp-opt tramp-gvfs-file-attributes)))
- "=" (group (+? nonl)))
- "Regexp to parse GVFS file attributes with `gvfs-ls'."))
+(defconst tramp-gvfs-file-attributes-with-gvfs-ls-regexp
+ (rx blank (group (regexp (regexp-opt tramp-gvfs-file-attributes)))
+ "=" (group (+? nonl)))
+ "Regexp to parse GVFS file attributes with `gvfs-ls'.")
(defconst tramp-gvfs-file-attributes-with-gvfs-info-regexp
(rx bol (* blank) (group (regexp (regexp-opt tramp-gvfs-file-attributes)))
(if (eq id-format 'integer)
(string-to-number
(or (cdr (assoc "unix::uid" attributes))
- (eval-when-compile (format "%s" tramp-unknown-id-integer))))
+ (number-to-string tramp-unknown-id-integer)))
(or (cdr (assoc "owner::user" attributes))
(cdr (assoc "unix::uid" attributes))
tramp-unknown-id-string)))
(if (eq id-format 'integer)
(string-to-number
(or (cdr (assoc "unix::gid" attributes))
- (eval-when-compile (format "%s" tramp-unknown-id-integer))))
+ (number-to-string tramp-unknown-id-integer)))
(or (cdr (assoc "owner::group" attributes))
(cdr (assoc "unix::gid" attributes))
tramp-unknown-id-string)))
"Retrieve file name from D-Bus OBJECT-PATH."
(dbus-unescape-from-identifier
(replace-regexp-in-string
- (rx bol (* nonl) "/" (+ (not (any "/"))) eol) "\\1" object-path)))
+ (rx bol (* nonl) "/" (group (+ (not (any "/")))) eol) "\\1" object-path)))
(defun tramp-gvfs-url-host (url)
"Return the host name part of URL, a string.
(defun tramp-rfn-eshadow-update-overlay-regexp ()
"An overlay covering the shadowed part of the filename."
(rx-to-string
- `(: (* (not (any ,tramp-postfix-host-format "/~"))) (or "/" "~"))))
+ `(: (* (not (any ,tramp-postfix-host-format "/~"))) (| "/" "~"))))
(defun tramp-rfn-eshadow-update-overlay ()
"Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input.
:mode 'tramp-info-lookup-mode :topic 'symbol
:regexp (rx (+ (not (any "\t\n \"'(),[]`‘’"))))
:doc-spec '(("(tramp)Function Index" nil
- (rx bol " " (+ "-") " " (* nonl) ": ")
- (rx (group (| " " eol))))
+ (rx bol space (+ "-") space (* nonl) ": ")
+ (rx (| space eol)))
("(tramp)Variable Index" nil
- (rx bol " " (+ "-") " " (* nonl) ": ")
- (rx (group (| " " eol))))))
+ (rx bol space (+ "-") space (* nonl) ": ")
+ (rx (| space eol)))))
(add-hook
'tramp-integration-unload-hook
,(rx bos (literal tramp-root-id-string) eos) "su"))
(add-to-list 'tramp-default-user-alist
- `(,(rx bos (regexp (regexp-opt '("su" "sudo" "doas" "ksu"))) eos)
+ `(,(rx bos (| "su" "sudo" "doas" "ksu") eos)
nil ,tramp-root-id-string))
;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored.
;; Do not add "plink" based methods, they ask interactively for the user.
(add-to-list 'tramp-default-user-alist
`(,(rx bos
- (regexp
- (regexp-opt
- '("rcp" "remcp" "rsh" "telnet" "nc" "krlogin" "fcp")))
+ (| "rcp" "remcp" "rsh" "telnet" "nc" "krlogin" "fcp")
eos)
nil ,(user-login-name))))
(tramp-do-file-attributes-with-perl v localname))
(t (tramp-do-file-attributes-with-ls v localname)))))))
-(defconst tramp-sunos-unames (regexp-opt '("SunOS 5.10" "SunOS 5.11"))
+(defconst tramp-sunos-unames (rx (| "SunOS 5.10" "SunOS 5.11"))
"Regexp to determine remote SunOS.")
(defun tramp-sh--quoting-style-options (vec)
;; first.
(tramp-send-command
vec (format
- (eval-when-compile
- (concat
- "exec env TERM='%s' INSIDE_EMACS='%s' "
- "ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s -i"))
+ (concat
+ "exec env TERM='%s' INSIDE_EMACS='%s' "
+ "ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s -i")
tramp-terminal-type (tramp-inside-emacs)
(or (getenv-internal "ENV" tramp-remote-process-environment) "")
(if (stringp tramp-histfile-override)
default-shell
(tramp-message
vec 2
- (eval-when-compile
- (concat
- "Couldn't find a remote shell which groks tilde "
- "expansion, using `%s'"))
+ (concat
+ "Couldn't find a remote shell which groks tilde "
+ "expansion, using `%s'")
default-shell)))
default-shell)))
string
(and
(string-match
- (rx bol (+ (not (any " #"))) " " (+ (not space)) " "
+ (rx bol (+ (not (any space "#"))) space
+ (+ (not space)) space
(group (+ (not space))) eol)
string)
(match-string 1 string))
(while candidates
(goto-char (point-min))
(if (string-match-p
- (rx bol (literal (car candidates))"%s" (? "\r") eol)
+ (rx bol (literal (car candidates)) (? "\r") eol)
(buffer-string))
(setq locale (car candidates)
candidates nil)
"Regexp of SMB server identification.")
(defconst tramp-smb-prompt
- (rx bol (| (: (| "smb:" "PS") " " (+ nonl) "> ")
+ (rx bol (| (: (| "smb:" "PS") space (+ nonl) "> ")
(: (+ space) "Server"
(+ space) "Comment" eol)))
"Regexp used as prompt in smbclient or powershell.")
(defconst tramp-smb-wrong-passwd-regexp
- (regexp-opt
- '("NT_STATUS_LOGON_FAILURE"
- "NT_STATUS_WRONG_PASSWORD"))
+ (rx (| "NT_STATUS_LOGON_FAILURE"
+ "NT_STATUS_WRONG_PASSWORD"))
"Regexp for login error strings of SMB servers.")
(defconst tramp-smb-errors
"Call timed out: server did not respond"
(: (+ (not space)) ": command not found")
"Server doesn't support UNIX CIFS calls"
- (regexp (regexp-opt
- '(;; Samba.
- "ERRDOS"
- "ERRHRD"
- "ERRSRV"
- "ERRbadfile"
- "ERRbadpw"
- "ERRfilexists"
- "ERRnoaccess"
- "ERRnomem"
- "ERRnosuchshare"
- ;; See /usr/include/samba-4.0/core/ntstatus.h.
- ;; Windows 4.0 (Windows NT), Windows 5.0 (Windows 2000),
- ;; Windows 5.1 (Windows XP), Windows 5.2 (Windows Server 2003),
- ;; Windows 6.0 (Windows Vista), Windows 6.1 (Windows 7),
- ;; Windows 6.3 (Windows Server 2012, Windows 10).
- "NT_STATUS_ACCESS_DENIED"
- "NT_STATUS_ACCOUNT_LOCKED_OUT"
- "NT_STATUS_BAD_NETWORK_NAME"
- "NT_STATUS_CANNOT_DELETE"
- "NT_STATUS_CONNECTION_DISCONNECTED"
- "NT_STATUS_CONNECTION_REFUSED"
- "NT_STATUS_CONNECTION_RESET"
- "NT_STATUS_DIRECTORY_NOT_EMPTY"
- "NT_STATUS_DUPLICATE_NAME"
- "NT_STATUS_FILE_IS_A_DIRECTORY"
- "NT_STATUS_HOST_UNREACHABLE"
- "NT_STATUS_IMAGE_ALREADY_LOADED"
- "NT_STATUS_INVALID_LEVEL"
- "NT_STATUS_INVALID_PARAMETER"
- "NT_STATUS_INVALID_PARAMETER_MIX"
- "NT_STATUS_IO_TIMEOUT"
- "NT_STATUS_LOGON_FAILURE"
- "NT_STATUS_NETWORK_ACCESS_DENIED"
- "NT_STATUS_NOT_IMPLEMENTED"
- "NT_STATUS_NO_LOGON_SERVERS"
- "NT_STATUS_NO_SUCH_FILE"
- "NT_STATUS_NO_SUCH_USER"
- "NT_STATUS_NOT_A_DIRECTORY"
- "NT_STATUS_NOT_SUPPORTED"
- "NT_STATUS_OBJECT_NAME_COLLISION"
- "NT_STATUS_OBJECT_NAME_INVALID"
- "NT_STATUS_OBJECT_NAME_NOT_FOUND"
- "NT_STATUS_OBJECT_PATH_SYNTAX_BAD"
- "NT_STATUS_PASSWORD_MUST_CHANGE"
- "NT_STATUS_RESOURCE_NAME_NOT_FOUND"
- "NT_STATUS_REVISION_MISMATCH"
- "NT_STATUS_SHARING_VIOLATION"
- "NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE"
- "NT_STATUS_UNSUCCESSFUL"
- "NT_STATUS_WRONG_PASSWORD")))))
+ (| ;; Samba.
+ "ERRDOS"
+ "ERRHRD"
+ "ERRSRV"
+ "ERRbadfile"
+ "ERRbadpw"
+ "ERRfilexists"
+ "ERRnoaccess"
+ "ERRnomem"
+ "ERRnosuchshare"
+ ;; See /usr/include/samba-4.0/core/ntstatus.h.
+ ;; Windows 4.0 (Windows NT), Windows 5.0 (Windows 2000),
+ ;; Windows 5.1 (Windows XP), Windows 5.2 (Windows Server 2003),
+ ;; Windows 6.0 (Windows Vista), Windows 6.1 (Windows 7),
+ ;; Windows 6.3 (Windows Server 2012, Windows 10).
+ "NT_STATUS_ACCESS_DENIED"
+ "NT_STATUS_ACCOUNT_LOCKED_OUT"
+ "NT_STATUS_BAD_NETWORK_NAME"
+ "NT_STATUS_CANNOT_DELETE"
+ "NT_STATUS_CONNECTION_DISCONNECTED"
+ "NT_STATUS_CONNECTION_REFUSED"
+ "NT_STATUS_CONNECTION_RESET"
+ "NT_STATUS_DIRECTORY_NOT_EMPTY"
+ "NT_STATUS_DUPLICATE_NAME"
+ "NT_STATUS_FILE_IS_A_DIRECTORY"
+ "NT_STATUS_HOST_UNREACHABLE"
+ "NT_STATUS_IMAGE_ALREADY_LOADED"
+ "NT_STATUS_INVALID_LEVEL"
+ "NT_STATUS_INVALID_PARAMETER"
+ "NT_STATUS_INVALID_PARAMETER_MIX"
+ "NT_STATUS_IO_TIMEOUT"
+ "NT_STATUS_LOGON_FAILURE"
+ "NT_STATUS_NETWORK_ACCESS_DENIED"
+ "NT_STATUS_NOT_IMPLEMENTED"
+ "NT_STATUS_NO_LOGON_SERVERS"
+ "NT_STATUS_NO_SUCH_FILE"
+ "NT_STATUS_NO_SUCH_USER"
+ "NT_STATUS_NOT_A_DIRECTORY"
+ "NT_STATUS_NOT_SUPPORTED"
+ "NT_STATUS_OBJECT_NAME_COLLISION"
+ "NT_STATUS_OBJECT_NAME_INVALID"
+ "NT_STATUS_OBJECT_NAME_NOT_FOUND"
+ "NT_STATUS_OBJECT_PATH_SYNTAX_BAD"
+ "NT_STATUS_PASSWORD_MUST_CHANGE"
+ "NT_STATUS_RESOURCE_NAME_NOT_FOUND"
+ "NT_STATUS_REVISION_MISMATCH"
+ "NT_STATUS_SHARING_VIOLATION"
+ "NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE"
+ "NT_STATUS_UNSUCCESSFUL"
+ "NT_STATUS_WRONG_PASSWORD")))
"Regexp for possible error strings of SMB servers.
Used instead of analyzing error codes of commands.")
"")))
;; Sometimes we have discarded `substitute-in-file-name'.
- (when (string-match (rx (group "$$") (group (| "/" eol))) localname)
+ (when (string-match (rx (group "$$") (| "/" eol)) localname)
(setq localname (replace-match "$" nil nil localname 1)))
;; A trailing space is not supported.
- (when (string-match-p (rx " " eol) localname)
+ (when (string-match-p (rx space eol) localname)
(tramp-error
vec 'file-error
"Invalid file name %s" (tramp-make-tramp-file-name vec localname)))
(cl-return))
;; weekday.
- (if (string-match-p (rx (group (+ wordchar)) eol) line)
+ (if (string-match-p (rx (+ wordchar) eol) line)
(setq line (substring line 0 -5))
(cl-return))
;; localname.
(if (string-match
(rx bol (+ space)
- (group (not space) (? (group (* nonl) (not space))))
+ (group (not space) (? (* nonl) (not space)))
(* space) eol)
line)
(setq localname (match-string 1 line))
(defcustom tramp-restricted-shell-hosts-alist
(when (and (eq system-type 'windows-nt)
(not (string-match-p (rx "sh" eol) tramp-encoding-shell)))
- (list (rx bos (group (| (literal (downcase tramp-system-name))
- (literal (upcase tramp-system-name))))
+ (list (rx bos (| (literal (downcase tramp-system-name))
+ (literal (upcase tramp-system-name)))
eos)))
"List of hosts, which run a restricted shell.
This is a list of regular expressions, which denote hosts running
;;;###tramp-autoload
(defcustom tramp-local-host-regexp
(rx bos
- (regexp (regexp-opt
- `("localhost" "localhost4" "localhost6"
- ,tramp-system-name "127.0.0.1" "::1")))
+ (| (literal tramp-system-name)
+ (| "localhost" "localhost4" "localhost6" "127.0.0.1" "::1"))
eos)
"Host names which are regarded as local host.
If the local host runs a chrooted environment, set this to nil."
(defconst tramp-echoed-echo-mark-regexp
(rx-to-string
`(: ,tramp-echo-mark-marker
- (= ,tramp-echo-mark-marker-length (group "\b" (? " \b")))))
+ (= ,tramp-echo-mark-marker-length "\b" (? " \b"))))
"Regexp which matches `tramp-echo-mark' as it gets echoed by \
the remote shell.")
:type 'string)
(defcustom tramp-login-prompt-regexp
- (rx (* nonl) (group (| "user" "login")) (? (group " " (* nonl))) ":" (* " "))
+ (rx (* nonl) (| "user" "login") (? space (* nonl)) ":" (* space))
"Regexp matching login-like prompts.
The regexp should match at end of buffer.
:type 'string)
(defcustom tramp-terminal-prompt-regexp
- (rx (group
- (| (: "TERM = (" (* nonl) ")")
- (: "Terminal type? [" (* nonl) "]")))
+ (rx (| (: "TERM = (" (* nonl) ")")
+ (: "Terminal type? [" (* nonl) "]"))
(* space))
"Regular expression matching all terminal setting prompts.
The regexp should match at end of buffer.
;; "-no-antispoof". However, since we don't know which PuTTY
;; version is installed, we must react interactively.
(defcustom tramp-antispoof-regexp
- (rx (literal "Access granted. Press Return to begin session. "))
+ (rx "Access granted. Press Return to begin session. ")
"Regular expression matching plink's anti-spoofing message.
The regexp should match at end of buffer."
:version "27.1"
"Return `tramp-completion-file-name-regexp' according to `tramp-syntax'."
(if (eq tramp-syntax 'separate)
;; FIXME: This shouldn't be necessary.
- (rx bos "/" (? (group "[" (* (not (any "]"))))) eos)
+ (rx bos "/" (? "[" (* (not (any "]")))) eos)
(rx bos
;; `file-name-completion' uses absolute paths for matching.
;; This means that on W32 systems, something like
(defconst tramp-debug-outline-regexp
(rx ;; Timestamp.
- (+ digit) ":" (+ digit) ":" (+ digit) "." (+ digit) " "
+ (+ digit) ":" (+ digit) ":" (+ digit) "." (+ digit) space
;; Thread.
- (? (group "#<thread " (+ nonl) ">") " ")
+ (? (group "#<thread " (+ nonl) ">") space)
;; Function name, verbosity.
- (+ (any "-" alnum)) " (" (group (group (+ digit))) ") #")
+ (+ (any "-" alnum)) " (" (group (+ digit)) ") #")
"Used for highlighting Tramp debug buffers in `outline-mode'.")
(defconst tramp-debug-font-lock-keywords
#'file-name-sans-extension
(directory-files
dir nil (rx bos "tramp" (+ nonl) ".el" (? "c") eos)))))
- (files-regexp (rx bol (: (regexp (regexp-opt files))) eol)))
+ (files-regexp (rx bol (regexp (regexp-opt files)) eol)))
(mapatoms
(lambda (atom)
(when (and (functionp atom)
(defun tramp-completion-dissect-file-name (name)
"Return a list of `tramp-file-name' structures for NAME.
They are collected by `tramp-completion-dissect-file-name1'."
- (let* (;; "/method" "/[method"
- (tramp-completion-file-name-structure1
- (list
- (rx (regexp tramp-prefix-regexp)
- (group (? (regexp tramp-completion-method-regexp))) eol)
- 1 nil nil nil))
- ;; "/method:user" "/[method/user"
- (tramp-completion-file-name-structure2
- (list
- (rx (regexp tramp-prefix-regexp)
- (group (regexp tramp-method-regexp))
- (regexp tramp-postfix-method-regexp)
- (group (? (regexp tramp-user-regexp))) eol)
- 1 2 nil nil))
- ;; "/method:host" "/[method/host"
- (tramp-completion-file-name-structure3
- (list
- (rx (regexp tramp-prefix-regexp)
- (group (regexp tramp-method-regexp))
- (regexp tramp-postfix-method-regexp)
- (group (? (regexp tramp-host-regexp))) eol)
- 1 nil 2 nil))
- ;; "/method:[ipv6" "/[method/ipv6"
- (tramp-completion-file-name-structure4
- (list
- (rx (regexp tramp-prefix-regexp)
- (group (regexp tramp-method-regexp))
- (regexp tramp-postfix-method-regexp)
- (regexp tramp-prefix-ipv6-regexp)
- (group (? (regexp tramp-ipv6-regexp))) eol)
- 1 nil 2 nil))
- ;; "/method:user@host" "/[method/user@host"
- (tramp-completion-file-name-structure5
- (list
- (rx (regexp tramp-prefix-regexp)
- (group (regexp tramp-method-regexp))
- (regexp tramp-postfix-method-regexp)
- (group (regexp tramp-user-regexp))
- (regexp tramp-postfix-user-regexp)
- (group (? (regexp tramp-host-regexp))) eol)
- 1 2 3 nil))
- ;; "/method:user@[ipv6" "/[method/user@ipv6"
- (tramp-completion-file-name-structure6
- (list
- (rx (regexp tramp-prefix-regexp)
- (group (regexp tramp-method-regexp))
- (regexp tramp-postfix-method-regexp)
- (group (regexp tramp-user-regexp))
- (regexp tramp-postfix-user-regexp)
- (regexp tramp-prefix-ipv6-regexp)
- (group (? (regexp tramp-ipv6-regexp))) eol)
- 1 2 3 nil)))
+ (let (;; "/method" "/[method"
+ (tramp-completion-file-name-structure1
+ (list
+ (rx (regexp tramp-prefix-regexp)
+ (group (? (regexp tramp-completion-method-regexp))) eol)
+ 1 nil nil nil))
+ ;; "/method:user" "/[method/user"
+ (tramp-completion-file-name-structure2
+ (list
+ (rx (regexp tramp-prefix-regexp)
+ (group (regexp tramp-method-regexp))
+ (regexp tramp-postfix-method-regexp)
+ (group (? (regexp tramp-user-regexp))) eol)
+ 1 2 nil nil))
+ ;; "/method:host" "/[method/host"
+ (tramp-completion-file-name-structure3
+ (list
+ (rx (regexp tramp-prefix-regexp)
+ (group (regexp tramp-method-regexp))
+ (regexp tramp-postfix-method-regexp)
+ (group (? (regexp tramp-host-regexp))) eol)
+ 1 nil 2 nil))
+ ;; "/method:[ipv6" "/[method/ipv6"
+ (tramp-completion-file-name-structure4
+ (list
+ (rx (regexp tramp-prefix-regexp)
+ (group (regexp tramp-method-regexp))
+ (regexp tramp-postfix-method-regexp)
+ (regexp tramp-prefix-ipv6-regexp)
+ (group (? (regexp tramp-ipv6-regexp))) eol)
+ 1 nil 2 nil))
+ ;; "/method:user@host" "/[method/user@host"
+ (tramp-completion-file-name-structure5
+ (list
+ (rx (regexp tramp-prefix-regexp)
+ (group (regexp tramp-method-regexp))
+ (regexp tramp-postfix-method-regexp)
+ (group (regexp tramp-user-regexp))
+ (regexp tramp-postfix-user-regexp)
+ (group (? (regexp tramp-host-regexp))) eol)
+ 1 2 3 nil))
+ ;; "/method:user@[ipv6" "/[method/user@ipv6"
+ (tramp-completion-file-name-structure6
+ (list
+ (rx (regexp tramp-prefix-regexp)
+ (group (regexp tramp-method-regexp))
+ (regexp tramp-postfix-method-regexp)
+ (group (regexp tramp-user-regexp))
+ (regexp tramp-postfix-user-regexp)
+ (regexp tramp-prefix-ipv6-regexp)
+ (group (? (regexp tramp-ipv6-regexp))) eol)
+ 1 2 3 nil)))
(delq
nil
(mapcar
registry-or-dirname (rx bol (group (regexp tramp-host-regexp)) eol))))
(defun tramp-parse-putty-group (registry)
- "Return a (user host) tuple allowed to access.
+ "Return a (user host) tuple allowed to access.
User is always nil."
- (let (result
- (regexp (rx (literal registry) "\\" (group (+ nonl)))))
- (when (re-search-forward regexp (line-end-position) t)
- (setq result (list nil (match-string 1))))
- (forward-line 1)
- result))
+ (let (result
+ (regexp (rx (literal registry) "\\" (group (+ nonl)))))
+ (when (re-search-forward regexp (line-end-position) t)
+ (setq result (list nil (match-string 1))))
+ (forward-line 1)
+ result))
;;; Skeleton macros for file name handler functions.
(not (with-tramp-connection-property
(tramp-get-process v) "unsafe-temporary-file"
(yes-or-no-p
- (eval-when-compile
- (concat
- "Backup file on local temporary directory, "
- "do you want to continue?"))))))
+ (concat
+ "Backup file on local temporary directory, "
+ "do you want to continue?")))))
(tramp-error v 'file-error "Unsafe backup file name"))))))
(defun tramp-handle-insert-directory
(rx bos (group (+ nonl))
"@" (group (+ nonl))
"." (group (+ digit))
- (? ":" (group (+ digit))) eos)
+ (? ":" (+ digit)) eos)
"The format of a lock file.")
(defun tramp-handle-file-locked-p (file)
(not (with-tramp-connection-property
(tramp-get-process v) "unsafe-temporary-file"
(yes-or-no-p
- (eval-when-compile
- (concat
- "Lock file on local temporary directory, "
- "do you want to continue?"))))))
+ (concat
+ "Lock file on local temporary directory, "
+ "do you want to continue?")))))
(tramp-error v 'file-error "Unsafe lock file name")))
;; Do the lock.
(not (with-tramp-connection-property
(tramp-get-process v) "unsafe-temporary-file"
(yes-or-no-p
- (eval-when-compile
- (concat
- "Autosave file on local temporary directory, "
- "do you want to continue?"))))))
+ (concat
+ "Autosave file on local temporary directory, "
+ "do you want to continue?")))))
(tramp-error v 'file-error "Unsafe autosave file name"))))))
(defun tramp-subst-strs-in-string (alist string)
Only works for Bourne-like shells."
(let ((system-type 'not-windows))
(save-match-data
- (let ((result (tramp-unquote-shell-quote-argument s))
- (nl (regexp-quote (format "\\%s" tramp-rsh-end-of-line))))
+ (let ((result (tramp-unquote-shell-quote-argument s)))
(when (and (>= (length result) 2)
(string= (substring result 0 2) "\\~"))
(setq result (substring result 1)))
- (while (string-match nl result)
- (setq result (replace-match (format "'%s'" tramp-rsh-end-of-line)
- t t result)))
- result))))
+ (replace-regexp-in-string
+ (rx "\\" (literal tramp-rsh-end-of-line))
+ (format "'%s'" tramp-rsh-end-of-line) result)))))
;;; Signal handling. This works for remote processes, which have set
;;; the process property `remote-pid'.
(goto-char (point-min))
(should
(looking-at-p
- (rx bol (+ nonl) " " (literal tramp-archive-test-archive) eol))))
+ (rx bol (+ nonl) space (literal tramp-archive-test-archive) eol))))
(with-temp-buffer
(insert-directory
(file-name-as-directory tramp-archive-test-archive)
(rx-to-string
`(:
;; There might be a summary line.
- (? "total" (+ nonl) (+ digit) (? " ")
+ (? "total" (+ nonl) (+ digit) (? space)
(? (any "EGKMPTYZk")) (? "i") (? "B") "\n")
;; We don't know in which order the files appear.
(= ,(length (directory-files tramp-archive-test-archive))
- (+ nonl) " "
+ (+ nonl) space
(regexp
,(regexp-opt (directory-files tramp-archive-test-archive)))
- (? " ->" (one-or-more nonl)) "\n"))))))
+ (? " ->" (+ nonl)) "\n"))))))
;; Check error case.
(with-temp-buffer
(should-error
(insert-directory tmp-name1 "-al")
(goto-char (point-min))
(should
- (looking-at-p (rx bol (+ nonl) " " (literal tmp-name1) eol))))
+ (looking-at-p (rx bol (+ nonl) space (literal tmp-name1) eol))))
(with-temp-buffer
(insert-directory (file-name-as-directory tmp-name1) "-al")
(goto-char (point-min))
(should
(looking-at-p
- (rx bol (+ nonl) " " (literal tmp-name1) "/" eol))))
+ (rx bol (+ nonl) space (literal tmp-name1) "/" eol))))
(with-temp-buffer
(insert-directory
(file-name-as-directory tmp-name1) "-al" nil 'full-directory-p)
(rx-to-string
`(:
;; There might be a summary line.
- (? "total" (+ nonl) (+ digit) (? " ")
+ (? "total" (+ nonl) (+ digit) (? space)
(? (any "EGKMPTYZk")) (? "i") (? "B") "\n")
;; We don't know in which order ".", ".." and "foo" appear.
(= ,(length (directory-files tmp-name1))
- (+ nonl) " "
+ (+ nonl) space
(regexp ,(regexp-opt (directory-files tmp-name1)))
(? " ->" (+ nonl)) "\n"))))))
"Check, whether the method needs a share."
(and (tramp--test-gvfs-p)
(string-match-p
- (rx bol (or "afp" (: "dav" (opt "s")) "smb") eol)
+ (rx bol (| "afp" (: "dav" (? "s")) "smb") eol)
(file-remote-p ert-remote-temporary-file-directory 'method))))
(defun tramp--test-sshfs-p ()