mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Tramp code cleanup
* lisp/net/tramp.el (tramp-shell-prompt-pattern) (tramp-wrong-passwd-regexp, tramp-method-regexp-alist) (tramp-domain-regexp, tramp-host-regexp, tramp-ipv6-regexp) (tramp-port-regexp, tramp-debug-outline-regexp) (tramp-drop-volume-letter, tramp-parse-shostkeys) (tramp-handle-file-name-case-insensitive-p): * lisp/net/tramp-adb.el (tramp-adb-send-command-and-check): * lisp/net/tramp-ftp.el (tramp-ftp-enable-ange-ftp): * lisp/net/tramp-gvfs.el (tramp-gvfs-monitor-process-filter): * lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp) (tramp-device-escape-sequence-regexp): * lisp/net/tramp-smb.el (tramp-smb-do-file-attributes-with-stat) (tramp-smb-handle-set-file-acl, tramp-smb-read-file-entry): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-selinux-context): Use character classes in regexp. * lisp/net/tramp-adb.el (tramp-adb-ls-date-year-regexp) (tramp-adb-ls-date-time-regexp): New defconst. (tramp-adb-ls-date-regexp, tramp-adb-ls-toolbox-regexp) (tramp-adb-sh-fix-ls-output): Use them. (tramp-adb-handle-set-file-times, tramp-adb-maybe-open-connection): Apply `eval-when-compile' on constant concat data. (tramp-do-parse-file-attributes-with-ls): Suppress `signal-hook-function'. (tramp-adb--gnu-switches-to-ash): Remove unused function. (tramp-adb-handle-set-file-modes): Qhote argument. (tramp-adb-maybe-open-connection): Set file property rather than flush. * lisp/net/tramp-cmds.el (tramp-rename-these-files): Apply `eval-when-compile' on constant concat data. * lisp/net/tramp-gvfs.el (tramp-gvfs-file-attributes) (tramp-gvfs-file-attributes-with-gvfs-ls-regexp): Embed them in `eval-and-compile'. (tramp-gvfs-get-directory-attributes): Apply `eval-when-compile' on constant concat data.
This commit is contained in:
parent
62725e87f2
commit
7caf570662
8 changed files with 153 additions and 109 deletions
|
|
@ -875,23 +875,34 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
|
|||
(while (not (eobp))
|
||||
(cond
|
||||
((looking-at
|
||||
"Size:\\s-+\\([0-9]+\\)\\s-+Blocks:\\s-+[0-9]+\\s-+\\(\\w+\\)")
|
||||
(eval-when-compile
|
||||
(concat
|
||||
"Size:\\s-+\\([[:digit:]]+\\)\\s-+"
|
||||
"Blocks:\\s-+[[:digit:]]+\\s-+\\(\\w+\\)")))
|
||||
(setq size (string-to-number (match-string 1))
|
||||
id (if (string-equal "directory" (match-string 2)) t
|
||||
(if (string-equal "symbolic" (match-string 2)) ""))))
|
||||
((looking-at
|
||||
"Inode:\\s-+\\([0-9]+\\)\\s-+Links:\\s-+\\([0-9]+\\)")
|
||||
"Inode:\\s-+\\([[:digit:]]+\\)\\s-+Links:\\s-+\\([[:digit:]]+\\)")
|
||||
(setq inode (string-to-number (match-string 1))
|
||||
link (string-to-number (match-string 2))))
|
||||
((looking-at
|
||||
"Access:\\s-+([0-9]+/\\(\\S-+\\))\\s-+Uid:\\s-+\\([0-9]+\\)\\s-+Gid:\\s-+\\([0-9]+\\)")
|
||||
(eval-when-compile
|
||||
(concat
|
||||
"Access:\\s-+([[:digit:]]+/\\(\\S-+\\))\\s-+"
|
||||
"Uid:\\s-+\\([[:digit:]]+\\)\\s-+"
|
||||
"Gid:\\s-+\\([[:digit:]]+\\)")))
|
||||
(setq mode (match-string 1)
|
||||
uid (if (equal id-format 'string) (match-string 2)
|
||||
(string-to-number (match-string 2)))
|
||||
gid (if (equal id-format 'string) (match-string 3)
|
||||
(string-to-number (match-string 3)))))
|
||||
((looking-at
|
||||
"Access:\\s-+\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)\\s-+\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)")
|
||||
(eval-when-compile
|
||||
(concat
|
||||
"Access:\\s-+"
|
||||
"\\([[:digit:]]+\\)-\\([[:digit:]]+\\)-\\([[:digit:]]+\\)\\s-+"
|
||||
"\\([[:digit:]]+\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\)")))
|
||||
(setq atime
|
||||
(encode-time
|
||||
(string-to-number (match-string 6)) ;; sec
|
||||
|
|
@ -901,7 +912,11 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
|
|||
(string-to-number (match-string 2)) ;; month
|
||||
(string-to-number (match-string 1))))) ;; year
|
||||
((looking-at
|
||||
"Modify:\\s-+\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)\\s-+\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)")
|
||||
(eval-when-compile
|
||||
(concat
|
||||
"Modify:\\s-+"
|
||||
"\\([[:digit:]]+\\)-\\([[:digit:]]+\\)-\\([[:digit:]]+\\)\\s-+"
|
||||
"\\([[:digit:]]+\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\)")))
|
||||
(setq mtime
|
||||
(encode-time
|
||||
(string-to-number (match-string 6)) ;; sec
|
||||
|
|
@ -911,7 +926,11 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
|
|||
(string-to-number (match-string 2)) ;; month
|
||||
(string-to-number (match-string 1))))) ;; year
|
||||
((looking-at
|
||||
"Change:\\s-+\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)\\s-+\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)")
|
||||
(eval-when-compile
|
||||
(concat
|
||||
"Change:\\s-+"
|
||||
"\\([[:digit:]]+\\)-\\([[:digit:]]+\\)-\\([[:digit:]]+\\)\\s-+"
|
||||
"\\([[:digit:]]+\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\)")))
|
||||
(setq ctime
|
||||
(encode-time
|
||||
(string-to-number (match-string 6)) ;; sec
|
||||
|
|
@ -1474,7 +1493,7 @@ component is used as the target of the symlink."
|
|||
;; This is meant for traces, and returning from the
|
||||
;; function. No error is propagated outside, due to
|
||||
;; the `ignore-errors' closure.
|
||||
(unless (tramp-search-regexp "tramp_exit_status [0-9]+")
|
||||
(unless (tramp-search-regexp "tramp_exit_status [[:digit:]]+")
|
||||
(tramp-error
|
||||
v 'file-error
|
||||
"Couldn't find exit status of `%s'" tramp-smb-acl-program))
|
||||
|
|
@ -1719,21 +1738,21 @@ Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)."
|
|||
;; Entries provided by smbclient DIR aren't fully regular.
|
||||
;; They should have the format
|
||||
;;
|
||||
;; \s-\{2,2} - leading spaces
|
||||
;; \s-\{2,2\} - leading spaces
|
||||
;; \S-\(.*\S-\)\s-* - file name, 30 chars, left bound
|
||||
;; \s-+[ADHRSV]* - permissions, 7 chars, right bound
|
||||
;; \s- - space delimiter
|
||||
;; \s-+[0-9]+ - size, 8 chars, right bound
|
||||
;; \s-+[[:digit:]]+ - size, 8 chars, right bound
|
||||
;; \s-\{2,2\} - space delimiter
|
||||
;; \w\{3,3\} - weekday
|
||||
;; \s- - space delimiter
|
||||
;; \w\{3,3\} - month
|
||||
;; \s- - space delimiter
|
||||
;; [ 12][0-9] - day
|
||||
;; [ 12][[:digit:]] - day
|
||||
;; \s- - space delimiter
|
||||
;; [0-9]\{2,2\}:[0-9]\{2,2\}:[0-9]\{2,2\} - time
|
||||
;; [[:digit:]]\{2,2\}:[[:digit:]]\{2,2\}:[[:digit:]]\{2,2\} - time
|
||||
;; \s- - space delimiter
|
||||
;; [0-9]\{4,4\} - year
|
||||
;; [[:digit:]]\{4,4\} - year
|
||||
;;
|
||||
;; samba/src/client.c (http://samba.org/doxygen/samba/client_8c-source.html)
|
||||
;; has function display_finfo:
|
||||
|
|
@ -1781,13 +1800,14 @@ are listed. Result is the list (LOCALNAME MODE SIZE MTIME)."
|
|||
(cl-block nil
|
||||
|
||||
;; year.
|
||||
(if (string-match "\\([0-9]+\\)$" line)
|
||||
(if (string-match "\\([[:digit:]]+\\)$" line)
|
||||
(setq year (string-to-number (match-string 1 line))
|
||||
line (substring line 0 -5))
|
||||
(cl-return))
|
||||
|
||||
;; time.
|
||||
(if (string-match "\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)$" line)
|
||||
(if (string-match
|
||||
"\\([[:digit:]]+\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\)$" line)
|
||||
(setq hour (string-to-number (match-string 1 line))
|
||||
min (string-to-number (match-string 2 line))
|
||||
sec (string-to-number (match-string 3 line))
|
||||
|
|
@ -1795,7 +1815,7 @@ are listed. Result is the list (LOCALNAME MODE SIZE MTIME)."
|
|||
(cl-return))
|
||||
|
||||
;; day.
|
||||
(if (string-match "\\([0-9]+\\)$" line)
|
||||
(if (string-match "\\([[:digit:]]+\\)$" line)
|
||||
(setq day (string-to-number (match-string 1 line))
|
||||
line (substring line 0 -3))
|
||||
(cl-return))
|
||||
|
|
@ -1812,7 +1832,7 @@ are listed. Result is the list (LOCALNAME MODE SIZE MTIME)."
|
|||
(cl-return))
|
||||
|
||||
;; size.
|
||||
(if (string-match "\\([0-9]+\\)$" line)
|
||||
(if (string-match "\\([[:digit:]]+\\)$" line)
|
||||
(let ((length (- (max 10 (1+ (length (match-string 1 line)))))))
|
||||
(setq size (string-to-number (match-string 1 line)))
|
||||
(when (string-match
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue