aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-12-25 14:35:19 +0000
committerRichard M. Stallman1994-12-25 14:35:19 +0000
commit65135ec2206ecd7982ab8bcecbcfe07e8378b027 (patch)
tree4988d58c4d825d501d512b9c5a8f2720f3da15b9
parent6492fcd1f96f70ccec26b00e925a8e08e3fc0f5d (diff)
downloademacs-65135ec2206ecd7982ab8bcecbcfe07e8378b027.tar.gz
emacs-65135ec2206ecd7982ab8bcecbcfe07e8378b027.zip
(ange-ftp-save-match-data): Macro deleted.
Most callers use save-match-data. (ange-ftp-process-filter, ange-ftp-process-sentinel) (ange-ftp-gwp-filter): Don't save the match data explicitly. (ange-ftp-process-filter, ange-ftp-gwp-filter): After comint output processing, update STR.
-rw-r--r--lisp/ange-ftp.el153
1 files changed, 69 insertions, 84 deletions
diff --git a/lisp/ange-ftp.el b/lisp/ange-ftp.el
index 665aecbaf10..b756c055736 100644
--- a/lisp/ange-ftp.el
+++ b/lisp/ange-ftp.el
@@ -919,24 +919,6 @@ SIZE, if supplied, should be a prime number."
919;; (put 'ftp-error 'error-message "FTP error") 919;; (put 'ftp-error 'error-message "FTP error")
920 920
921;;; ------------------------------------------------------------ 921;;; ------------------------------------------------------------
922;;; Match-data support (stolen from Kyle I think)
923;;; ------------------------------------------------------------
924
925(defmacro ange-ftp-save-match-data (&rest body)
926 "Execute the BODY forms, restoring the global value of the match data.
927Also makes matching case-sensitive within BODY."
928 (let ((original (make-symbol "match-data"))
929 case-fold-search)
930 (list
931 'let (list (list original '(match-data)))
932 (list 'unwind-protect
933 (cons 'progn body)
934 (list 'store-match-data original)))))
935
936(put 'ange-ftp-save-match-data 'lisp-indent-hook 0)
937(put 'ange-ftp-save-match-data 'edebug-form-hook '(&rest form))
938
939;;; ------------------------------------------------------------
940;;; Enhanced message support. 922;;; Enhanced message support.
941;;; ------------------------------------------------------------ 923;;; ------------------------------------------------------------
942 924
@@ -953,7 +935,7 @@ Args are as in `message': a format string, plus arguments to be formatted."
953 "Abbreviate the file name FILE relative to the default-directory. 935 "Abbreviate the file name FILE relative to the default-directory.
954If the optional parameter NEW is given and the non-directory parts match, 936If the optional parameter NEW is given and the non-directory parts match,
955only return the directory part of FILE." 937only return the directory part of FILE."
956 (ange-ftp-save-match-data 938 (save-match-data
957 (if (and default-directory 939 (if (and default-directory
958 (string-match (concat "^" 940 (string-match (concat "^"
959 (regexp-quote default-directory) 941 (regexp-quote default-directory)
@@ -1046,7 +1028,7 @@ Optional DEFAULT is password to start with."
1046 (if (ange-ftp-lookup-passwd host user) 1028 (if (ange-ftp-lookup-passwd host user)
1047 (throw 'found-one host)))) 1029 (throw 'found-one host))))
1048 ange-ftp-user-hashtable) 1030 ange-ftp-user-hashtable)
1049 (ange-ftp-save-match-data 1031 (save-match-data
1050 (ange-ftp-map-hashtable 1032 (ange-ftp-map-hashtable
1051 (function 1033 (function
1052 (lambda (key value) 1034 (lambda (key value)
@@ -1219,7 +1201,7 @@ Optional DEFAULT is password to start with."
1219 (attr (ange-ftp-real-file-attributes file))) 1201 (attr (ange-ftp-real-file-attributes file)))
1220 (if (and attr ; file exists. 1202 (if (and attr ; file exists.
1221 (not (equal (nth 5 attr) ange-ftp-netrc-modtime))) ; file changed 1203 (not (equal (nth 5 attr) ange-ftp-netrc-modtime))) ; file changed
1222 (ange-ftp-save-match-data 1204 (save-match-data
1223 (if (or ange-ftp-disable-netrc-security-check 1205 (if (or ange-ftp-disable-netrc-security-check
1224 (and (eq (nth 2 attr) (user-uid)) ; Same uids. 1206 (and (eq (nth 2 attr) (user-uid)) ; Same uids.
1225 (string-match ".r..------" (nth 8 attr)))) 1207 (string-match ".r..------" (nth 8 attr))))
@@ -1250,7 +1232,7 @@ Optional DEFAULT is password to start with."
1250 1232
1251(defun ange-ftp-generate-root-prefixes () 1233(defun ange-ftp-generate-root-prefixes ()
1252 (ange-ftp-parse-netrc) 1234 (ange-ftp-parse-netrc)
1253 (ange-ftp-save-match-data 1235 (save-match-data
1254 (let (res) 1236 (let (res)
1255 (ange-ftp-map-hashtable 1237 (ange-ftp-map-hashtable
1256 (function 1238 (function
@@ -1288,7 +1270,7 @@ Optional DEFAULT is password to start with."
1288 ange-ftp-ftp-name-res 1270 ange-ftp-ftp-name-res
1289 (setq ange-ftp-ftp-name-arg name 1271 (setq ange-ftp-ftp-name-arg name
1290 ange-ftp-ftp-name-res 1272 ange-ftp-ftp-name-res
1291 (ange-ftp-save-match-data 1273 (save-match-data
1292 (if (string-match (car ange-ftp-name-format) name) 1274 (if (string-match (car ange-ftp-name-format) name)
1293 (let* ((ns (cdr ange-ftp-name-format)) 1275 (let* ((ns (cdr ange-ftp-name-format))
1294 (host (ange-ftp-ftp-name-component 0 ns name)) 1276 (host (ange-ftp-ftp-name-component 0 ns name))
@@ -1302,7 +1284,7 @@ Optional DEFAULT is password to start with."
1302;; Take a FULLNAME that matches according to ange-ftp-name-format and 1284;; Take a FULLNAME that matches according to ange-ftp-name-format and
1303;; replace the name component with NAME. 1285;; replace the name component with NAME.
1304(defun ange-ftp-replace-name-component (fullname name) 1286(defun ange-ftp-replace-name-component (fullname name)
1305 (ange-ftp-save-match-data 1287 (save-match-data
1306 (if (string-match (car ange-ftp-name-format) fullname) 1288 (if (string-match (car ange-ftp-name-format) fullname)
1307 (let* ((ns (cdr ange-ftp-name-format)) 1289 (let* ((ns (cdr ange-ftp-name-format))
1308 (elt (nth 2 ns))) 1290 (elt (nth 2 ns)))
@@ -1478,7 +1460,7 @@ good, skip, fatal, or unknown."
1478 ;; see if the buffer is still around... it could have been deleted. 1460 ;; see if the buffer is still around... it could have been deleted.
1479 (if (buffer-name buffer) 1461 (if (buffer-name buffer)
1480 (unwind-protect 1462 (unwind-protect
1481 (ange-ftp-save-match-data 1463 (progn
1482 (set-buffer (process-buffer proc)) 1464 (set-buffer (process-buffer proc))
1483 1465
1484 ;; handle hash mark printing 1466 ;; handle hash mark printing
@@ -1487,6 +1469,9 @@ good, skip, fatal, or unknown."
1487 (string-match "^#+$" str) 1469 (string-match "^#+$" str)
1488 (setq str (ange-ftp-process-handle-hash str))) 1470 (setq str (ange-ftp-process-handle-hash str)))
1489 (comint-output-filter proc str) 1471 (comint-output-filter proc str)
1472 ;; Replace STR by the result of the comint processing.
1473 (setq str (buffer-substring comint-last-output-start
1474 (process-mark proc)))
1490 (if ange-ftp-process-busy 1475 (if ange-ftp-process-busy
1491 (progn 1476 (progn
1492 (setq ange-ftp-process-string (concat ange-ftp-process-string 1477 (setq ange-ftp-process-string (concat ange-ftp-process-string
@@ -1535,13 +1520,12 @@ good, skip, fatal, or unknown."
1535 1520
1536(defun ange-ftp-process-sentinel (proc str) 1521(defun ange-ftp-process-sentinel (proc str)
1537 "When ftp process changes state, nuke all file-entries in cache." 1522 "When ftp process changes state, nuke all file-entries in cache."
1538 (ange-ftp-save-match-data 1523 (let ((name (process-name proc)))
1539 (let ((name (process-name proc))) 1524 (if (string-match "\\*ftp \\([^@]+\\)@\\([^*]+\\)*" name)
1540 (if (string-match "\\*ftp \\([^@]+\\)@\\([^*]+\\)*" name) 1525 (let ((user (substring name (match-beginning 1) (match-end 1)))
1541 (let ((user (substring name (match-beginning 1) (match-end 1))) 1526 (host (substring name (match-beginning 2) (match-end 2))))
1542 (host (substring name (match-beginning 2) (match-end 2)))) 1527 (ange-ftp-wipe-file-entries host user))))
1543 (ange-ftp-wipe-file-entries host user)))) 1528 (setq ange-ftp-ls-cache-file nil))
1544 (setq ange-ftp-ls-cache-file nil)))
1545 1529
1546;;;; ------------------------------------------------------------ 1530;;;; ------------------------------------------------------------
1547;;;; Gateway support. 1531;;;; Gateway support.
@@ -1552,13 +1536,13 @@ good, skip, fatal, or unknown."
1552 ;; yes, I know that I could simplify the following expression, but it is 1536 ;; yes, I know that I could simplify the following expression, but it is
1553 ;; clearer (to me at least) this way. 1537 ;; clearer (to me at least) this way.
1554 (and (not ange-ftp-smart-gateway) 1538 (and (not ange-ftp-smart-gateway)
1555 (ange-ftp-save-match-data 1539 (save-match-data
1556 (not (string-match ange-ftp-local-host-regexp host))))) 1540 (not (string-match ange-ftp-local-host-regexp host)))))
1557 1541
1558(defun ange-ftp-use-smart-gateway-p (host) 1542(defun ange-ftp-use-smart-gateway-p (host)
1559 "Returns whether to access this host via a smart gateway." 1543 "Returns whether to access this host via a smart gateway."
1560 (and ange-ftp-smart-gateway 1544 (and ange-ftp-smart-gateway
1561 (ange-ftp-save-match-data 1545 (save-match-data
1562 (not (string-match ange-ftp-local-host-regexp host))))) 1546 (not (string-match ange-ftp-local-host-regexp host)))))
1563 1547
1564 1548
@@ -1615,27 +1599,28 @@ good, skip, fatal, or unknown."
1615 (setq ange-ftp-gwp-running nil)) 1599 (setq ange-ftp-gwp-running nil))
1616 1600
1617(defun ange-ftp-gwp-filter (proc str) 1601(defun ange-ftp-gwp-filter (proc str)
1618 (ange-ftp-save-match-data 1602 (comint-output-filter proc str)
1619 (comint-output-filter proc str) 1603 ;; Replace STR by the result of the comint processing.
1620 (cond ((string-match "login: *$" str) 1604 (setq str (buffer-substring comint-last-output-start (process-mark proc)))
1621 (send-string proc 1605 (cond ((string-match "login: *$" str)
1622 (concat 1606 (send-string proc
1623 (let ((ange-ftp-default-user t)) 1607 (concat
1624 (ange-ftp-get-user ange-ftp-gateway-host)) 1608 (let ((ange-ftp-default-user t))
1625 "\n"))) 1609 (ange-ftp-get-user ange-ftp-gateway-host))
1626 ((string-match "Password: *$" str) 1610 "\n")))
1627 (send-string proc 1611 ((string-match "Password: *$" str)
1628 (concat 1612 (send-string proc
1629 (ange-ftp-get-passwd ange-ftp-gateway-host 1613 (concat
1630 (ange-ftp-get-user 1614 (ange-ftp-get-passwd ange-ftp-gateway-host
1631 ange-ftp-gateway-host)) 1615 (ange-ftp-get-user
1632 "\n"))) 1616 ange-ftp-gateway-host))
1633 ((string-match ange-ftp-gateway-fatal-msgs str) 1617 "\n")))
1634 (delete-process proc) 1618 ((string-match ange-ftp-gateway-fatal-msgs str)
1635 (setq ange-ftp-gwp-running nil)) 1619 (delete-process proc)
1636 ((string-match ange-ftp-gateway-prompt-pattern str) 1620 (setq ange-ftp-gwp-running nil))
1637 (setq ange-ftp-gwp-running nil 1621 ((string-match ange-ftp-gateway-prompt-pattern str)
1638 ange-ftp-gwp-status t))))) 1622 (setq ange-ftp-gwp-running nil
1623 ange-ftp-gwp-status t))))
1639 1624
1640(defun ange-ftp-gwp-start (host user name args) 1625(defun ange-ftp-gwp-start (host user name args)
1641 "Login to the gateway machine and fire up an ftp process." 1626 "Login to the gateway machine and fire up an ftp process."
@@ -1716,7 +1701,7 @@ been queued with no result. CONT will still be called, however."
1716 (goto-char (point-max)) 1701 (goto-char (point-max))
1717 (move-marker comint-last-input-start (point)) 1702 (move-marker comint-last-input-start (point))
1718 ;; don't insert the password into the buffer on the USER command. 1703 ;; don't insert the password into the buffer on the USER command.
1719 (ange-ftp-save-match-data 1704 (save-match-data
1720 (if (string-match "^user \"[^\"]*\"" cmd) 1705 (if (string-match "^user \"[^\"]*\"" cmd)
1721 (insert (substring cmd 0 (match-end 0)) " Turtle Power!\n") 1706 (insert (substring cmd 0 (match-end 0)) " Turtle Power!\n")
1722 (insert cmd))) 1707 (insert cmd)))
@@ -1907,7 +1892,7 @@ PROC is the process to the FTP-client."
1907 (let* ((status (ange-ftp-raw-send-cmd proc "hash")) 1892 (let* ((status (ange-ftp-raw-send-cmd proc "hash"))
1908 (result (car status)) 1893 (result (car status))
1909 (line (cdr status))) 1894 (line (cdr status)))
1910 (ange-ftp-save-match-data 1895 (save-match-data
1911 (if (string-match ange-ftp-hash-mark-msgs line) 1896 (if (string-match ange-ftp-hash-mark-msgs line)
1912 (let ((size (string-to-int 1897 (let ((size (string-to-int
1913 (substring line 1898 (substring line
@@ -2138,7 +2123,7 @@ Works by doing a pwd and examining the directory syntax."
2138 (key (concat host "/" user "/~"))) 2123 (key (concat host "/" user "/~")))
2139 (if (eq host-type 'unix) 2124 (if (eq host-type 'unix)
2140 ;; Note that ange-ftp-host-type returns unix as the default value. 2125 ;; Note that ange-ftp-host-type returns unix as the default value.
2141 (ange-ftp-save-match-data 2126 (save-match-data
2142 (let* ((result (ange-ftp-get-pwd host user)) 2127 (let* ((result (ange-ftp-get-pwd host user))
2143 (dir (car result)) 2128 (dir (car result))
2144 fix-name-func) 2129 fix-name-func)
@@ -2214,7 +2199,7 @@ Works by doing a pwd and examining the directory syntax."
2214;; to take switch arguments. 2199;; to take switch arguments.
2215(defun ange-ftp-dumb-unix-host (host) 2200(defun ange-ftp-dumb-unix-host (host)
2216 (and ange-ftp-dumb-unix-host-regexp 2201 (and ange-ftp-dumb-unix-host-regexp
2217 (ange-ftp-save-match-data 2202 (save-match-data
2218 (string-match ange-ftp-dumb-unix-host-regexp host)))) 2203 (string-match ange-ftp-dumb-unix-host-regexp host))))
2219 2204
2220(defun ange-ftp-add-dumb-unix-host (host) 2205(defun ange-ftp-add-dumb-unix-host (host)
@@ -2486,7 +2471,7 @@ match subdirectories as well.")
2486;; a listing, then return nil. 2471;; a listing, then return nil.
2487 2472
2488(defun ange-ftp-parse-dired-listing (&optional switches) 2473(defun ange-ftp-parse-dired-listing (&optional switches)
2489 (ange-ftp-save-match-data 2474 (save-match-data
2490 (cond 2475 (cond
2491 ((looking-at "^total [0-9]+$") 2476 ((looking-at "^total [0-9]+$")
2492 (forward-line 1) 2477 (forward-line 1)
@@ -2526,7 +2511,7 @@ This will give an error or return nil, depending on the value of
2526NO-ERROR, if a listing for DIRECTORY cannot be obtained." 2511NO-ERROR, if a listing for DIRECTORY cannot be obtained."
2527 (setq directory (file-name-as-directory directory)) ;normalize 2512 (setq directory (file-name-as-directory directory)) ;normalize
2528 (or (ange-ftp-get-hash-entry directory ange-ftp-files-hashtable) 2513 (or (ange-ftp-get-hash-entry directory ange-ftp-files-hashtable)
2529 (ange-ftp-save-match-data 2514 (save-match-data
2530 (and (ange-ftp-ls directory 2515 (and (ange-ftp-ls directory
2531 ;; This is an efficiency hack. We try to 2516 ;; This is an efficiency hack. We try to
2532 ;; anticipate what sort of listing dired 2517 ;; anticipate what sort of listing dired
@@ -2718,7 +2703,7 @@ and LINE is the relevant success or fail line from the FTP-client."
2718 (line (cdr result)) 2703 (line (cdr result))
2719 dir) 2704 dir)
2720 (if (car result) 2705 (if (car result)
2721 (ange-ftp-save-match-data 2706 (save-match-data
2722 (and (or (string-match "\"\\([^\"]*\\)\"" line) 2707 (and (or (string-match "\"\\([^\"]*\\)\"" line)
2723 (string-match " \\([^ ]+\\) " line)) ; stone-age VMS servers! 2708 (string-match " \\([^ ]+\\) " line)) ; stone-age VMS servers!
2724 (setq dir (substring line 2709 (setq dir (substring line
@@ -2834,7 +2819,7 @@ logged in as user USER and cd'd to directory DIR."
2834 2819
2835(defun ange-ftp-expand-file-name (name &optional default) 2820(defun ange-ftp-expand-file-name (name &optional default)
2836 "Documented as original." 2821 "Documented as original."
2837 (ange-ftp-save-match-data 2822 (save-match-data
2838 (if (eq (string-to-char name) ?/) 2823 (if (eq (string-to-char name) ?/)
2839 (while (cond ((string-match "[^:]+//" name) ;don't upset Apollo users 2824 (while (cond ((string-match "[^:]+//" name) ;don't upset Apollo users
2840 (setq name (substring name (1- (match-end 0))))) 2825 (setq name (substring name (1- (match-end 0)))))
@@ -2875,7 +2860,7 @@ system TYPE.")
2875 (let ((parsed (ange-ftp-ftp-name name))) 2860 (let ((parsed (ange-ftp-ftp-name name)))
2876 (if parsed 2861 (if parsed
2877 (let ((filename (nth 2 parsed))) 2862 (let ((filename (nth 2 parsed)))
2878 (if (ange-ftp-save-match-data 2863 (if (save-match-data
2879 (string-match "^~[^/]*$" filename)) 2864 (string-match "^~[^/]*$" filename))
2880 name 2865 name
2881 (ange-ftp-replace-name-component 2866 (ange-ftp-replace-name-component
@@ -2888,7 +2873,7 @@ system TYPE.")
2888 (let ((parsed (ange-ftp-ftp-name name))) 2873 (let ((parsed (ange-ftp-ftp-name name)))
2889 (if parsed 2874 (if parsed
2890 (let ((filename (nth 2 parsed))) 2875 (let ((filename (nth 2 parsed)))
2891 (if (ange-ftp-save-match-data 2876 (if (save-match-data
2892 (string-match "^~[^/]*$" filename)) 2877 (string-match "^~[^/]*$" filename))
2893 "" 2878 ""
2894 (ange-ftp-real-file-name-nondirectory name))) 2879 (ange-ftp-real-file-name-nondirectory name)))
@@ -2908,7 +2893,7 @@ system TYPE.")
2908 2893
2909;; Returns non-nil if should transfer FILE in binary mode. 2894;; Returns non-nil if should transfer FILE in binary mode.
2910(defun ange-ftp-binary-file (file) 2895(defun ange-ftp-binary-file (file)
2911 (ange-ftp-save-match-data 2896 (save-match-data
2912 (string-match ange-ftp-binary-file-name-regexp file))) 2897 (string-match ange-ftp-binary-file-name-regexp file)))
2913 2898
2914(defun ange-ftp-write-region (start end filename &optional append visit) 2899(defun ange-ftp-write-region (start end filename &optional append visit)
@@ -3086,7 +3071,7 @@ system TYPE.")
3086 (ange-ftp-get-files directory))) 3071 (ange-ftp-get-files directory)))
3087 files f) 3072 files f)
3088 (setq directory (file-name-as-directory directory)) 3073 (setq directory (file-name-as-directory directory))
3089 (ange-ftp-save-match-data 3074 (save-match-data
3090 (while tail 3075 (while tail
3091 (setq f (car tail) 3076 (setq f (car tail)
3092 tail (cdr tail)) 3077 tail (cdr tail))
@@ -3568,7 +3553,7 @@ system TYPE.")
3568 "/"))) ; / never in filename 3553 "/"))) ; / never in filename
3569 completion-ignored-extensions 3554 completion-ignored-extensions
3570 "\\|"))) 3555 "\\|")))
3571 (ange-ftp-save-match-data 3556 (save-match-data
3572 (or (ange-ftp-file-name-completion-1 3557 (or (ange-ftp-file-name-completion-1
3573 file tbl ange-ftp-this-dir 3558 file tbl ange-ftp-this-dir
3574 (function ange-ftp-file-entry-not-ignored-p)) 3559 (function ange-ftp-file-entry-not-ignored-p))
@@ -3741,7 +3726,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
3741 (cdr (assq (ange-ftp-host-type (car parsed)) 3726 (cdr (assq (ange-ftp-host-type (car parsed))
3742 ange-ftp-make-compressed-filename-alist)))) 3727 ange-ftp-make-compressed-filename-alist))))
3743 (let* ((decision 3728 (let* ((decision
3744 (ange-ftp-save-match-data (funcall conversion-func name))) 3729 (save-match-data (funcall conversion-func name)))
3745 (compressing (car decision)) 3730 (compressing (car decision))
3746 (newfile (nth 1 decision))) 3731 (newfile (nth 1 decision)))
3747 (if compressing 3732 (if compressing
@@ -4393,7 +4378,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
4393; 4378;
4394;(defun ange-ftp-vos-host (host) 4379;(defun ange-ftp-vos-host (host)
4395; (and ange-ftp-vos-host-regexp 4380; (and ange-ftp-vos-host-regexp
4396; (ange-ftp-save-match-data 4381; (save-match-data
4397; (string-match ange-ftp-vos-host-regexp host)))) 4382; (string-match ange-ftp-vos-host-regexp host))))
4398; 4383;
4399;(defun ange-ftp-parse-vos-listing () 4384;(defun ange-ftp-parse-vos-listing ()
@@ -4405,7 +4390,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
4405; ("^Dirs: [0-9]+\n+" t 30))) 4390; ("^Dirs: [0-9]+\n+" t 30)))
4406; type-regexp type-is-dir type-col file) 4391; type-regexp type-is-dir type-col file)
4407; (goto-char (point-min)) 4392; (goto-char (point-min))
4408; (ange-ftp-save-match-data 4393; (save-match-data
4409; (while type-list 4394; (while type-list
4410; (setq type-regexp (car (car type-list)) 4395; (setq type-regexp (car (car type-list))
4411; type-is-dir (nth 1 (car type-list)) 4396; type-is-dir (nth 1 (car type-list))
@@ -4436,7 +4421,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
4436;; Convert NAME from UNIX-ish to VMS. If REVERSE given then convert from VMS 4421;; Convert NAME from UNIX-ish to VMS. If REVERSE given then convert from VMS
4437;; to UNIX-ish. 4422;; to UNIX-ish.
4438(defun ange-ftp-fix-name-for-vms (name &optional reverse) 4423(defun ange-ftp-fix-name-for-vms (name &optional reverse)
4439 (ange-ftp-save-match-data 4424 (save-match-data
4440 (if reverse 4425 (if reverse
4441 (if (string-match "^\\([^:]+:\\)?\\(\\[.*\\]\\)?\\([^][]*\\)$" name) 4426 (if (string-match "^\\([^:]+:\\)?\\(\\[.*\\]\\)?\\([^][]*\\)$" name)
4442 (let (drive dir file) 4427 (let (drive dir file)
@@ -4522,7 +4507,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
4522;; Return non-nil if HOST is running VMS. 4507;; Return non-nil if HOST is running VMS.
4523(defun ange-ftp-vms-host (host) 4508(defun ange-ftp-vms-host (host)
4524 (and ange-ftp-vms-host-regexp 4509 (and ange-ftp-vms-host-regexp
4525 (ange-ftp-save-match-data 4510 (save-match-data
4526 (string-match ange-ftp-vms-host-regexp host)))) 4511 (string-match ange-ftp-vms-host-regexp host))))
4527 4512
4528;; Because some VMS ftp servers convert filenames to lower case 4513;; Because some VMS ftp servers convert filenames to lower case
@@ -4556,7 +4541,7 @@ Other orders of $ and _ seem to all work just fine.")
4556 (let ((tbl (ange-ftp-make-hashtable)) 4541 (let ((tbl (ange-ftp-make-hashtable))
4557 file) 4542 file)
4558 (goto-char (point-min)) 4543 (goto-char (point-min))
4559 (ange-ftp-save-match-data 4544 (save-match-data
4560 (while (setq file (ange-ftp-parse-vms-filename)) 4545 (while (setq file (ange-ftp-parse-vms-filename))
4561 (if (string-match "\\.\\(DIR\\|dir\\);[0-9]+" file) 4546 (if (string-match "\\.\\(DIR\\|dir\\);[0-9]+" file)
4562 ;; deal with directories 4547 ;; deal with directories
@@ -4590,7 +4575,7 @@ Other orders of $ and _ seem to all work just fine.")
4590(defun ange-ftp-vms-delete-file-entry (name &optional dir-p) 4575(defun ange-ftp-vms-delete-file-entry (name &optional dir-p)
4591 (if dir-p 4576 (if dir-p
4592 (ange-ftp-internal-delete-file-entry name t) 4577 (ange-ftp-internal-delete-file-entry name t)
4593 (ange-ftp-save-match-data 4578 (save-match-data
4594 (let ((file (ange-ftp-get-file-part name))) 4579 (let ((file (ange-ftp-get-file-part name)))
4595 (if (string-match ";[0-9]+$" file) 4580 (if (string-match ";[0-9]+$" file)
4596 ;; In VMS you can't delete a file without an explicit 4581 ;; In VMS you can't delete a file without an explicit
@@ -4631,7 +4616,7 @@ Other orders of $ and _ seem to all work just fine.")
4631 ange-ftp-files-hashtable))) 4616 ange-ftp-files-hashtable)))
4632 (if files 4617 (if files
4633 (let ((file (ange-ftp-get-file-part name))) 4618 (let ((file (ange-ftp-get-file-part name)))
4634 (ange-ftp-save-match-data 4619 (save-match-data
4635 (if (string-match ";[0-9]+$" file) 4620 (if (string-match ";[0-9]+$" file)
4636 (ange-ftp-put-hash-entry 4621 (ange-ftp-put-hash-entry
4637 (substring file 0 (match-beginning 0)) 4622 (substring file 0 (match-beginning 0))
@@ -4680,7 +4665,7 @@ Other orders of $ and _ seem to all work just fine.")
4680 4665
4681 4666
4682(defun ange-ftp-vms-file-name-as-directory (name) 4667(defun ange-ftp-vms-file-name-as-directory (name)
4683 (ange-ftp-save-match-data 4668 (save-match-data
4684 (if (string-match "\\.\\(DIR\\|dir\\)\\(;[0-9]+\\)?$" name) 4669 (if (string-match "\\.\\(DIR\\|dir\\)\\(;[0-9]+\\)?$" name)
4685 (setq name (substring name 0 (match-beginning 0)))) 4670 (setq name (substring name 0 (match-beginning 0))))
4686 (ange-ftp-real-file-name-as-directory name))) 4671 (ange-ftp-real-file-name-as-directory name)))
@@ -4842,7 +4827,7 @@ Other orders of $ and _ seem to all work just fine.")
4842;; ange-ftp-dired-ls-trim-alist))) 4827;; ange-ftp-dired-ls-trim-alist)))
4843 4828
4844(defun ange-ftp-vms-sans-version (name) 4829(defun ange-ftp-vms-sans-version (name)
4845 (ange-ftp-save-match-data 4830 (save-match-data
4846 (if (string-match ";[0-9]+$" name) 4831 (if (string-match ";[0-9]+$" name)
4847 (substring name 0 (match-beginning 0)) 4832 (substring name 0 (match-beginning 0))
4848 name))) 4833 name)))
@@ -4999,7 +4984,7 @@ Other orders of $ and _ seem to all work just fine.")
4999;; Convert NAME from UNIX-ish to MTS. If REVERSE given then convert from 4984;; Convert NAME from UNIX-ish to MTS. If REVERSE given then convert from
5000;; MTS to UNIX-ish. 4985;; MTS to UNIX-ish.
5001(defun ange-ftp-fix-name-for-mts (name &optional reverse) 4986(defun ange-ftp-fix-name-for-mts (name &optional reverse)
5002 (ange-ftp-save-match-data 4987 (save-match-data
5003 (if reverse 4988 (if reverse
5004 (if (string-match "^\\([^:]+:\\)?\\(.*\\)$" name) 4989 (if (string-match "^\\([^:]+:\\)?\\(.*\\)$" name)
5005 (let (acct file) 4990 (let (acct file)
@@ -5049,14 +5034,14 @@ Other orders of $ and _ seem to all work just fine.")
5049;; Return non-nil if HOST is running MTS. 5034;; Return non-nil if HOST is running MTS.
5050(defun ange-ftp-mts-host (host) 5035(defun ange-ftp-mts-host (host)
5051 (and ange-ftp-mts-host-regexp 5036 (and ange-ftp-mts-host-regexp
5052 (ange-ftp-save-match-data 5037 (save-match-data
5053 (string-match ange-ftp-mts-host-regexp host)))) 5038 (string-match ange-ftp-mts-host-regexp host))))
5054 5039
5055;; Parse the current buffer which is assumed to be in mts ftp dir format. 5040;; Parse the current buffer which is assumed to be in mts ftp dir format.
5056(defun ange-ftp-parse-mts-listing () 5041(defun ange-ftp-parse-mts-listing ()
5057 (let ((tbl (ange-ftp-make-hashtable))) 5042 (let ((tbl (ange-ftp-make-hashtable)))
5058 (goto-char (point-min)) 5043 (goto-char (point-min))
5059 (ange-ftp-save-match-data 5044 (save-match-data
5060 (while (re-search-forward ange-ftp-date-regexp nil t) 5045 (while (re-search-forward ange-ftp-date-regexp nil t)
5061 (end-of-line) 5046 (end-of-line)
5062 (skip-chars-backward " ") 5047 (skip-chars-backward " ")
@@ -5162,7 +5147,7 @@ Other orders of $ and _ seem to all work just fine.")
5162;; Have I got the filename character set right? 5147;; Have I got the filename character set right?
5163 5148
5164(defun ange-ftp-fix-name-for-cms (name &optional reverse) 5149(defun ange-ftp-fix-name-for-cms (name &optional reverse)
5165 (ange-ftp-save-match-data 5150 (save-match-data
5166 (if reverse 5151 (if reverse
5167 ;; Since we only convert output from a pwd in this direction, 5152 ;; Since we only convert output from a pwd in this direction,
5168 ;; we'll assume that it's a minidisk, and make it into a 5153 ;; we'll assume that it's a minidisk, and make it into a
@@ -5252,7 +5237,7 @@ Other orders of $ and _ seem to all work just fine.")
5252;; Return non-nil if HOST is running CMS. 5237;; Return non-nil if HOST is running CMS.
5253(defun ange-ftp-cms-host (host) 5238(defun ange-ftp-cms-host (host)
5254 (and ange-ftp-cms-host-regexp 5239 (and ange-ftp-cms-host-regexp
5255 (ange-ftp-save-match-data 5240 (save-match-data
5256 (string-match ange-ftp-cms-host-regexp host)))) 5241 (string-match ange-ftp-cms-host-regexp host))))
5257 5242
5258(defun ange-ftp-add-cms-host (host) 5243(defun ange-ftp-add-cms-host (host)
@@ -5289,7 +5274,7 @@ Other orders of $ and _ seem to all work just fine.")
5289 ;; Now do the usual parsing 5274 ;; Now do the usual parsing
5290 (let ((tbl (ange-ftp-make-hashtable))) 5275 (let ((tbl (ange-ftp-make-hashtable)))
5291 (goto-char (point-min)) 5276 (goto-char (point-min))
5292 (ange-ftp-save-match-data 5277 (save-match-data
5293 (while 5278 (while
5294 (re-search-forward 5279 (re-search-forward
5295 "^\\([-A-Z0-9$_]+\\) +\\([-A-Z0-9$_]+\\) +[VF] +[0-9]+ " nil t) 5280 "^\\([-A-Z0-9$_]+\\) +\\([-A-Z0-9$_]+\\) +[VF] +[0-9]+ " nil t)