emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110949: Use cl-lib instead of cl, an


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110949: Use cl-lib instead of cl, and interactive-p => called-interactively-p.
Date: Mon, 19 Nov 2012 12:24:12 -0500
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110949
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2012-11-19 12:24:12 -0500
message:
  Use cl-lib instead of cl, and interactive-p => called-interactively-p.
  * lisp/erc/erc-track.el, lisp/erc/erc-networks.el, lisp/erc/erc-netsplit.el:
  * lisp/erc/erc-dcc.el, lisp/erc/erc-backend.el: Use cl-lib, nth, pcase, and
  called-interactively-p instead of cl.
  * lisp/erc/erc-speedbar.el, lisp/erc/erc-services.el:
  * lisp/erc/erc-pcomplete.el, lisp/erc/erc-notify.el, lisp/erc/erc-match.el:
  * lisp/erc/erc-log.el, lisp/erc/erc-join.el, lisp/erc/erc-ezbounce.el:
  * lisp/erc/erc-capab.el: Don't require cl since we don't use it.
  * lisp/erc/erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o 
cl.
  (erc-lurker-ignore-chars, erc-common-server-suffixes): Move before first use.
  * lisp/json.el: Don't require cl since we don't use it.
  * lisp/color.el: Don't require cl.
  (color-complement): `caddr' -> `nth 2'.
  * test/automated/ert-x-tests.el: Use cl-lib.
  * test/automated/ert-tests.el: Use lexical-binding and cl-lib.
modified:
  lisp/ChangeLog
  lisp/color.el
  lisp/erc/ChangeLog
  lisp/erc/erc-backend.el
  lisp/erc/erc-capab.el
  lisp/erc/erc-dcc.el
  lisp/erc/erc-ezbounce.el
  lisp/erc/erc-join.el
  lisp/erc/erc-log.el
  lisp/erc/erc-match.el
  lisp/erc/erc-netsplit.el
  lisp/erc/erc-networks.el
  lisp/erc/erc-notify.el
  lisp/erc/erc-pcomplete.el
  lisp/erc/erc-services.el
  lisp/erc/erc-speedbar.el
  lisp/erc/erc-track.el
  lisp/erc/erc.el
  lisp/json.el
  test/ChangeLog
  test/automated/ert-tests.el
  test/automated/ert-x-tests.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-11-19 16:17:49 +0000
+++ b/lisp/ChangeLog    2012-11-19 17:24:12 +0000
@@ -1,5 +1,9 @@
 2012-11-19  Stefan Monnier  <address@hidden>
 
+       * json.el: Don't require cl since we don't use it.
+       * color.el: Don't require cl.
+       (color-complement): `caddr' -> `nth 2'.
+
        * calendar/time-date.el (time-to-seconds): De-obsolete.
 
 2012-11-19  Jay Belanger  <address@hidden>

