aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2017-05-25 10:04:12 +0200
committerMichael Albinus2017-05-25 10:04:12 +0200
commit1a9ce7c54e99d80fb515a33edbeeb75fd3239526 (patch)
tree08bf6758d1163c4d2efd70e79d4cf0745ecb53df
parentbfdc27c5f60765a57164e9b12f34856ae90b5888 (diff)
downloademacs-1a9ce7c54e99d80fb515a33edbeeb75fd3239526.tar.gz
emacs-1a9ce7c54e99d80fb515a33edbeeb75fd3239526.zip
Switch Tramp to cl-lib
* lisp/net/tramp-compat.el (cl-lib): Require it rather than cl. * lisp/net/tramp-ftp.el: Don't require cl. * lisp/net/tramp-gvfs.el: Don't require cl. (tramp-gvfs-handler-mounted-unmounted) (tramp-gvfs-connection-mounted-p): Use `cl-*' macros. * lisp/net/tramp-sh.el: Don't require cl. (tramp-set-file-uid-gid): Use `shell-quote-argument'. (tramp-sh-gvfs-monitor-dir-process-filter) (tramp-sh-inotifywait-process-filter): Use `cl-*' macros. * lisp/net/tramp-smb.el: Don't require cl. (tramp-smb-read-file-entry): Use `cl-*' macros. * lisp/net/tramp.el (cl-lib): Require it rather than cl. (tramp-parse-file, tramp-parse-shostkeys-sknownhosts) (tramp-parse-passwd, tramp-parse-etc-group) (tramp-parse-putty): Use `cl-*' macros.
-rw-r--r--lisp/net/tramp-compat.el5
-rw-r--r--lisp/net/tramp-ftp.el1
-rw-r--r--lisp/net/tramp-gvfs.el9
-rw-r--r--lisp/net/tramp-sh.el11
-rw-r--r--lisp/net/tramp-smb.el22
-rw-r--r--lisp/net/tramp.el28
6 files changed, 33 insertions, 43 deletions
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 53266e806c0..392a28c59de 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -29,12 +29,9 @@
29 29
30;;; Code: 30;;; Code:
31 31
32;; Pacify byte-compiler.
33(eval-when-compile
34 (require 'cl))
35
36(require 'auth-source) 32(require 'auth-source)
37(require 'advice) 33(require 'advice)
34(require 'cl-lib)
38(require 'custom) 35(require 'custom)
39(require 'format-spec) 36(require 'format-spec)
40(require 'parse-time) 37(require 'parse-time)
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el
index 44a4ccadaca..8e489eee801 100644
--- a/lisp/net/tramp-ftp.el
+++ b/lisp/net/tramp-ftp.el
@@ -32,7 +32,6 @@
32 32
33;; Pacify byte-compiler. 33;; Pacify byte-compiler.
34(eval-when-compile 34(eval-when-compile
35 (require 'cl)
36 (require 'custom)) 35 (require 'custom))
37(defvar ange-ftp-ftp-name-arg) 36(defvar ange-ftp-ftp-name-arg)
38(defvar ange-ftp-ftp-name-res) 37(defvar ange-ftp-ftp-name-res)
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index ad9bd819c02..57a135139a5 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -106,7 +106,6 @@
106 106
107;; Pacify byte-compiler. 107;; Pacify byte-compiler.
108(eval-when-compile 108(eval-when-compile
109 (require 'cl)
110 (require 'custom)) 109 (require 'custom))
111 110
112;;;###tramp-autoload 111;;;###tramp-autoload
@@ -1386,9 +1385,9 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"."
1386 ;; elements. 1385 ;; elements.
1387 (while (stringp (car elt)) (setq elt (cdr elt))) 1386 (while (stringp (car elt)) (setq elt (cdr elt)))
1388 (let* ((fuse-mountpoint (tramp-gvfs-dbus-byte-array-to-string (cadr elt))) 1387 (let* ((fuse-mountpoint (tramp-gvfs-dbus-byte-array-to-string (cadr elt)))
1389 (mount-spec (caddr elt)) 1388 (mount-spec (cl-caddr elt))
1390 (default-location (tramp-gvfs-dbus-byte-array-to-string 1389 (default-location (tramp-gvfs-dbus-byte-array-to-string
1391 (cadddr elt))) 1390 (cl-cadddr elt)))
1392 (method (tramp-gvfs-dbus-byte-array-to-string 1391 (method (tramp-gvfs-dbus-byte-array-to-string
1393 (cadr (assoc "type" (cadr mount-spec))))) 1392 (cadr (assoc "type" (cadr mount-spec)))))
1394 (user (tramp-gvfs-dbus-byte-array-to-string 1393 (user (tramp-gvfs-dbus-byte-array-to-string
@@ -1472,9 +1471,9 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"."
1472 (while (stringp (car elt)) (setq elt (cdr elt))) 1471 (while (stringp (car elt)) (setq elt (cdr elt)))
1473 (let* ((fuse-mountpoint (tramp-gvfs-dbus-byte-array-to-string 1472 (let* ((fuse-mountpoint (tramp-gvfs-dbus-byte-array-to-string
1474 (cadr elt))) 1473 (cadr elt)))
1475 (mount-spec (caddr elt)) 1474 (mount-spec (cl-caddr elt))
1476 (default-location (tramp-gvfs-dbus-byte-array-to-string 1475 (default-location (tramp-gvfs-dbus-byte-array-to-string
1477 (cadddr elt))) 1476 (cl-cadddr elt)))
1478 (method (tramp-gvfs-dbus-byte-array-to-string 1477 (method (tramp-gvfs-dbus-byte-array-to-string
1479 (cadr (assoc "type" (cadr mount-spec))))) 1478 (cadr (assoc "type" (cadr mount-spec)))))
1480 (user (tramp-gvfs-dbus-byte-array-to-string 1479 (user (tramp-gvfs-dbus-byte-array-to-string
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 4b89c173471..84782a4c7f3 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -31,7 +31,6 @@
31 31
32;; Pacify byte-compiler. 32;; Pacify byte-compiler.
33(eval-when-compile 33(eval-when-compile
34 (require 'cl)
35 (require 'dired)) 34 (require 'dired))
36 35
37(declare-function dired-remove-file "dired-aux") 36(declare-function dired-remove-file "dired-aux")
@@ -1557,7 +1556,7 @@ be non-negative integers."
1557 (gid (or (and (natnump gid) gid) (tramp-get-local-gid 'integer)))) 1556 (gid (or (and (natnump gid) gid) (tramp-get-local-gid 'integer))))
1558 (tramp-call-process 1557 (tramp-call-process
1559 nil "chown" nil nil nil 1558 nil "chown" nil nil nil
1560 (format "%d:%d" uid gid) (tramp-shell-quote-argument filename))))))) 1559 (format "%d:%d" uid gid) (shell-quote-argument filename)))))))
1561 1560
1562(defun tramp-remote-selinux-p (vec) 1561(defun tramp-remote-selinux-p (vec)
1563 "Check, whether SELINUX is enabled on the remote host." 1562 "Check, whether SELINUX is enabled on the remote host."
@@ -3674,13 +3673,13 @@ file-notify events."
3674 (when file1 (concat remote-prefix file1))))) 3673 (when file1 (concat remote-prefix file1)))))
3675 (setq string (replace-match "" nil nil string)) 3674 (setq string (replace-match "" nil nil string))
3676 ;; Remove watch when file or directory to be watched is deleted. 3675 ;; Remove watch when file or directory to be watched is deleted.
3677 (when (and (member (caadr object) '(moved deleted)) 3676 (when (and (member (cl-caadr object) '(moved deleted))
3678 (string-equal file (process-get proc 'watch-name))) 3677 (string-equal file (process-get proc 'watch-name)))
3679 (delete-process proc)) 3678 (delete-process proc))
3680 ;; Usually, we would add an Emacs event now. Unfortunately, 3679 ;; Usually, we would add an Emacs event now. Unfortunately,
3681 ;; `unread-command-events' does not accept several events at 3680 ;; `unread-command-events' does not accept several events at
3682 ;; once. Therefore, we apply the handler directly. 3681 ;; once. Therefore, we apply the handler directly.
3683 (when (member (caadr object) events) 3682 (when (member (cl-caadr object) events)
3684 (tramp-compat-funcall 3683 (tramp-compat-funcall
3685 'file-notify-handle-event 3684 'file-notify-handle-event
3686 `(file-notify ,object file-notify-callback))))) 3685 `(file-notify ,object file-notify-callback)))))
@@ -3714,12 +3713,12 @@ file-notify events."
3714 (split-string (match-string 1 line) "," 'omit)) 3713 (split-string (match-string 1 line) "," 'omit))
3715 (match-string 3 line)))) 3714 (match-string 3 line))))
3716 ;; Remove watch when file or directory to be watched is deleted. 3715 ;; Remove watch when file or directory to be watched is deleted.
3717 (when (member (caadr object) '(move-self delete-self ignored)) 3716 (when (member (cl-caadr object) '(move-self delete-self ignored))
3718 (delete-process proc)) 3717 (delete-process proc))
3719 ;; Usually, we would add an Emacs event now. Unfortunately, 3718 ;; Usually, we would add an Emacs event now. Unfortunately,
3720 ;; `unread-command-events' does not accept several events at 3719 ;; `unread-command-events' does not accept several events at
3721 ;; once. Therefore, we apply the handler directly. 3720 ;; once. Therefore, we apply the handler directly.
3722 (when (member (caadr object) events) 3721 (when (member (cl-caadr object) events)
3723 (tramp-compat-funcall 3722 (tramp-compat-funcall
3724 'file-notify-handle-event 3723 'file-notify-handle-event
3725 `(file-notify ,object file-notify-callback))))))) 3724 `(file-notify ,object file-notify-callback)))))))
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 7b2a1ba874d..88db8eaf0e1 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -29,10 +29,6 @@
29 29
30(require 'tramp) 30(require 'tramp)
31 31
32;; Pacify byte-compiler.
33(eval-when-compile
34 (require 'cl))
35
36;; Define SMB method ... 32;; Define SMB method ...
37;;;###tramp-autoload 33;;;###tramp-autoload
38(defconst tramp-smb-method "smb" 34(defconst tramp-smb-method "smb"
@@ -1655,13 +1651,13 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
1655 size 0)) 1651 size 0))
1656 1652
1657 ;; Real listing. 1653 ;; Real listing.
1658 (block nil 1654 (cl-block nil
1659 1655
1660 ;; year. 1656 ;; year.
1661 (if (string-match "\\([0-9]+\\)$" line) 1657 (if (string-match "\\([0-9]+\\)$" line)
1662 (setq year (string-to-number (match-string 1 line)) 1658 (setq year (string-to-number (match-string 1 line))
1663 line (substring line 0 -5)) 1659 line (substring line 0 -5))
1664 (return)) 1660 (cl-return))
1665 1661
1666 ;; time. 1662 ;; time.
1667 (if (string-match "\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)$" line) 1663 (if (string-match "\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)$" line)
@@ -1669,24 +1665,24 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
1669 min (string-to-number (match-string 2 line)) 1665 min (string-to-number (match-string 2 line))
1670 sec (string-to-number (match-string 3 line)) 1666 sec (string-to-number (match-string 3 line))
1671 line (substring line 0 -9)) 1667 line (substring line 0 -9))
1672 (return)) 1668 (cl-return))
1673 1669
1674 ;; day. 1670 ;; day.
1675 (if (string-match "\\([0-9]+\\)$" line) 1671 (if (string-match "\\([0-9]+\\)$" line)
1676 (setq day (string-to-number (match-string 1 line)) 1672 (setq day (string-to-number (match-string 1 line))
1677 line (substring line 0 -3)) 1673 line (substring line 0 -3))
1678 (return)) 1674 (cl-return))
1679 1675
1680 ;; month. 1676 ;; month.
1681 (if (string-match "\\(\\w+\\)$" line) 1677 (if (string-match "\\(\\w+\\)$" line)
1682 (setq month (match-string 1 line) 1678 (setq month (match-string 1 line)
1683 line (substring line 0 -4)) 1679 line (substring line 0 -4))
1684 (return)) 1680 (cl-return))
1685 1681
1686 ;; weekday. 1682 ;; weekday.
1687 (if (string-match "\\(\\w+\\)$" line) 1683 (if (string-match "\\(\\w+\\)$" line)
1688 (setq line (substring line 0 -5)) 1684 (setq line (substring line 0 -5))
1689 (return)) 1685 (cl-return))
1690 1686
1691 ;; size. 1687 ;; size.
1692 (if (string-match "\\([0-9]+\\)$" line) 1688 (if (string-match "\\([0-9]+\\)$" line)
@@ -1695,7 +1691,7 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
1695 (when (string-match "\\([ADHRSV]+\\)" (substring line length)) 1691 (when (string-match "\\([ADHRSV]+\\)" (substring line length))
1696 (setq length (+ length (match-end 0)))) 1692 (setq length (+ length (match-end 0))))
1697 (setq line (substring line 0 length))) 1693 (setq line (substring line 0 length)))
1698 (return)) 1694 (cl-return))
1699 1695
1700 ;; mode: ARCH, DIR, HIDDEN, RONLY, SYSTEM, VOLID. 1696 ;; mode: ARCH, DIR, HIDDEN, RONLY, SYSTEM, VOLID.
1701 (if (string-match "\\([ADHRSV]+\\)?$" line) 1697 (if (string-match "\\([ADHRSV]+\\)?$" line)
@@ -1708,12 +1704,12 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
1708 (lambda (_x) "") " " 1704 (lambda (_x) "") " "
1709 (concat "r" (if (string-match "R" mode) "-" "w") "x")))) 1705 (concat "r" (if (string-match "R" mode) "-" "w") "x"))))
1710 line (substring line 0 -6)) 1706 line (substring line 0 -6))
1711 (return)) 1707 (cl-return))
1712 1708
1713 ;; localname. 1709 ;; localname.
1714 (if (string-match "^\\s-+\\(\\S-\\(.*\\S-\\)?\\)\\s-*$" line) 1710 (if (string-match "^\\s-+\\(\\S-\\(.*\\S-\\)?\\)\\s-*$" line)
1715 (setq localname (match-string 1 line)) 1711 (setq localname (match-string 1 line))
1716 (return)))) 1712 (cl-return))))
1717 1713
1718 (when (and localname mode size) 1714 (when (and localname mode size)
1719 (setq mtime 1715 (setq mtime
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index b97a7a877cd..a1cd90bec79 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -58,8 +58,7 @@
58(require 'tramp-compat) 58(require 'tramp-compat)
59 59
60;; Pacify byte-compiler. 60;; Pacify byte-compiler.
61(eval-when-compile 61(require 'cl-lib)
62 (require 'cl))
63(defvar auto-save-file-name-transforms) 62(defvar auto-save-file-name-transforms)
64(defvar eshell-path-env) 63(defvar eshell-path-env)
65(defvar ls-lisp-use-insert-directory-program) 64(defvar ls-lisp-use-insert-directory-program)
@@ -1134,8 +1133,8 @@ calling HANDLER.")
1134;; internal data structure. Convenience functions for internal 1133;; internal data structure. Convenience functions for internal
1135;; data structure. 1134;; data structure.
1136 1135
1137;; The basic structure for remote file names. We use a list, 1136;; The basic structure for remote file names. We use a list :type,
1138;; otherwise the test in `tramp-cache-data' fails. 1137;; otherwise the persistent data are not read in tramp-cache.el.
1139(cl-defstruct (tramp-file-name (:type list) :named) 1138(cl-defstruct (tramp-file-name (:type list) :named)
1140 method user domain host port localname hop) 1139 method user domain host port localname hop)
1141 1140
@@ -2588,7 +2587,7 @@ User is always nil."
2588 (with-temp-buffer 2587 (with-temp-buffer
2589 (insert-file-contents filename) 2588 (insert-file-contents filename)
2590 (goto-char (point-min)) 2589 (goto-char (point-min))
2591 (loop while (not (eobp)) collect (funcall function)))))) 2590 (cl-loop while (not (eobp)) collect (funcall function))))))
2592 2591
2593;;;###tramp-autoload 2592;;;###tramp-autoload
2594(defun tramp-parse-rhosts (filename) 2593(defun tramp-parse-rhosts (filename)
@@ -2640,9 +2639,10 @@ User is always nil."
2640 ;; `default-directory' is remote. 2639 ;; `default-directory' is remote.
2641 (let* ((default-directory (tramp-compat-temporary-file-directory)) 2640 (let* ((default-directory (tramp-compat-temporary-file-directory))
2642 (files (and (file-directory-p dirname) (directory-files dirname)))) 2641 (files (and (file-directory-p dirname) (directory-files dirname))))
2643 (loop for f in files 2642 (cl-loop
2644 when (and (not (string-match "^\\.\\.?$" f)) (string-match regexp f)) 2643 for f in files
2645 collect (list nil (match-string 1 f))))) 2644 when (and (not (string-match "^\\.\\.?$" f)) (string-match regexp f))
2645 collect (list nil (match-string 1 f)))))
2646 2646
2647;;;###tramp-autoload 2647;;;###tramp-autoload
2648(defun tramp-parse-shostkeys (dirname) 2648(defun tramp-parse-shostkeys (dirname)
@@ -2680,8 +2680,8 @@ Host is always \"localhost\"."
2680 (with-temp-buffer 2680 (with-temp-buffer
2681 (when (zerop (tramp-call-process nil "getent" nil t nil "passwd")) 2681 (when (zerop (tramp-call-process nil "getent" nil t nil "passwd"))
2682 (goto-char (point-min)) 2682 (goto-char (point-min))
2683 (loop while (not (eobp)) collect 2683 (cl-loop while (not (eobp)) collect
2684 (tramp-parse-etc-group-group)))) 2684 (tramp-parse-etc-group-group))))
2685 (tramp-parse-file filename 'tramp-parse-passwd-group)))) 2685 (tramp-parse-file filename 'tramp-parse-passwd-group))))
2686 2686
2687(defun tramp-parse-passwd-group () 2687(defun tramp-parse-passwd-group ()
@@ -2703,8 +2703,8 @@ Host is always \"localhost\"."
2703 (with-temp-buffer 2703 (with-temp-buffer
2704 (when (zerop (tramp-call-process nil "getent" nil t nil "group")) 2704 (when (zerop (tramp-call-process nil "getent" nil t nil "group"))
2705 (goto-char (point-min)) 2705 (goto-char (point-min))
2706 (loop while (not (eobp)) collect 2706 (cl-loop while (not (eobp)) collect
2707 (tramp-parse-etc-group-group)))) 2707 (tramp-parse-etc-group-group))))
2708 (tramp-parse-file filename 'tramp-parse-etc-group-group)))) 2708 (tramp-parse-file filename 'tramp-parse-etc-group-group))))
2709 2709
2710(defun tramp-parse-etc-group-group () 2710(defun tramp-parse-etc-group-group ()
@@ -2746,8 +2746,8 @@ User is always nil."
2746 (when (zerop (tramp-call-process 2746 (when (zerop (tramp-call-process
2747 nil "reg" nil t nil "query" registry-or-dirname)) 2747 nil "reg" nil t nil "query" registry-or-dirname))
2748 (goto-char (point-min)) 2748 (goto-char (point-min))
2749 (loop while (not (eobp)) collect 2749 (cl-loop while (not (eobp)) collect
2750 (tramp-parse-putty-group registry-or-dirname))))) 2750 (tramp-parse-putty-group registry-or-dirname)))))
2751 ;; UNIX case. 2751 ;; UNIX case.
2752 (tramp-parse-shostkeys-sknownhosts 2752 (tramp-parse-shostkeys-sknownhosts
2753 registry-or-dirname (concat "^\\(" tramp-host-regexp "\\)$")))) 2753 registry-or-dirname (concat "^\\(" tramp-host-regexp "\\)$"))))