=== modified file 'lisp/color.el'
--- a/lisp/color.el     2012-10-06 02:20:36 +0000
+++ b/lisp/color.el     2012-11-19 17:24:12 +0000
@@ -33,9 +33,6 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
-
 ;; Emacs < 23.3
 (eval-and-compile
   (unless (boundp 'float-pi)
@@ -69,9 +66,9 @@
 COLOR-NAME should be a string naming a color (e.g. \"white\"), or
 a string specifying a color's RGB components (e.g. \"#ff12ec\")."
   (let ((color (color-name-to-rgb color-name)))
-    (list (- 1.0 (car color))
-          (- 1.0 (cadr color))
-          (- 1.0 (caddr color)))))
+    (list (- 1.0 (nth 0 color))
+          (- 1.0 (nth 1 color))
+          (- 1.0 (nth 2 color)))))
 
 (defun color-gradient (start stop step-number)
   "Return a list with STEP-NUMBER colors from START to STOP.

=== modified file 'lisp/erc/ChangeLog'
--- a/lisp/erc/ChangeLog        2012-11-16 17:20:23 +0000
+++ b/lisp/erc/ChangeLog        2012-11-19 17:24:12 +0000
@@ -1,3 +1,16 @@
+2012-11-19  Stefan Monnier  <address@hidden>
+
+       Use cl-lib instead of cl, and interactive-p => called-interactively-p.
+       * erc-track.el, erc-networks.el, erc-netsplit.el, erc-dcc.el:
+       * erc-backend.el: Use cl-lib, nth, pcase, and called-interactively-p
+       instead of cl.
+       * erc-speedbar.el, erc-services.el, erc-pcomplete.el, erc-notify.el:
+       * erc-match.el, erc-log.el, erc-join.el, erc-ezbounce.el:
+       * erc-capab.el: Don't require cl since we don't use it.
+       * erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o cl.
+       (erc-lurker-ignore-chars, erc-common-server-suffixes):
+       Move before first use.
+
 2012-11-16  Glenn Morris  <address@hidden>
 
        * erc.el (erc-modules): Add "notifications".  Tweak "hecomplete" doc.

=== modified file 'lisp/erc/erc-backend.el'
--- a/lisp/erc/erc-backend.el   2012-10-28 15:32:15 +0000
+++ b/lisp/erc/erc-backend.el   2012-11-19 17:24:12 +0000
@@ -98,7 +98,7 @@
 ;;; Code:
 
 (require 'erc-compat)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 ;; There's a fairly strong mutual dependency between erc.el and erc-backend.el.
 ;; Luckily, erc.el does not need erc-backend.el for macroexpansion whereas the
 ;; reverse is true:
@@ -109,7 +109,7 @@
 (defvar erc-server-responses (make-hash-table :test #'equal)
   "Hashtable mapping server responses to their handler hooks.")
 
-(defstruct (erc-response (:conc-name erc-response.))
+(cl-defstruct (erc-response (:conc-name erc-response.))
   (unparsed "" :type string)
   (sender "" :type string)
   (command "" :type string)
@@ -950,7 +950,7 @@
         (push str (erc-response.command-args msg))))
 
     (setf (erc-response.contents msg)
-          (first (erc-response.command-args msg)))
+          (car (erc-response.command-args msg)))
 
     (setf (erc-response.command-args msg)
           (nreverse (erc-response.command-args msg)))
@@ -1045,7 +1045,7 @@
                (name &rest name)
                &optional sexp sexp def-body))
 
-(defmacro* define-erc-response-handler ((name &rest aliases)
+(cl-defmacro define-erc-response-handler ((name &rest aliases)
                                         &optional extra-fn-doc extra-var-doc
                                         &rest fn-body)
   "Define an ERC handler hook/function pair.
@@ -1154,11 +1154,11 @@
                            "")
                          name hook-name))
          (fn-alternates
-          (loop for alias in aliases
-                collect (intern (format "erc-server-%s" alias))))
+          (cl-loop for alias in aliases
+                   collect (intern (format "erc-server-%s" alias))))
          (var-alternates
-          (loop for alias in aliases
-                collect (intern (format "erc-server-%s-functions" alias)))))
+          (cl-loop for alias in aliases
+                   collect (intern (format "erc-server-%s-functions" alias)))))
     `(prog2
          ;; Normal hook variable.
          (defvar ,hook-name ',fn-name ,(format hook-doc name))
@@ -1172,19 +1172,19 @@
        (put ',hook-name 'definition-name ',name)
 
        ;; Hashtable map of responses to hook variables
-       ,@(loop for response in (cons name aliases)
-               for var in (cons hook-name var-alternates)
-               collect `(puthash ,(format "%s" response) ',var
-                                 erc-server-responses))
+       ,@(cl-loop for response in (cons name aliases)
+                  for var in (cons hook-name var-alternates)
+                  collect `(puthash ,(format "%s" response) ',var
+                                    erc-server-responses))
        ;; Alternates.
        ;; Functions are defaliased, hook variables are defvared so we
        ;; can add hooks to one alias, but not another.
-       ,@(loop for fn in fn-alternates
-               for var in var-alternates
-               for a in aliases
-               nconc (list `(defalias ',fn ',fn-name)
-                           `(defvar ,var ',fn-name ,(format hook-doc a))
-                           `(put ',var 'definition-name ',hook-name))))))
+       ,@(cl-loop for fn in fn-alternates
+                  for var in var-alternates
+                  for a in aliases
+                  nconc (list `(defalias ',fn ',fn-name)
+                              `(defvar ,var ',fn-name ,(format hook-doc a))
+                              `(put ',var 'definition-name ',hook-name))))))
 
 (define-erc-response-handler (ERROR)
   "Handle an ERROR command from the server." nil
@@ -1196,10 +1196,10 @@
 (define-erc-response-handler (INVITE)
   "Handle invitation messages."
   nil
-  (let ((target (first (erc-response.command-args parsed)))
+  (let ((target (car (erc-response.command-args parsed)))
         (chnl (erc-response.contents parsed)))
-    (multiple-value-bind (nick login host)
-        (values-list (erc-parse-user (erc-response.sender parsed)))
+    (pcase-let ((`(,nick ,login ,host)
+                 (erc-parse-user (erc-response.sender parsed))))
       (setq erc-invitation chnl)
       (when (string= target (erc-current-nick))
         (erc-display-message
@@ -1212,8 +1212,8 @@
   nil
   (let ((chnl (erc-response.contents parsed))
         (buffer nil))
-    (multiple-value-bind (nick login host)
-        (values-list (erc-parse-user (erc-response.sender parsed)))
+    (pcase-let ((`(,nick ,login ,host)
+                 (erc-parse-user (erc-response.sender parsed))))
       ;; strip the stupid combined JOIN facility (IRC 2.9)
       (if (string-match "^\\(.*\\)?\^g.*$" chnl)
           (setq chnl (match-string 1 chnl)))
@@ -1249,12 +1249,12 @@
 
 (define-erc-response-handler (KICK)
   "Handle kick messages received from the server." nil
-  (let* ((ch (first (erc-response.command-args parsed)))
-         (tgt (second (erc-response.command-args parsed)))
+  (let* ((ch (nth 0 (erc-response.command-args parsed)))
+         (tgt (nth 1 (erc-response.command-args parsed)))
          (reason (erc-trim-string (erc-response.contents parsed)))
          (buffer (erc-get-buffer ch proc)))
-    (multiple-value-bind (nick login host)
-        (values-list (erc-parse-user (erc-response.sender parsed)))
+    (pcase-let ((`(,nick ,login ,host)
+                 (erc-parse-user (erc-response.sender parsed))))
       (erc-remove-channel-member buffer tgt)
       (cond
        ((string= tgt (erc-current-nick))
@@ -1277,11 +1277,11 @@
 
 (define-erc-response-handler (MODE)
   "Handle server mode changes." nil
-  (let ((tgt (first (erc-response.command-args parsed)))
+  (let ((tgt (car (erc-response.command-args parsed)))
         (mode (mapconcat 'identity (cdr (erc-response.command-args parsed))
                          " ")))
-    (multiple-value-bind (nick login host)
-        (values-list (erc-parse-user (erc-response.sender parsed)))
+    (pcase-let ((`(,nick ,login ,host)
+                 (erc-parse-user (erc-response.sender parsed))))
       (erc-log (format "MODE: %s -> %s: %s" nick tgt mode))
       ;; dirty hack
       (let ((buf (cond ((erc-channel-p tgt)
@@ -1305,8 +1305,8 @@
   "Handle nick change messages." nil
   (let ((nn (erc-response.contents parsed))
         bufs)
-    (multiple-value-bind (nick login host)
-        (values-list (erc-parse-user (erc-response.sender parsed)))
+    (pcase-let ((`(,nick ,login ,host)
+                 (erc-parse-user (erc-response.sender parsed))))
       (setq bufs (erc-buffer-list-with-nick nick proc))
       (erc-log (format "NICK: %s -> %s" nick nn))
       ;; if we had a query with this user, make sure future messages will be
@@ -1340,11 +1340,11 @@
 
 (define-erc-response-handler (PART)
   "Handle part messages." nil
-  (let* ((chnl (first (erc-response.command-args parsed)))
+  (let* ((chnl (car (erc-response.command-args parsed)))
          (reason (erc-trim-string (erc-response.contents parsed)))
          (buffer (erc-get-buffer chnl proc)))
-    (multiple-value-bind (nick login host)
-        (values-list (erc-parse-user (erc-response.sender parsed)))
+    (pcase-let ((`(,nick ,login ,host)
+                 (erc-parse-user (erc-response.sender parsed))))
       (erc-remove-channel-member buffer nick)
       (erc-display-message parsed 'notice buffer
                            'PART ?n nick ?u login
@@ -1361,7 +1361,7 @@
 
 (define-erc-response-handler (PING)
   "Handle ping messages." nil
-  (let ((pinger (first (erc-response.command-args parsed))))
+  (let ((pinger (car (erc-response.command-args parsed))))
     (erc-log (format "PING: %s" pinger))
     ;; ping response to the server MUST be forced, or you can lose big
     (erc-server-send (format "PONG :%s" pinger) t)
@@ -1379,7 +1379,7 @@
       (when erc-verbose-server-ping
         (erc-display-message
          parsed 'notice proc 'PONG
-         ?h (first (erc-response.command-args parsed)) ?i erc-server-lag
+         ?h (car (erc-response.command-args parsed)) ?i erc-server-lag
          ?s (if (/= erc-server-lag 1) "s" "")))
       (erc-update-mode-line))))
 
@@ -1451,8 +1451,8 @@
   "Another user has quit IRC." nil
   (let ((reason (erc-response.contents parsed))
         bufs)
-    (multiple-value-bind (nick login host)
-        (values-list (erc-parse-user (erc-response.sender parsed)))
+    (pcase-let ((`(,nick ,login ,host)
+                 (erc-parse-user (erc-response.sender parsed))))
       (setq bufs (erc-buffer-list-with-nick nick proc))
       (erc-remove-user nick)
       (setq reason (erc-wash-quit-reason reason nick login host))
@@ -1462,12 +1462,12 @@
 
 (define-erc-response-handler (TOPIC)
   "The channel topic has changed." nil
-  (let* ((ch (first (erc-response.command-args parsed)))
+  (let* ((ch (car (erc-response.command-args parsed)))
          (topic (erc-trim-string (erc-response.contents parsed)))
          (time (format-time-string erc-server-timestamp-format
                                    (current-time))))
-    (multiple-value-bind (nick login host)
-        (values-list (erc-parse-user (erc-response.sender parsed)))
+    (pcase-let ((`(,nick ,login ,host)
+                 (erc-parse-user (erc-response.sender parsed))))
       (erc-update-channel-member ch nick nick nil nil nil host login)
       (erc-update-channel-topic ch (format "%s\C-o (%s, %s)" topic nick time))
       (erc-display-message parsed 'notice (erc-get-buffer ch proc)
@@ -1477,8 +1477,8 @@
 (define-erc-response-handler (WALLOPS)
   "Display a WALLOPS message." nil
   (let ((message (erc-response.contents parsed)))
-    (multiple-value-bind (nick login host)
-        (values-list (erc-parse-user (erc-response.sender parsed)))
+    (pcase-let ((`(,nick ,login ,host)
+                 (erc-parse-user (erc-response.sender parsed))))
       (erc-display-message
        parsed 'notice nil
        'WALLOPS ?n nick ?m message))))
@@ -1486,7 +1486,7 @@
 (define-erc-response-handler (001)
   "Set `erc-server-current-nick' to reflect server settings and display the 
welcome message."
   nil
-  (erc-set-current-nick (first (erc-response.command-args parsed)))
+  (erc-set-current-nick (car (erc-response.command-args parsed)))
   (erc-update-mode-line)                ; needed here?
   (setq erc-nick-change-attempt-count 0)
   (setq erc-default-nicks (if (consp erc-nick) erc-nick (list erc-nick)))
@@ -1507,16 +1507,16 @@
 
 (define-erc-response-handler (004)
   "Display the server's identification." nil
-  (multiple-value-bind (server-name server-version)
-      (values-list (cdr (erc-response.command-args parsed)))
+  (pcase-let ((`(,server-name ,server-version)
+               (cdr (erc-response.command-args parsed))))
     (setq erc-server-version server-version)
     (setq erc-server-announced-name server-name)
     (erc-update-mode-line-buffer (process-buffer proc))
     (erc-display-message
      parsed 'notice proc
      's004 ?s server-name ?v server-version
-     ?U (fourth (erc-response.command-args parsed))
-     ?C (fifth (erc-response.command-args parsed)))))
+     ?U (nth 3 (erc-response.command-args parsed))
+     ?C (nth 4 (erc-response.command-args parsed)))))
 
 (define-erc-response-handler (005)
   "Set the variable `erc-server-parameters' and display the received message.
@@ -1547,7 +1547,7 @@
 
 (define-erc-response-handler (221)
   "Display the current user modes." nil
-  (let* ((nick (first (erc-response.command-args parsed)))
+  (let* ((nick (car (erc-response.command-args parsed)))
          (modes (mapconcat 'identity
                            (cdr (erc-response.command-args parsed)) " ")))
     (erc-set-modes nick modes)
@@ -1576,8 +1576,8 @@
 
 (define-erc-response-handler (275)
   "Display secure connection message." nil
-  (multiple-value-bind (nick user message)
-      (values-list (cdr (erc-response.command-args parsed)))
+  (pcase-let ((`(,nick ,user ,message)
+               (cdr (erc-response.command-args parsed))))
     (erc-display-message
      parsed 'notice 'active 's275
      ?n nick
@@ -1612,8 +1612,8 @@
 
 (define-erc-response-handler (307)
   "Display nick-identified message." nil
-  (multiple-value-bind (nick user message)
-      (values-list (cdr (erc-response.command-args parsed)))
+  (pcase-let ((`(,nick ,user ,message)
+               (cdr (erc-response.command-args parsed))))
     (erc-display-message
      parsed 'notice 'active 's307
      ?n nick
@@ -1624,8 +1624,8 @@
   "WHOIS/WHOWAS notices." nil
   (let ((fname (erc-response.contents parsed))
         (catalog-entry (intern (format "s%s" (erc-response.command parsed)))))
-    (multiple-value-bind (nick user host)
-        (values-list (cdr (erc-response.command-args parsed)))
+    (pcase-let ((`(,nick ,user ,host)
+                 (cdr (erc-response.command-args parsed))))
       (erc-update-user-nick nick nick host nil fname user)
       (erc-display-message
        parsed 'notice 'active catalog-entry
@@ -1633,8 +1633,8 @@
 
 (define-erc-response-handler (312)
   "Server name response in WHOIS." nil
-  (multiple-value-bind (nick server-host)
-      (values-list (cdr (erc-response.command-args parsed)))
+  (pcase-let ((`(,nick ,server-host))
+              (cdr (erc-response.command-args parsed)))
     (erc-display-message
      parsed 'notice 'active 's312
      ?n nick ?s server-host ?c (erc-response.contents parsed))))
@@ -1655,8 +1655,8 @@
 
 (define-erc-response-handler (317)
   "IDLE notice." nil
-  (multiple-value-bind (nick seconds-idle on-since time)
-      (values-list (cdr (erc-response.command-args parsed)))
+  (pcase-let ((`(,nick ,seconds-idle ,on-since ,time)
+               (cdr (erc-response.command-args parsed))))
     (setq time (when on-since
                  (format-time-string erc-server-timestamp-format
                                      (erc-string-to-emacs-time on-since))))
@@ -1696,16 +1696,16 @@
 (define-erc-response-handler (322)
   "LIST notice." nil
   (let ((topic (erc-response.contents parsed)))
-    (multiple-value-bind (channel num-users)
-        (values-list (cdr (erc-response.command-args parsed)))
+    (pcase-let ((`(,channel ,num-users)
+                 (cdr (erc-response.command-args parsed))))
       (add-to-list 'erc-channel-list (list channel))
       (erc-update-channel-topic channel topic))))
 
 (defun erc-server-322-message (proc parsed)
   "Display a message for the 322 event."
   (let ((topic (erc-response.contents parsed)))
-    (multiple-value-bind (channel num-users)
-        (values-list (cdr (erc-response.command-args parsed)))
+    (pcase-let ((`(,channel ,num-users)
+                 (cdr (erc-response.command-args parsed))))
       (erc-display-message
        parsed 'notice proc 's322
        ?c channel ?u num-users ?t (or topic "")))))
@@ -1732,7 +1732,7 @@
   "Channel creation date." nil
   (let ((channel (second (erc-response.command-args parsed)))
         (time (erc-string-to-emacs-time
-               (third (erc-response.command-args parsed)))))
+               (nth 2 (erc-response.command-args parsed)))))
     (erc-display-message
      parsed 'notice (erc-get-buffer channel proc)
      's329 ?c channel ?t (format-time-string erc-server-timestamp-format
@@ -1749,7 +1749,7 @@
   ;; authmsg == (aref parsed 5)
   ;; The guesses below are, well, just that. -- Lawrence 2004/05/10
   (let ((nick (second (erc-response.command-args parsed)))
-        (authaccount (third (erc-response.command-args parsed)))
+        (authaccount (nth 2 (erc-response.command-args parsed)))
         (authmsg (erc-response.contents parsed)))
     (erc-display-message parsed 'notice 'active 's330
                          ?n nick ?a authmsg ?i authaccount)))
@@ -1771,8 +1771,8 @@
 
 (define-erc-response-handler (333)
   "Who set the topic, and when." nil
-  (multiple-value-bind (channel nick time)
-      (values-list (cdr (erc-response.command-args parsed)))
+  (pcase-let ((`(,channel ,nick ,time)
+               (cdr (erc-response.command-args parsed))))
     (setq time (format-time-string erc-server-timestamp-format
                                    (erc-string-to-emacs-time time)))
     (erc-update-channel-topic channel
@@ -1784,15 +1784,15 @@
 (define-erc-response-handler (341)
   "Let user know when an INVITE attempt has been sent successfully."
   nil
-  (multiple-value-bind (nick channel)
-      (values-list (cdr (erc-response.command-args parsed)))
+  (pcase-let ((`(,nick ,channel)
+               (cdr (erc-response.command-args parsed))))
     (erc-display-message parsed 'notice (erc-get-buffer channel proc)
                          's341 ?n nick ?c channel)))
 
 (define-erc-response-handler (352)
   "WHO notice." nil
-  (multiple-value-bind (channel user host server nick away-flag)
-      (values-list (cdr (erc-response.command-args parsed)))
+  (pcase-let ((`(,channel ,user ,host ,server ,nick ,away-flag)
+               (cdr (erc-response.command-args parsed))))
     (let ((full-name (erc-response.contents parsed))
           hopcount)
       (when (string-match "\\(^[0-9]+ \\)\\(.*\\)$" full-name)
@@ -1806,7 +1806,7 @@
 
 (define-erc-response-handler (353)
   "NAMES notice." nil
-  (let ((channel (third (erc-response.command-args parsed)))
+  (let ((channel (nth 2 (erc-response.command-args parsed)))
         (users (erc-response.contents parsed)))
     (erc-display-message parsed 'notice (or (erc-get-buffer channel proc)
                                             'active)
@@ -1821,8 +1821,8 @@
 
 (define-erc-response-handler (367)
   "Channel ban list entries." nil
-  (multiple-value-bind (channel banmask setter time)
-      (values-list (cdr (erc-response.command-args parsed)))
+  (pcase-let ((`(,channel ,banmask ,setter ,time)
+               (cdr (erc-response.command-args parsed))))
     ;; setter and time are not standard
     (if setter
         (erc-display-message parsed 'notice 'active 's367-set-by
@@ -1845,8 +1845,8 @@
   ;; FIXME: Yet more magic numbers in original code, I'm guessing this
   ;; command takes two arguments, and doesn't have any "contents". --
   ;; Lawrence 2004/05/10
-  (multiple-value-bind (from to)
-      (values-list (cdr (erc-response.command-args parsed)))
+  (pcase-let ((`(,from ,to)
+               (cdr (erc-response.command-args parsed))))
     (erc-display-message parsed 'notice 'active
                          's379 ?c from ?f to)))
 
@@ -1855,7 +1855,7 @@
   (erc-display-message
    parsed 'notice 'active
    's391 ?s (second (erc-response.command-args parsed))
-   ?t (third (erc-response.command-args parsed))))
+   ?t (nth 2 (erc-response.command-args parsed))))
 
 (define-erc-response-handler (401)
   "No such nick/channel." nil

=== modified file 'lisp/erc/erc-capab.el'
--- a/lisp/erc/erc-capab.el     2012-10-06 01:04:53 +0000
+++ b/lisp/erc/erc-capab.el     2012-11-19 17:24:12 +0000
@@ -68,7 +68,6 @@
 ;;; Code:
 
 (require 'erc)
-(eval-when-compile (require 'cl))
 
 ;;; Customization:
 

=== modified file 'lisp/erc/erc-dcc.el'
--- a/lisp/erc/erc-dcc.el       2012-10-06 01:04:53 +0000
+++ b/lisp/erc/erc-dcc.el       2012-11-19 17:24:12 +0000
@@ -54,9 +54,7 @@
 ;;; Code:
 
 (require 'erc)
-(eval-when-compile
-  (require 'cl)
-  (require 'pcomplete))
+(eval-when-compile (require 'pcomplete))
 
 ;;;###autoload (autoload 'erc-dcc-mode "erc-dcc")
 (define-erc-module dcc nil
@@ -277,7 +275,7 @@
                    (* (nth 1 ips) 65536.0)
                    (* (nth 2 ips) 256.0)
                    (nth 3 ips))))
-      (if (interactive-p)
+      (if (called-interactively-p 'interactive)
           (message "%s is %.0f" ip res)
         (format "%.0f" res)))))
 
@@ -380,8 +378,8 @@
                 (with-no-warnings       ; obsolete since 23.1
                   (set-process-filter-multibyte process nil)))))
         (file-error
-         (unless (and (string= "Cannot bind server socket" (cadr err))
-                      (string= "address already in use" (caddr err)))
+         (unless (and (string= "Cannot bind server socket" (nth 1 err))
+                      (string= "address already in use" (nth 2 err)))
            (signal (car err) (cdr err)))
          (setq port (1+ port))
          (unless (< port upper)
@@ -434,38 +432,38 @@
   (pcomplete-here (append '("chat" "close" "get" "list")
                           (when (fboundp 'make-network-process) '("send"))))
   (pcomplete-here
-   (case (intern (downcase (pcomplete-arg 1)))
-     (chat (mapcar (lambda (elt) (plist-get elt :nick))
-                   (erc-remove-if-not
-                    #'(lambda (elt)
-                        (eq (plist-get elt :type) 'CHAT))
-                    erc-dcc-list)))
-     (close (erc-delete-dups
-             (mapcar (lambda (elt) (symbol-name (plist-get elt :type)))
-                     erc-dcc-list)))
-     (get (mapcar #'erc-dcc-nick
-                  (erc-remove-if-not
-                   #'(lambda (elt)
-                       (eq (plist-get elt :type) 'GET))
-                   erc-dcc-list)))
-     (send (pcomplete-erc-all-nicks))))
-  (pcomplete-here
-   (case (intern (downcase (pcomplete-arg 2)))
-     (get (mapcar (lambda (elt) (plist-get elt :file))
-                  (erc-remove-if-not
-                   #'(lambda (elt)
-                       (and (eq (plist-get elt :type) 'GET)
-                            (erc-nick-equal-p (erc-extract-nick
-                                               (plist-get elt :nick))
-                                              (pcomplete-arg 1))))
-                   erc-dcc-list)))
-     (close (mapcar #'erc-dcc-nick
+   (pcase (intern (downcase (pcomplete-arg 1)))
+     (`chat (mapcar (lambda (elt) (plist-get elt :nick))
                     (erc-remove-if-not
                      #'(lambda (elt)
-                         (eq (plist-get elt :type)
-                             (intern (upcase (pcomplete-arg 1)))))
+                         (eq (plist-get elt :type) 'CHAT))
                      erc-dcc-list)))
-     (send (pcomplete-entries)))))
+     (`close (erc-delete-dups
+              (mapcar (lambda (elt) (symbol-name (plist-get elt :type)))
+                      erc-dcc-list)))
+     (`get (mapcar #'erc-dcc-nick
+                   (erc-remove-if-not
+                    #'(lambda (elt)
+                        (eq (plist-get elt :type) 'GET))
+                    erc-dcc-list)))
+     (`send (pcomplete-erc-all-nicks))))
+  (pcomplete-here
+   (pcase (intern (downcase (pcomplete-arg 2)))
+     (`get (mapcar (lambda (elt) (plist-get elt :file))
+                   (erc-remove-if-not
+                    #'(lambda (elt)
+                        (and (eq (plist-get elt :type) 'GET)
+                             (erc-nick-equal-p (erc-extract-nick
+                                                (plist-get elt :nick))
+                                               (pcomplete-arg 1))))
+                    erc-dcc-list)))
+     (`close (mapcar #'erc-dcc-nick
+                     (erc-remove-if-not
+                      #'(lambda (elt)
+                          (eq (plist-get elt :type)
+                              (intern (upcase (pcomplete-arg 1)))))
+                      erc-dcc-list)))
+     (`send (pcomplete-entries)))))
 
 (defun erc-dcc-do-CHAT-command (proc &optional nick)
   (when nick
@@ -1248,7 +1246,7 @@
 
 (defun erc-dcc-no-such-nick (proc parsed)
   "Detect and handle no-such-nick replies from the IRC server."
-  (let* ((elt (erc-dcc-member :nick (second (erc-response.command-args parsed))
+  (let* ((elt (erc-dcc-member :nick (nth 1 (erc-response.command-args parsed))
                               :parent proc))
          (peer (plist-get elt :peer)))
     (when (or (and (processp peer) (not (eq (process-status peer) 'open)))

=== modified file 'lisp/erc/erc-ezbounce.el'
--- a/lisp/erc/erc-ezbounce.el  2012-10-06 01:04:53 +0000
+++ b/lisp/erc/erc-ezbounce.el  2012-11-19 17:24:12 +0000
@@ -26,7 +26,6 @@
 ;;; Code:
 
 (require 'erc)
-(eval-when-compile (require 'cl))
 
 (defgroup erc-ezbounce nil
   "Interface to the EZBounce IRC bouncer (a virtual IRC server)"

=== modified file 'lisp/erc/erc-join.el'
--- a/lisp/erc/erc-join.el      2012-10-06 01:04:53 +0000
+++ b/lisp/erc/erc-join.el      2012-11-19 17:24:12 +0000
@@ -34,7 +34,6 @@
 
 (require 'erc)
 (require 'auth-source)
-(eval-when-compile (require 'cl))
 
 (defgroup erc-autojoin nil
   "Enable autojoining."

=== modified file 'lisp/erc/erc-log.el'
--- a/lisp/erc/erc-log.el       2012-10-07 07:54:41 +0000
+++ b/lisp/erc/erc-log.el       2012-11-19 17:24:12 +0000
@@ -93,9 +93,7 @@
 ;;; Code:
 
 (require 'erc)
-(eval-when-compile
-  (require 'erc-networks)
-  (require 'cl))
+(eval-when-compile (require 'erc-networks))
 
 (defgroup erc-log nil
   "Logging facilities for ERC."
@@ -429,7 +427,8 @@
                                        file t 'nomessage))))
                  (let ((coding-system-for-write coding-system))
                    (write-region start end file t 'nomessage))))
-             (if (and erc-truncate-buffer-on-save (interactive-p))
+             (if (and erc-truncate-buffer-on-save
+                      (called-interactively-p 'interactive))
                  (progn
                    (let ((inhibit-read-only t)) (erase-buffer))
                    (move-marker erc-last-saved-position (point-max))

=== modified file 'lisp/erc/erc-match.el'
--- a/lisp/erc/erc-match.el     2012-10-06 01:04:53 +0000
+++ b/lisp/erc/erc-match.el     2012-11-19 17:24:12 +0000
@@ -35,7 +35,6 @@
 ;;; Code:
 
 (require 'erc)
-(eval-when-compile (require 'cl))
 
 ;; Customization:
 

=== modified file 'lisp/erc/erc-netsplit.el'
--- a/lisp/erc/erc-netsplit.el  2012-10-06 01:04:53 +0000
+++ b/lisp/erc/erc-netsplit.el  2012-11-19 17:24:12 +0000
@@ -31,7 +31,6 @@
 ;;; Code:
 
 (require 'erc)
-(eval-when-compile (require 'cl))
 
 (defgroup erc-netsplit nil
   "Netsplit detection tries to automatically figure when a
@@ -107,7 +106,7 @@
     (dolist (elt erc-netsplit-list)
       (if (member nick (nthcdr 3 elt))
          (progn
-           (if (not (caddr elt))
+           (if (not (nth 2 elt))
                (progn
                  (erc-display-message
                   parsed 'notice (process-buffer proc)
@@ -149,7 +148,7 @@
          ;; element for this netsplit exists already
          (progn
            (setcdr (nthcdr 2 ass) (cons nick (nthcdr 3 ass)))
-           (when (caddr ass) 
+           (when (nth 2 ass)
              ;; There was already a netjoin for this netsplit, it
              ;; seems like the old one didn't get finished...
              (erc-display-message 
@@ -194,7 +193,7 @@
         nil 'notice 'active
         'netsplit-wholeft ?s (car elt)
         ?n (mapconcat 'erc-extract-nick (nthcdr 3 elt) " ")
-        ?t (if (caddr elt)
+        ?t (if (nth 2 elt)
                "(joining)"
              "")))))
   t)

=== modified file 'lisp/erc/erc-networks.el'
--- a/lisp/erc/erc-networks.el  2012-10-06 01:04:53 +0000
+++ b/lisp/erc/erc-networks.el  2012-11-19 17:24:12 +0000
@@ -40,7 +40,7 @@
 ;;; Code:
 
 (require 'erc)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;; Variables
 
@@ -729,10 +729,10 @@
     (or
      ;; Loop through `erc-networks-alist' looking for a match.
      (let ((server (or erc-server-announced-name erc-session-server)))
-       (loop for (name matcher) in erc-networks-alist
-            when (and matcher
-                      (string-match (concat matcher "\\'") server))
-            do (return name)))
+       (cl-loop for (name matcher) in erc-networks-alist
+               when (and matcher
+                         (string-match (concat matcher "\\'") server))
+               do (cl-return name)))
      'Unknown)))
 
 (defun erc-network ()
@@ -789,8 +789,8 @@
       (cond ((numberp p)
             (push p result))
            ((listp p)
-            (setq result (nconc (loop for i from (cadr p) downto (car p)
-                                      collect i)
+            (setq result (nconc (cl-loop for i from (cadr p) downto (car p)
+                                         collect i)
                                 result)))))
     (nreverse result)))
 

=== modified file 'lisp/erc/erc-notify.el'
--- a/lisp/erc/erc-notify.el    2012-10-06 01:04:53 +0000
+++ b/lisp/erc/erc-notify.el    2012-11-19 17:24:12 +0000
@@ -30,9 +30,7 @@
 
 (require 'erc)
 (require 'erc-networks)
-(eval-when-compile
- (require 'cl)
- (require 'pcomplete))
+(eval-when-compile (require 'pcomplete))
 
 ;;;; Customizable variables
 

=== modified file 'lisp/erc/erc-pcomplete.el'
--- a/lisp/erc/erc-pcomplete.el 2012-10-06 01:04:53 +0000
+++ b/lisp/erc/erc-pcomplete.el 2012-11-19 17:24:12 +0000
@@ -43,7 +43,6 @@
 (require 'erc)
 (require 'erc-compat)
 (require 'time-date)
-(eval-when-compile (require 'cl))
 
 (defgroup erc-pcomplete nil
   "Programmable completion for ERC"

=== modified file 'lisp/erc/erc-services.el'
--- a/lisp/erc/erc-services.el  2012-10-06 01:04:53 +0000
+++ b/lisp/erc/erc-services.el  2012-11-19 17:24:12 +0000
@@ -62,7 +62,7 @@
 
 (require 'erc)
 (require 'erc-networks)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;; Customization:
 

=== modified file 'lisp/erc/erc-speedbar.el'
--- a/lisp/erc/erc-speedbar.el  2012-10-06 01:04:53 +0000
+++ b/lisp/erc/erc-speedbar.el  2012-11-19 17:24:12 +0000
@@ -38,7 +38,6 @@
 (require 'erc)
 (require 'speedbar)
 (condition-case nil (require 'dframe) (error nil))
-(eval-when-compile (require 'cl))
 
 ;;; Customization:
 

=== modified file 'lisp/erc/erc-track.el'
--- a/lisp/erc/erc-track.el     2012-10-06 01:04:53 +0000
+++ b/lisp/erc/erc-track.el     2012-11-19 17:24:12 +0000
@@ -34,7 +34,7 @@
 ;; * Add extensibility so that custom functions can track
 ;;   custom modification types.
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'erc)
 (require 'erc-compat)
 (require 'erc-match)
@@ -484,7 +484,7 @@
 
 ;;; Test:
 
-(assert
+(cl-assert
  (and
   ;; verify examples from the doc strings
   (equal (let ((erc-track-shorten-aggressively nil))
@@ -869,7 +869,7 @@
   (setq erc-modified-channels-alist
        (delete (assq buffer erc-modified-channels-alist)
                erc-modified-channels-alist))
-  (when (interactive-p)
+  (when (called-interactively-p 'interactive)
     (erc-modified-channels-display)))
 
 (defun erc-track-find-face (faces)
@@ -980,7 +980,7 @@
        (add-to-list 'faces cur)))
     faces))
 
-(assert
+(cl-assert
  (let ((str "is bold"))
    (put-text-property 3 (length str)
                      'face '(bold erc-current-nick-face)
@@ -1030,17 +1030,17 @@
   (let ((dir erc-track-switch-direction)
        offset)
     (when (< arg 0)
-      (setq dir (case dir
-                 (oldest      'newest)
-                 (newest      'oldest)
-                 (mostactive  'leastactive)
-                 (leastactive 'mostactive)
-                 (importance  'oldest)))
+      (setq dir (pcase dir
+                 (`oldest      'newest)
+                 (`newest      'oldest)
+                 (`mostactive  'leastactive)
+                 (`leastactive 'mostactive)
+                 (`importance  'oldest)))
       (setq arg (- arg)))
-    (setq offset (case dir
-                  ((oldest leastactive)
+    (setq offset (pcase dir
+                  ((or `oldest `leastactive)
                    (- (length erc-modified-channels-alist) arg))
-                  (t (1- arg))))
+                  (_ (1- arg))))
     ;; normalize out of range user input
     (cond ((>= offset (length erc-modified-channels-alist))
           (setq offset (1- (length erc-modified-channels-alist))))

=== modified file 'lisp/erc/erc.el'
--- a/lisp/erc/erc.el   2012-11-13 03:40:44 +0000
+++ b/lisp/erc/erc.el   2012-11-19 17:24:12 +0000
@@ -67,7 +67,7 @@
 (defconst erc-version-string "Version 5.3"
   "ERC version.  This is used by function `erc-version'.")
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'font-lock)
 (require 'pp)
 (require 'thingatpt)
@@ -369,7 +369,7 @@
         (with-current-buffer ,buffer
           ,@body)))))
 
-(defstruct (erc-server-user (:type vector) :named)
+(cl-defstruct (erc-server-user (:type vector) :named)
   ;; User data
   nickname host login full-name info
   ;; Buffers
@@ -379,7 +379,7 @@
   (buffers nil)
   )
 
-(defstruct (erc-channel-user (:type vector) :named)
+(cl-defstruct (erc-channel-user (:type vector) :named)
   op voice
   ;; Last message time (in the form of the return value of
   ;; (current-time)
@@ -1386,7 +1386,7 @@
          t))
       (erc-server-send (format "ISON %s" nick))
       (while (eq erc-online-p 'unknown) (accept-process-output))
-      (if (interactive-p)
+      (if (called-interactively-p 'interactive)
          (message "%s is %sonline"
                   (or erc-online-p nick)
                   (if erc-online-p "" "not "))
@@ -2157,11 +2157,11 @@
     (list :server server :port port :nick nick :password passwd)))
 
 ;;;###autoload
-(defun* erc (&key (server (erc-compute-server))
-                 (port   (erc-compute-port))
-                 (nick   (erc-compute-nick))
-                 password
-                 (full-name (erc-compute-full-name)))
+(cl-defun erc (&key (server (erc-compute-server))
+                   (port   (erc-compute-port))
+                   (nick   (erc-compute-nick))
+                   password
+                   (full-name (erc-compute-full-name)))
   "ERC is a powerful, modular, and extensible IRC client.
 This function is the main entry point for ERC.
 
@@ -2383,24 +2383,24 @@
       (while list
        (setq elt (car list))
        (cond ((integerp elt)           ; POSITION
-              (incf (car list) shift))
+              (cl-incf (car list) shift))
              ((or (atom elt)           ; nil, EXTENT
                   ;; (eq t (car elt))  ; (t . TIME)
                   (markerp (car elt))) ; (MARKER . DISTANCE)
               nil)
              ((integerp (car elt))     ; (BEGIN . END)
-              (incf (car elt) shift)
-              (incf (cdr elt) shift))
+              (cl-incf (car elt) shift)
+              (cl-incf (cdr elt) shift))
              ((stringp (car elt))      ; (TEXT . POSITION)
-              (incf (cdr elt) (* (if (natnump (cdr elt)) 1 -1) shift)))
+              (cl-incf (cdr elt) (* (if (natnump (cdr elt)) 1 -1) shift)))
              ((null (car elt))         ; (nil PROPERTY VALUE BEG . END)
               (let ((cons (nthcdr 3 elt)))
-                (incf (car cons) shift)
-                (incf (cdr cons) shift)))
+                (cl-incf (car cons) shift)
+                (cl-incf (cdr cons) shift)))
              ((and (featurep 'xemacs)
                    (extentp (car elt))) ; (EXTENT START END)
-              (incf (nth 1 elt) shift)
-              (incf (nth 2 elt) shift)))
+              (cl-incf (nth 1 elt) shift)
+              (cl-incf (nth 2 elt) shift)))
        (setq list (cdr list))))))
 
 (defvar erc-valid-nick-regexp "[]a-zA-Z^[;\\`_{}|][]^[;\\`_{}|a-zA-Z0-9-]*"
@@ -2477,6 +2477,13 @@
   :group 'erc-lurker
   :type 'boolean)
 
+(defcustom erc-lurker-ignore-chars "`_"
+  "Characters at the end of a nick to strip for activity tracking purposes.
+
+See also `erc-lurker-trim-nicks'."
+  :group 'erc-lurker
+  :type 'string)
+
 (defun erc-lurker-maybe-trim (nick)
   "Maybe trim trailing `erc-lurker-ignore-chars' from NICK.
 
@@ -2491,13 +2498,6 @@
        "" nick)
     nick))
 
-(defcustom erc-lurker-ignore-chars "`_"
-  "Characters at the end of a nick to strip for activity tracking purposes.
-
-See also `erc-lurker-trim-nicks'."
-  :group 'erc-lurker
-  :type 'string)
-
 (defcustom erc-lurker-hide-list nil
   "List of IRC type messages to hide when sent by lurkers.
 
@@ -2580,7 +2580,8 @@
            (server
             (erc-canonicalize-server-name erc-server-announced-name)))
       (when (equal command "PRIVMSG")
-        (when (>= (incf erc-lurker-cleanup-count) erc-lurker-cleanup-interval)
+        (when (>= (cl-incf erc-lurker-cleanup-count)
+                 erc-lurker-cleanup-interval)
           (setq erc-lurker-cleanup-count 0)
           (erc-lurker-cleanup))
         (unless (gethash server erc-lurker-state)
@@ -2605,6 +2606,17 @@
              (time-subtract (current-time) last-PRIVMSG-time))
            erc-lurker-threshold-time))))
 
+(defcustom erc-common-server-suffixes
+  '(("openprojects.net$" . "OPN")
+    ("freenode.net$" . "freenode")
+    ("oftc.net$" . "OFTC"))
+  "Alist of common server name suffixes.
+This variable is used in mode-line display to save screen
+real estate.  Set it to nil if you want to avoid changing
+displayed hostnames."
+  :group 'erc-mode-line-and-header
+  :type 'alist)
+
 (defun erc-canonicalize-server-name (server)
   "Returns the canonical network name for SERVER if any,
 otherwise `erc-server-announced-name'.  SERVER is matched against
@@ -3115,37 +3127,37 @@
       (add-to-list 'symlist
                   (cons (erc-once-with-server-event
                          311 `(string= ,nick
-                                       (second
+                                       (nth 1
                                         (erc-response.command-args parsed))))
                         'erc-server-311-functions))
       (add-to-list 'symlist
                   (cons (erc-once-with-server-event
                          312 `(string= ,nick
-                                       (second
+                                       (nth 1
                                         (erc-response.command-args parsed))))
                         'erc-server-312-functions))
       (add-to-list 'symlist
                   (cons (erc-once-with-server-event
                          318 `(string= ,nick
-                                       (second
+                                       (nth 1
                                         (erc-response.command-args parsed))))
                         'erc-server-318-functions))
       (add-to-list 'symlist
                   (cons (erc-once-with-server-event
                          319 `(string= ,nick
-                                       (second
+                                       (nth 1
                                         (erc-response.command-args parsed))))
                         'erc-server-319-functions))
       (add-to-list 'symlist
                   (cons (erc-once-with-server-event
                          320 `(string= ,nick
-                                       (second
+                                       (nth 1
                                         (erc-response.command-args parsed))))
                         'erc-server-320-functions))
       (add-to-list 'symlist
                   (cons (erc-once-with-server-event
                          330 `(string= ,nick
-                                       (second
+                                       (nth 1
                                         (erc-response.command-args parsed))))
                         'erc-server-330-functions))
       (add-to-list 'symlist
@@ -4328,8 +4340,8 @@
 
 (defun erc-banlist-store (proc parsed)
   "Record ban entries for a channel."
-  (multiple-value-bind (channel mask whoset)
-      (values-list (cdr (erc-response.command-args parsed)))
+  (pcase-let ((`(,channel ,mask ,whoset)
+              (cdr (erc-response.command-args parsed))))
     ;; Determine to which buffer the message corresponds
     (let ((buffer (erc-get-buffer channel proc)))
       (with-current-buffer buffer
@@ -4340,7 +4352,7 @@
 
 (defun erc-banlist-finished (proc parsed)
   "Record that we have received the banlist."
-  (let* ((channel (second (erc-response.command-args parsed)))
+  (let* ((channel (nth 1 (erc-response.command-args parsed)))
         (buffer (erc-get-buffer channel proc)))
     (with-current-buffer buffer
       (put 'erc-channel-banlist 'received-from-server t)))
@@ -4349,7 +4361,7 @@
 (defun erc-banlist-update (proc parsed)
   "Check MODE commands for bans and update the banlist appropriately."
   ;; FIXME: Possibly incorrect. -- Lawrence 2004-05-11
-  (let* ((tgt (first (erc-response.command-args parsed)))
+  (let* ((tgt (car (erc-response.command-args parsed)))
         (mode (erc-response.contents parsed))
         (whoset (erc-response.sender parsed))
         (buffer (erc-get-buffer tgt proc)))
@@ -6000,7 +6012,7 @@
       (if cuser
          (setq op (erc-channel-user-op cuser)
                voice (erc-channel-user-voice cuser)))
-      (if (interactive-p)
+      (if (called-interactively-p 'interactive)
          (message "%s is address@hidden"
                   nick login host
                   (if full-name (format " (%s)" full-name) "")
@@ -6088,17 +6100,6 @@
   :group 'erc-paranoia
   :type 'boolean)
 
-(defcustom erc-common-server-suffixes
-  '(("openprojects.net$" . "OPN")
-    ("freenode.net$" . "freenode")
-    ("oftc.net$" . "OFTC"))
-  "Alist of common server name suffixes.
-This variable is used in mode-line display to save screen
-real estate.  Set it to nil if you want to avoid changing
-displayed hostnames."
-  :group 'erc-mode-line-and-header
-  :type 'alist)
-
 (defcustom erc-mode-line-away-status-format
   "(AWAY since %a %b %d %H:%M) "
   "When you're away on a server, this is shown in the mode line.
@@ -6302,7 +6303,7 @@
         (format "ERC %s (GNU Emacs %s)" erc-version-string emacs-version)))
     (if here
        (insert version-string)
-      (if (interactive-p)
+      (if (called-interactively-p 'interactive)
          (message "%s" version-string)
        version-string))))
 
@@ -6322,7 +6323,7 @@
                    ", ")))
     (if here
        (insert string)
-      (if (interactive-p)
+      (if (called-interactively-p 'interactive)
          (message "%s" string)
        string))))
 

=== modified file 'lisp/json.el'
--- a/lisp/json.el      2012-09-27 22:55:03 +0000
+++ b/lisp/json.el      2012-11-19 17:24:12 +0000
@@ -51,7 +51,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 
 ;; Compatibility code
 

=== modified file 'test/ChangeLog'
--- a/test/ChangeLog    2012-11-14 12:17:21 +0000
+++ b/test/ChangeLog    2012-11-19 17:24:12 +0000
@@ -1,3 +1,8 @@
+2012-11-19  Stefan Monnier  <address@hidden>
+
+       * automated/ert-x-tests.el: Use cl-lib.
+       * automated/ert-tests.el: Use lexical-binding and cl-lib.
+
 2012-11-14  Dmitry Gutov  <address@hidden>
 
        * automated/ruby-mode-tests.el (ruby-indent-singleton-class): Pass.
@@ -5,8 +10,8 @@
        (ruby-indent-inside-heredoc-after-space): New tests.
        Change direct font-lock face references to var references.
        (ruby-interpolation-suppresses-syntax-inside): New test.
-       (ruby-interpolation-inside-percent-literal-with-paren): New
-       failing test.
+       (ruby-interpolation-inside-percent-literal-with-paren):
+       New failing test.
 
 2012-11-13  Dmitry Gutov  <address@hidden>
 

=== modified file 'test/automated/ert-tests.el'
--- a/test/automated/ert-tests.el       2012-01-05 09:46:05 +0000
+++ b/test/automated/ert-tests.el       2012-11-19 17:24:12 +0000
@@ -1,4 +1,4 @@
-;;; ert-tests.el --- ERT's self-tests
+;;; ert-tests.el --- ERT's self-tests  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2007-2008, 2010-2012 Free Software Foundation, Inc.
 
@@ -27,7 +27,7 @@
 ;;; Code:
 
 (eval-when-compile
-  (require 'cl))
+  (require 'cl-lib))
 (require 'ert)
 
 
@@ -45,7 +45,7 @@
       ;; The buffer name chosen here should not compete with the default
       ;; results buffer name for completion in `switch-to-buffer'.
       (let ((stats (ert-run-tests-interactively "^ert-" " *ert self-tests*")))
-        (assert ert--test-body-was-run)
+        (cl-assert ert--test-body-was-run)
         (if (zerop (ert-stats-completed-unexpected stats))
             ;; Hide results window only when everything went well.
             (set-window-configuration window-configuration)
@@ -71,26 +71,26 @@
 
 (ert-deftest ert-test-nested-test-body-runs ()
   "Test that nested test bodies run."
-  (lexical-let ((was-run nil))
+  (let ((was-run nil))
     (let ((test (make-ert-test :body (lambda ()
                                        (setq was-run t)))))
-      (assert (not was-run))
+      (cl-assert (not was-run))
       (ert-run-test test)
-      (assert was-run))))
+      (cl-assert was-run))))
 
 
 ;;; Test that pass/fail works.
 (ert-deftest ert-test-pass ()
   (let ((test (make-ert-test :body (lambda ()))))
     (let ((result (ert-run-test test)))
-      (assert (ert-test-passed-p result)))))
+      (cl-assert (ert-test-passed-p result)))))
 
 (ert-deftest ert-test-fail ()
   (let ((test (make-ert-test :body (lambda () (ert-fail "failure message")))))
     (let ((result (let ((ert-debug-on-error nil))
                     (ert-run-test test))))
-      (assert (ert-test-failed-p result) t)
-      (assert (equal (ert-test-result-with-condition-condition result)
+      (cl-assert (ert-test-failed-p result) t)
+      (cl-assert (equal (ert-test-result-with-condition-condition result)
                      '(ert-test-failed "failure message"))
               t))))
 
@@ -100,50 +100,50 @@
         (progn
           (let ((ert-debug-on-error t))
             (ert-run-test test))
-          (assert nil))
+          (cl-assert nil))
       ((error)
-       (assert (equal condition '(ert-test-failed "failure message")) t)))))
+       (cl-assert (equal condition '(ert-test-failed "failure message")) t)))))
 
 (ert-deftest ert-test-fail-debug-with-debugger-1 ()
   (let ((test (make-ert-test :body (lambda () (ert-fail "failure message")))))
-    (let ((debugger (lambda (&rest debugger-args)
-                      (assert nil))))
+    (let ((debugger (lambda (&rest _args)
+                      (cl-assert nil))))
       (let ((ert-debug-on-error nil))
         (ert-run-test test)))))
 
 (ert-deftest ert-test-fail-debug-with-debugger-2 ()
   (let ((test (make-ert-test :body (lambda () (ert-fail "failure message")))))
-    (block nil
-      (let ((debugger (lambda (&rest debugger-args)
-                        (return-from nil nil))))
+    (cl-block nil
+      (let ((debugger (lambda (&rest _args)
+                        (cl-return-from nil nil))))
         (let ((ert-debug-on-error t))
           (ert-run-test test))
-        (assert nil)))))
+        (cl-assert nil)))))
 
 (ert-deftest ert-test-fail-debug-nested-with-debugger ()
   (let ((test (make-ert-test :body (lambda ()
                                      (let ((ert-debug-on-error t))
                                        (ert-fail "failure message"))))))
-    (let ((debugger (lambda (&rest debugger-args)
-                      (assert nil nil "Assertion a"))))
+    (let ((debugger (lambda (&rest _args)
+                      (cl-assert nil nil "Assertion a"))))
       (let ((ert-debug-on-error nil))
         (ert-run-test test))))
   (let ((test (make-ert-test :body (lambda ()
                                      (let ((ert-debug-on-error nil))
                                        (ert-fail "failure message"))))))
-    (block nil
-      (let ((debugger (lambda (&rest debugger-args)
-                        (return-from nil nil))))
+    (cl-block nil
+      (let ((debugger (lambda (&rest _args)
+                        (cl-return-from nil nil))))
         (let ((ert-debug-on-error t))
           (ert-run-test test))
-        (assert nil nil "Assertion b")))))
+        (cl-assert nil nil "Assertion b")))))
 
 (ert-deftest ert-test-error ()
   (let ((test (make-ert-test :body (lambda () (error "Error message")))))
     (let ((result (let ((ert-debug-on-error nil))
                     (ert-run-test test))))
-      (assert (ert-test-failed-p result) t)
-      (assert (equal (ert-test-result-with-condition-condition result)
+      (cl-assert (ert-test-failed-p result) t)
+      (cl-assert (equal (ert-test-result-with-condition-condition result)
                      '(error "Error message"))
               t))))
 
@@ -153,9 +153,9 @@
         (progn
           (let ((ert-debug-on-error t))
             (ert-run-test test))
-          (assert nil))
+          (cl-assert nil))
       ((error)
-       (assert (equal condition '(error "Error message")) t)))))
+       (cl-assert (equal condition '(error "Error message")) t)))))
 
 
 ;;; Test that `should' works.
@@ -163,13 +163,13 @@
   (let ((test (make-ert-test :body (lambda () (should nil)))))
     (let ((result (let ((ert-debug-on-error nil))
                     (ert-run-test test))))
-      (assert (ert-test-failed-p result) t)
-      (assert (equal (ert-test-result-with-condition-condition result)
+      (cl-assert (ert-test-failed-p result) t)
+      (cl-assert (equal (ert-test-result-with-condition-condition result)
                      '(ert-test-failed ((should nil) :form nil :value nil)))
               t)))
   (let ((test (make-ert-test :body (lambda () (should t)))))
     (let ((result (ert-run-test test)))
-      (assert (ert-test-passed-p result) t))))
+      (cl-assert (ert-test-passed-p result) t))))
 
 (ert-deftest ert-test-should-value ()
   (should (eql (should 'foo) 'foo))
@@ -179,17 +179,18 @@
   (let ((test (make-ert-test :body (lambda () (should-not t)))))
     (let ((result (let ((ert-debug-on-error nil))
                     (ert-run-test test))))
-      (assert (ert-test-failed-p result) t)
-      (assert (equal (ert-test-result-with-condition-condition result)
+      (cl-assert (ert-test-failed-p result) t)
+      (cl-assert (equal (ert-test-result-with-condition-condition result)
                      '(ert-test-failed ((should-not t) :form t :value t)))
               t)))
   (let ((test (make-ert-test :body (lambda () (should-not nil)))))
     (let ((result (ert-run-test test)))
-      (assert (ert-test-passed-p result)))))
+      (cl-assert (ert-test-passed-p result)))))
+
 
 (ert-deftest ert-test-should-with-macrolet ()
   (let ((test (make-ert-test :body (lambda ()
-                                     (macrolet ((foo () `(progn t nil)))
+                                     (cl-macrolet ((foo () `(progn t nil)))
                                        (should (foo)))))))
     (let ((result (let ((ert-debug-on-error nil))
                     (ert-run-test test))))
@@ -303,32 +304,33 @@
 
 (ert-deftest ert-test-should-failure-debugging ()
   "Test that `should' errors contain the information we expect them to."
-  (loop for (body expected-condition) in
-        `((,(lambda () (let ((x nil)) (should x)))
-           (ert-test-failed ((should x) :form x :value nil)))
-          (,(lambda () (let ((x t)) (should-not x)))
-           (ert-test-failed ((should-not x) :form x :value t)))
-          (,(lambda () (let ((x t)) (should (not x))))
-           (ert-test-failed ((should (not x)) :form (not t) :value nil)))
-          (,(lambda () (let ((x nil)) (should-not (not x))))
-           (ert-test-failed ((should-not (not x)) :form (not nil) :value t)))
-          (,(lambda () (let ((x t) (y nil)) (should-not
-                                             (ert--test-my-list x y))))
-           (ert-test-failed
-            ((should-not (ert--test-my-list x y))
-             :form (list t nil)
-             :value (t nil))))
-          (,(lambda () (let ((x t)) (should (error "Foo"))))
-           (error "Foo")))
-        do
-        (let ((test (make-ert-test :body body)))
-          (condition-case actual-condition
-              (progn
-                (let ((ert-debug-on-error t))
-                  (ert-run-test test))
-                (assert nil))
-            ((error)
-             (should (equal actual-condition expected-condition)))))))
+  (cl-loop
+   for (body expected-condition) in
+   `((,(lambda () (let ((x nil)) (should x)))
+      (ert-test-failed ((should x) :form x :value nil)))
+     (,(lambda () (let ((x t)) (should-not x)))
+      (ert-test-failed ((should-not x) :form x :value t)))
+     (,(lambda () (let ((x t)) (should (not x))))
+      (ert-test-failed ((should (not x)) :form (not t) :value nil)))
+     (,(lambda () (let ((x nil)) (should-not (not x))))
+      (ert-test-failed ((should-not (not x)) :form (not nil) :value t)))
+     (,(lambda () (let ((x t) (y nil)) (should-not
+                                   (ert--test-my-list x y))))
+      (ert-test-failed
+       ((should-not (ert--test-my-list x y))
+        :form (list t nil)
+        :value (t nil))))
+     (,(lambda () (let ((_x t)) (should (error "Foo"))))
+      (error "Foo")))
+   do
+   (let ((test (make-ert-test :body body)))
+     (condition-case actual-condition
+         (progn
+           (let ((ert-debug-on-error t))
+             (ert-run-test test))
+           (cl-assert nil))
+       ((error)
+        (should (equal actual-condition expected-condition)))))))
 
 (ert-deftest ert-test-deftest ()
   (should (equal (macroexpand '(ert-deftest abc () "foo" :tags '(bar)))
@@ -520,7 +522,7 @@
     (setf (cdr (last a)) (cddr a))
     (should (not (ert--proper-list-p a))))
   (let ((a (list 1 2 3 4)))
-    (setf (cdr (last a)) (cdddr a))
+    (setf (cdr (last a)) (cl-cdddr a))
     (should (not (ert--proper-list-p a)))))
 
 (ert-deftest ert-test-parse-keys-and-body ()
@@ -657,14 +659,14 @@
         (i 0))
     (let ((result (ert--remove-if-not (lambda (x)
                                         (should (eql x (nth i list)))
-                                        (incf i)
+                                        (cl-incf i)
                                         (member i '(2 3)))
                                       list)))
       (should (equal i 4))
       (should (equal result '(b c)))
       (should (equal list '(a b c d)))))
   (should (equal '()
-                 (ert--remove-if-not (lambda (x) (should nil)) '()))))
+                 (ert--remove-if-not (lambda (_x) (should nil)) '()))))
 
 (ert-deftest ert-test-remove* ()
   (let ((list (list 'a 'b 'c 'd))
@@ -676,13 +678,13 @@
                                 (should (eql x (nth key-index list)))
                                 (prog1
                                     (list key-index x)
-                                  (incf key-index)))
+                                  (cl-incf key-index)))
                          :test
                          (lambda (a b)
                            (should (eql a 'foo))
                            (should (equal b (list test-index
                                                   (nth test-index list))))
-                           (incf test-index)
+                           (cl-incf test-index)
                            (member test-index '(2 3))))))
       (should (equal key-index 4))
       (should (equal test-index 4))

=== modified file 'test/automated/ert-x-tests.el'
--- a/test/automated/ert-x-tests.el     2012-06-27 15:11:28 +0000
+++ b/test/automated/ert-x-tests.el     2012-11-19 17:24:12 +0000
@@ -28,7 +28,7 @@
 ;;; Code:
 
 (eval-when-compile
-  (require 'cl))
+  (require 'cl-lib))
 (require 'ert)
 (require 'ert-x)
 
@@ -233,8 +233,8 @@
       (should (equal (buffer-string) ""))
       (let ((message-log-max 2))
         (let ((message-log-max t))
-          (loop for i below 4 do
-                (message "%s" i))
+          (cl-loop for i below 4 do
+                   (message "%s" i))
           (should (equal (buffer-string) "0\n1\n2\n3\n")))
         (should (equal (buffer-string) "0\n1\n2\n3\n"))
         (message "")
@@ -244,28 +244,28 @@
 
 (ert-deftest ert-test-force-message-log-buffer-truncation ()
   :tags '(:causes-redisplay)
-  (labels ((body ()
-             (loop for i below 3 do
-                   (message "%s" i)))
-           ;; Uses the implicit messages buffer truncation implemented
-           ;; in Emacs' C core.
-           (c (x)
-             (ert-with-buffer-renamed ("*Messages*")
-               (let ((message-log-max x))
-                 (body))
-               (with-current-buffer "*Messages*"
-                 (buffer-string))))
-           ;; Uses our lisp reimplementation.
-           (lisp (x)
-             (ert-with-buffer-renamed ("*Messages*")
-               (let ((message-log-max t))
-                 (body))
-               (let ((message-log-max x))
-                 (ert--force-message-log-buffer-truncation))
-               (with-current-buffer "*Messages*"
-                 (buffer-string)))))
-    (loop for x in '(0 1 2 3 4 t) do
-          (should (equal (c x) (lisp x))))))
+  (cl-labels ((body ()
+                (cl-loop for i below 3 do
+                         (message "%s" i)))
+              ;; Uses the implicit messages buffer truncation implemented
+              ;; in Emacs' C core.
+              (c (x)
+                (ert-with-buffer-renamed ("*Messages*")
+                  (let ((message-log-max x))
+                    (body))
+                  (with-current-buffer "*Messages*"
+                    (buffer-string))))
+              ;; Uses our lisp reimplementation.
+              (lisp (x)
+                (ert-with-buffer-renamed ("*Messages*")
+                  (let ((message-log-max t))
+                    (body))
+                  (let ((message-log-max x))
+                    (ert--force-message-log-buffer-truncation))
+                  (with-current-buffer "*Messages*"
+                    (buffer-string)))))
+    (cl-loop for x in '(0 1 2 3 4 t) do
+             (should (equal (c x) (lisp x))))))
 
 
 (provide 'ert-x-tests)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]