emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111135: Further cleanup of the "cl-"


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111135: Further cleanup of the "cl-" namespace. Fit CL in 80 columns.
Date: Thu, 06 Dec 2012 16:29:29 -0500
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111135
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Thu 2012-12-06 16:29:29 -0500
message:
  Further cleanup of the "cl-" namespace.  Fit CL in 80 columns.
  * lisp/emacs-lisp/cl-macs.el (cl--pop2, cl--optimize-safety)
  (cl--optimize-speed, cl--not-toplevel, cl--parse-loop-clause)
  (cl--expand-do-loop, cl--proclaim-history, cl--declare-stack)
  (cl--do-proclaim, cl--proclaims-deferred): Rename from the "cl-" prefix.
  (cl-progv): Don't rely on dynamic scoping to find the body.
  * lisp/emacs-lisp/cl-lib.el (cl--optimize-speed, cl--optimize-safety)
  (cl--proclaims-deferred): Rename from the "cl-" prefix.
  (cl-declaim): Use backquotes.
  * lisp/emacs-lisp/cl-extra.el (cl-make-random-state, cl-random-state-p):
  Use "cl--" prefix for the object's tag.
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/cl-extra.el
  lisp/emacs-lisp/cl-lib.el
  lisp/emacs-lisp/cl-loaddefs.el
  lisp/emacs-lisp/cl-macs.el
  lisp/emacs-lisp/cl-seq.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-12-06 20:16:38 +0000
+++ b/lisp/ChangeLog    2012-12-06 21:29:29 +0000
@@ -1,5 +1,17 @@
 2012-12-06  Stefan Monnier  <address@hidden>
 
+       Further cleanup of the "cl-" namespace.  Fit CL in 80 columns.
+       * emacs-lisp/cl-macs.el (cl--pop2, cl--optimize-safety)
+       (cl--optimize-speed, cl--not-toplevel, cl--parse-loop-clause)
+       (cl--expand-do-loop, cl--proclaim-history, cl--declare-stack)
+       (cl--do-proclaim, cl--proclaims-deferred): Rename from the "cl-" prefix.
+       (cl-progv): Don't rely on dynamic scoping to find the body.
+       * emacs-lisp/cl-lib.el (cl--optimize-speed, cl--optimize-safety)
+       (cl--proclaims-deferred): Rename from the "cl-" prefix.
+       (cl-declaim): Use backquotes.
+       * emacs-lisp/cl-extra.el (cl-make-random-state, cl-random-state-p):
+       Use "cl--" prefix for the object's tag.
+
        * ses.el: Use advice-add/remove.
        (ses--advice-copy-region-as-kill, ses--advice-yank): New functions.
        (copy-region-as-kill, yank): Use advice-add.

=== modified file 'lisp/emacs-lisp/cl-extra.el'
--- a/lisp/emacs-lisp/cl-extra.el       2012-11-10 23:13:33 +0000
+++ b/lisp/emacs-lisp/cl-extra.el       2012-12-06 21:29:29 +0000
@@ -51,7 +51,8 @@
        ((eq type 'string) (if (stringp x) x (concat x)))
        ((eq type 'array) (if (arrayp x) x (vconcat x)))
        ((and (eq type 'character) (stringp x) (= (length x) 1)) (aref x 0))
-       ((and (eq type 'character) (symbolp x)) (cl-coerce (symbol-name x) 
type))
+       ((and (eq type 'character) (symbolp x))
+         (cl-coerce (symbol-name x) type))
        ((eq type 'float) (float x))
        ((cl-typep x type) x)
        (t (error "Can't coerce %s to type %s" x type))))
@@ -69,7 +70,7 @@
        ((stringp x)
         (and (stringp y) (= (length x) (length y))
              (or (string-equal x y)
-                 (string-equal (downcase x) (downcase y)))))   ; lazy but 
simple!
+                 (string-equal (downcase x) (downcase y))))) ;Lazy but simple!
        ((numberp x)
         (and (numberp y) (= x y)))
        ((consp x)
@@ -439,14 +440,14 @@
 If STATE is t, return a new state object seeded from the time of day."
   (cond ((null state) (cl-make-random-state cl--random-state))
        ((vectorp state) (copy-tree state t))
-       ((integerp state) (vector 'cl-random-state-tag -1 30 state))
+       ((integerp state) (vector 'cl--random-state-tag -1 30 state))
        (t (cl-make-random-state (cl--random-time)))))
 
 ;;;###autoload
 (defun cl-random-state-p (object)
   "Return t if OBJECT is a random-state object."
   (and (vectorp object) (= (length object) 4)
-       (eq (aref object 0) 'cl-random-state-tag)))
+       (eq (aref object 0) 'cl--random-state-tag)))
 
 
 ;; Implementation limits.

=== modified file 'lisp/emacs-lisp/cl-lib.el'
--- a/lisp/emacs-lisp/cl-lib.el 2012-11-18 01:52:36 +0000
+++ b/lisp/emacs-lisp/cl-lib.el 2012-12-06 21:29:29 +0000
@@ -93,8 +93,8 @@
 
 (require 'macroexp)
 
-(defvar cl-optimize-speed 1)
-(defvar cl-optimize-safety 1)
+(defvar cl--optimize-speed 1)
+(defvar cl--optimize-safety 1)
 
 ;;;###autoload
 (define-obsolete-variable-alias
@@ -248,23 +248,21 @@
           (equal (buffer-name (symbol-value 'byte-compile--outbuffer))
                  " *Compiler Output*"))))
 
-(defvar cl-proclaims-deferred nil)
+(defvar cl--proclaims-deferred nil)
 
 (defun cl-proclaim (spec)
   "Record a global declaration specified by SPEC."
-  (if (fboundp 'cl-do-proclaim) (cl-do-proclaim spec t)
-    (push spec cl-proclaims-deferred))
+  (if (fboundp 'cl--do-proclaim) (cl--do-proclaim spec t)
+    (push spec cl--proclaims-deferred))
   nil)
 
 (defmacro cl-declaim (&rest specs)
   "Like `cl-proclaim', but takes any number of unevaluated, unquoted arguments.
 Puts `(cl-eval-when (compile load eval) ...)' around the declarations
 so that they are registered at compile-time as well as run-time."
-  (let ((body (mapcar (function (lambda (x)
-                                  (list 'cl-proclaim (list 'quote x))))
-                     specs)))
-    (if (cl--compiling-file) (cl-list* 'cl-eval-when '(compile load eval) body)
-      (cons 'progn body))))   ; avoid loading cl-macs.el for cl-eval-when
+  (let ((body (mapcar (lambda (x) `(cl-proclaim ',x) specs))))
+    (if (cl--compiling-file) `(cl-eval-when (compile load eval) ,@body)
+      `(progn ,@body))))           ; Avoid loading cl-macs.el for cl-eval-when.
 
 
 ;;; Symbols.
@@ -301,7 +299,8 @@
   "Return t if INTEGER is even."
   (eq (logand integer 1) 0))
 
-(defvar cl--random-state (vector 'cl-random-state-tag -1 30 (cl--random-time)))
+(defvar cl--random-state
+  (vector 'cl--random-state-tag -1 30 (cl--random-time)))
 
 (defconst cl-most-positive-float nil
   "The largest value that a Lisp float can hold.

=== modified file 'lisp/emacs-lisp/cl-loaddefs.el'
--- a/lisp/emacs-lisp/cl-loaddefs.el    2012-11-27 11:18:12 +0000
+++ b/lisp/emacs-lisp/cl-loaddefs.el    2012-12-06 21:29:29 +0000
@@ -11,7 +11,7 @@
 ;;;;;;  cl--map-overlays cl--map-intervals cl--map-keymap-recursively
 ;;;;;;  cl-notevery cl-notany cl-every cl-some cl-mapcon cl-mapcan
 ;;;;;;  cl-mapl cl-mapc cl-maplist cl-map cl--mapcar-many cl-equalp
-;;;;;;  cl-coerce) "cl-extra" "cl-extra.el" "8e9fee941c465ac0fee9b92a92d64154")
+;;;;;;  cl-coerce) "cl-extra" "cl-extra.el" "3ee58411735a01dd1e1d3964fdcfae70")
 ;;; Generated autoloads from cl-extra.el
 
 (autoload 'cl-coerce "cl-extra" "\
@@ -224,7 +224,7 @@
 
 \(fn SYMBOL PROPNAME &optional DEFAULT)" nil nil)
 
-(put 'cl-get 'compiler-macro #'cl--compiler-macro-get)
+(eval-and-compile (put 'cl-get 'compiler-macro #'cl--compiler-macro-get))
 
 (autoload 'cl-getf "cl-extra" "\
 Search PROPLIST for property PROPNAME; return its value or DEFAULT.
@@ -267,7 +267,7 @@
 ;;;;;;  cl-typecase cl-ecase cl-case cl-load-time-value cl-eval-when
 ;;;;;;  cl-destructuring-bind cl-function cl-defmacro cl-defun cl-gentemp
 ;;;;;;  cl-gensym cl--compiler-macro-cXXr cl--compiler-macro-list*)
-;;;;;;  "cl-macs" "cl-macs.el" "3dd5e153133b2752fd52e45792c46dfe")
+;;;;;;  "cl-macs" "cl-macs.el" "5df0692d7c4bffb2cc353f802d94f796")
 ;;; Generated autoloads from cl-macs.el
 
 (autoload 'cl--compiler-macro-list* "cl-macs" "\
@@ -759,7 +759,7 @@
 ;;;;;;  cl-nsubstitute-if cl-nsubstitute cl-substitute-if-not cl-substitute-if
 ;;;;;;  cl-substitute cl-delete-duplicates cl-remove-duplicates 
cl-delete-if-not
 ;;;;;;  cl-delete-if cl-delete cl-remove-if-not cl-remove-if cl-remove
-;;;;;;  cl-replace cl-fill cl-reduce) "cl-seq" "cl-seq.el" 
"4c1e1191e82dc8d5449a5ec4d59efc10")
+;;;;;;  cl-replace cl-fill cl-reduce) "cl-seq" "cl-seq.el" 
"697d04e7ae0a9b9c15eea705b359b1bb")
 ;;; Generated autoloads from cl-seq.el
 
 (autoload 'cl-reduce "cl-seq" "\
@@ -1020,7 +1020,7 @@
 
 \(fn ITEM LIST [KEYWORD VALUE]...)" nil nil)
 
-(put 'cl-member 'compiler-macro #'cl--compiler-macro-member)
+(eval-and-compile (put 'cl-member 'compiler-macro #'cl--compiler-macro-member))
 
 (autoload 'cl-member-if "cl-seq" "\
 Find the first item satisfying PREDICATE in LIST.
@@ -1050,7 +1050,7 @@
 
 \(fn ITEM LIST [KEYWORD VALUE]...)" nil nil)
 
-(put 'cl-assoc 'compiler-macro #'cl--compiler-macro-assoc)
+(eval-and-compile (put 'cl-assoc 'compiler-macro #'cl--compiler-macro-assoc))
 
 (autoload 'cl-assoc-if "cl-seq" "\
 Find the first item whose car satisfies PREDICATE in LIST.

=== modified file 'lisp/emacs-lisp/cl-macs.el'
--- a/lisp/emacs-lisp/cl-macs.el        2012-11-27 03:10:32 +0000
+++ b/lisp/emacs-lisp/cl-macs.el        2012-12-06 21:29:29 +0000
@@ -48,13 +48,13 @@
 ;; `gv' is required here because cl-macs can be loaded before loaddefs.el.
 (require 'gv)
 
-(defmacro cl-pop2 (place)
+(defmacro cl--pop2 (place)
   (declare (debug edebug-sexps))
   `(prog1 (car (cdr ,place))
      (setq ,place (cdr (cdr ,place)))))
 
-(defvar cl-optimize-safety)
-(defvar cl-optimize-speed)
+(defvar cl--optimize-safety)
+(defvar cl--optimize-speed)
 
 ;;; Initialization.
 
@@ -431,7 +431,7 @@
     (if (memq '&environment args) (error "&environment used incorrectly"))
     (let ((save-args args)
          (restarg (memq '&rest args))
-         (safety (if (cl--compiling-file) cl-optimize-safety 3))
+         (safety (if (cl--compiling-file) cl--optimize-safety 3))
          (keys nil)
          (laterarg nil) (exactarg nil) minarg)
       (or num (setq num 0))
@@ -440,7 +440,7 @@
        (setq restarg (cadr restarg)))
       (push (list restarg expr) cl--bind-lets)
       (if (eq (car args) '&whole)
-         (push (list (cl-pop2 args) restarg) cl--bind-lets))
+         (push (list (cl--pop2 args) restarg) cl--bind-lets))
       (let ((p args))
        (setq minarg restarg)
        (while (and p (not (memq (car p) cl--lambda-list-keywords)))
@@ -476,7 +476,7 @@
                             (if def `(if ,restarg ,poparg ,def) poparg))
              (setq num (1+ num))))))
       (if (eq (car args) '&rest)
-         (let ((arg (cl-pop2 args)))
+         (let ((arg (cl--pop2 args)))
            (if (consp arg) (cl--do-arglist arg restarg)))
        (or (eq (car args) '&key) (= safety 0) exactarg
            (push `(if ,restarg
@@ -574,7 +574,7 @@
 
 ;;; The `cl-eval-when' form.
 
-(defvar cl-not-toplevel nil)
+(defvar cl--not-toplevel nil)
 
 ;;;###autoload
 (defmacro cl-eval-when (when &rest body)
@@ -586,9 +586,9 @@
 \(fn (WHEN...) BODY...)"
   (declare (indent 1) (debug ((&rest &or "compile" "load" "eval") body)))
   (if (and (fboundp 'cl--compiling-file) (cl--compiling-file)
-          (not cl-not-toplevel) (not (boundp 'for-effect)))  ; horrible kludge
+          (not cl--not-toplevel) (not (boundp 'for-effect))) ;Horrible kludge.
       (let ((comp (or (memq 'compile when) (memq :compile-toplevel when)))
-           (cl-not-toplevel t))
+           (cl--not-toplevel t))
        (if (or (memq 'load when) (memq :load-toplevel when))
            (if comp (cons 'progn (mapcar 'cl--compile-time-too body))
              `(if nil nil ,@body))
@@ -759,7 +759,8 @@
 (defvar cl--loop-first-flag)
 (defvar cl--loop-initially) (defvar cl--loop-map-form) (defvar cl--loop-name)
 (defvar cl--loop-result) (defvar cl--loop-result-explicit)
-(defvar cl--loop-result-var) (defvar cl--loop-steps) (defvar 
cl--loop-symbol-macs)
+(defvar cl--loop-result-var) (defvar cl--loop-steps)
+(defvar cl--loop-symbol-macs)
 
 ;;;###autoload
 (defmacro cl-loop (&rest loop-args)
@@ -792,7 +793,8 @@
                                "return"] form]
                          ;; Simple default, which covers 99% of the cases.
                          symbolp form)))
-  (if (not (memq t (mapcar 'symbolp (delq nil (delq t (cl-copy-list 
loop-args))))))
+  (if (not (memq t (mapcar #'symbolp
+                           (delq nil (delq t (cl-copy-list loop-args))))))
       `(cl-block nil (while t ,@loop-args))
     (let ((cl--loop-args loop-args) (cl--loop-name nil) (cl--loop-bindings nil)
          (cl--loop-body nil)   (cl--loop-steps nil)
@@ -803,14 +805,16 @@
          (cl--loop-map-form nil)   (cl--loop-first-flag nil)
          (cl--loop-destr-temps nil) (cl--loop-symbol-macs nil))
       (setq cl--loop-args (append cl--loop-args '(cl-end-loop)))
-      (while (not (eq (car cl--loop-args) 'cl-end-loop)) 
(cl-parse-loop-clause))
+      (while (not (eq (car cl--loop-args) 'cl-end-loop))
+        (cl--parse-loop-clause))
       (if cl--loop-finish-flag
          (push `((,cl--loop-finish-flag t)) cl--loop-bindings))
       (if cl--loop-first-flag
          (progn (push `((,cl--loop-first-flag t)) cl--loop-bindings)
                 (push `(setq ,cl--loop-first-flag nil) cl--loop-steps)))
       (let* ((epilogue (nconc (nreverse cl--loop-finally)
-                             (list (or cl--loop-result-explicit 
cl--loop-result))))
+                             (list (or cl--loop-result-explicit
+                                        cl--loop-result))))
             (ands (cl--loop-build-ands (nreverse cl--loop-body)))
             (while-body (nconc (cadr ands) (nreverse cl--loop-steps)))
             (body (append
@@ -830,7 +834,8 @@
                          `((if ,cl--loop-finish-flag
                                (progn ,@epilogue) ,cl--loop-result-var)))
                      epilogue))))
-       (if cl--loop-result-var (push (list cl--loop-result-var) 
cl--loop-bindings))
+       (if cl--loop-result-var
+            (push (list cl--loop-result-var) cl--loop-bindings))
        (while cl--loop-bindings
          (if (cdar cl--loop-bindings)
              (setq body (list (cl--loop-let (pop cl--loop-bindings) body t)))
@@ -840,7 +845,8 @@
                (push (car (pop cl--loop-bindings)) lets))
              (setq body (list (cl--loop-let lets body nil))))))
        (if cl--loop-symbol-macs
-           (setq body (list `(cl-symbol-macrolet ,cl--loop-symbol-macs 
,@body))))
+           (setq body
+                  (list `(cl-symbol-macrolet ,cl--loop-symbol-macs ,@body))))
        `(cl-block ,cl--loop-name ,@body)))))
 
 ;; Below is a complete spec for cl-loop, in several parts that correspond
@@ -995,7 +1001,7 @@
 
 
 
-(defun cl-parse-loop-clause ()         ; uses loop-*
+(defun cl--parse-loop-clause ()                ; uses loop-*
   (let ((word (pop cl--loop-args))
        (hash-types '(hash-key hash-keys hash-value hash-values))
        (key-types '(key-code key-codes key-seq key-seqs
@@ -1010,17 +1016,21 @@
 
      ((eq word 'initially)
       (if (memq (car cl--loop-args) '(do doing)) (pop cl--loop-args))
-      (or (consp (car cl--loop-args)) (error "Syntax error on `initially' 
clause"))
+      (or (consp (car cl--loop-args))
+          (error "Syntax error on `initially' clause"))
       (while (consp (car cl--loop-args))
        (push (pop cl--loop-args) cl--loop-initially)))
 
      ((eq word 'finally)
       (if (eq (car cl--loop-args) 'return)
-         (setq cl--loop-result-explicit (or (cl-pop2 cl--loop-args) '(quote 
nil)))
+         (setq cl--loop-result-explicit
+                (or (cl--pop2 cl--loop-args) '(quote nil)))
        (if (memq (car cl--loop-args) '(do doing)) (pop cl--loop-args))
-       (or (consp (car cl--loop-args)) (error "Syntax error on `finally' 
clause"))
+       (or (consp (car cl--loop-args))
+            (error "Syntax error on `finally' clause"))
        (if (and (eq (caar cl--loop-args) 'return) (null cl--loop-name))
-           (setq cl--loop-result-explicit (or (nth 1 (pop cl--loop-args)) 
'(quote nil)))
+           (setq cl--loop-result-explicit
+                  (or (nth 1 (pop cl--loop-args)) '(quote nil)))
          (while (consp (car cl--loop-args))
            (push (pop cl--loop-args) cl--loop-finally)))))
 
@@ -1036,7 +1046,8 @@
              (if (eq word 'being) (setq word (pop cl--loop-args)))
              (if (memq word '(the each)) (setq word (pop cl--loop-args)))
              (if (memq word '(buffer buffers))
-                 (setq word 'in cl--loop-args (cons '(buffer-list) 
cl--loop-args)))
+                 (setq word 'in
+                        cl--loop-args (cons '(buffer-list) cl--loop-args)))
              (cond
 
               ((memq word '(from downfrom upfrom to downto upto
@@ -1045,15 +1056,19 @@
                (if (memq (car cl--loop-args) '(downto above))
                    (error "Must specify `from' value for downward cl-loop"))
                (let* ((down (or (eq (car cl--loop-args) 'downfrom)
-                                (memq (cl-caddr cl--loop-args) '(downto 
above))))
+                                (memq (cl-caddr cl--loop-args)
+                                       '(downto above))))
                       (excl (or (memq (car cl--loop-args) '(above below))
-                                (memq (cl-caddr cl--loop-args) '(above 
below))))
-                      (start (and (memq (car cl--loop-args) '(from upfrom 
downfrom))
-                                  (cl-pop2 cl--loop-args)))
+                                (memq (cl-caddr cl--loop-args)
+                                       '(above below))))
+                      (start (and (memq (car cl--loop-args)
+                                         '(from upfrom downfrom))
+                                  (cl--pop2 cl--loop-args)))
                       (end (and (memq (car cl--loop-args)
                                       '(to upto downto above below))
-                                (cl-pop2 cl--loop-args)))
-                      (step (and (eq (car cl--loop-args) 'by) (cl-pop2 
cl--loop-args)))
+                                (cl--pop2 cl--loop-args)))
+                      (step (and (eq (car cl--loop-args) 'by)
+                                  (cl--pop2 cl--loop-args)))
                       (end-var (and (not (macroexp-const-p end))
                                     (make-symbol "--cl-var--")))
                       (step-var (and (not (macroexp-const-p step))
@@ -1087,7 +1102,7 @@
                                loop-for-sets))))
                  (push (list temp
                              (if (eq (car cl--loop-args) 'by)
-                                 (let ((step (cl-pop2 cl--loop-args)))
+                                 (let ((step (cl--pop2 cl--loop-args)))
                                    (if (and (memq (car-safe step)
                                                   '(quote function
                                                           cl-function))
@@ -1099,7 +1114,8 @@
 
               ((eq word '=)
                (let* ((start (pop cl--loop-args))
-                      (then (if (eq (car cl--loop-args) 'then) (cl-pop2 
cl--loop-args) start)))
+                      (then (if (eq (car cl--loop-args) 'then)
+                                 (cl--pop2 cl--loop-args) start)))
                  (push (list var nil) loop-for-bindings)
                  (if (or ands (eq (car cl--loop-args) 'and))
                      (progn
@@ -1136,14 +1152,15 @@
                (let ((ref (or (memq (car cl--loop-args) '(in-ref of-ref))
                               (and (not (memq (car cl--loop-args) '(in of)))
                                    (error "Expected `of'"))))
-                     (seq (cl-pop2 cl--loop-args))
+                     (seq (cl--pop2 cl--loop-args))
                      (temp-seq (make-symbol "--cl-seq--"))
-                     (temp-idx (if (eq (car cl--loop-args) 'using)
-                                   (if (and (= (length (cadr cl--loop-args)) 2)
-                                            (eq (cl-caadr cl--loop-args) 
'index))
-                                       (cadr (cl-pop2 cl--loop-args))
-                                     (error "Bad `using' clause"))
-                                 (make-symbol "--cl-idx--"))))
+                     (temp-idx
+                       (if (eq (car cl--loop-args) 'using)
+                           (if (and (= (length (cadr cl--loop-args)) 2)
+                                    (eq (cl-caadr cl--loop-args) 'index))
+                               (cadr (cl--pop2 cl--loop-args))
+                             (error "Bad `using' clause"))
+                         (make-symbol "--cl-idx--"))))
                  (push (list temp-seq seq) loop-for-bindings)
                  (push (list temp-idx 0) loop-for-bindings)
                  (if ref
@@ -1166,15 +1183,17 @@
                        loop-for-steps)))
 
               ((memq word hash-types)
-               (or (memq (car cl--loop-args) '(in of)) (error "Expected `of'"))
-               (let* ((table (cl-pop2 cl--loop-args))
-                      (other (if (eq (car cl--loop-args) 'using)
-                                 (if (and (= (length (cadr cl--loop-args)) 2)
-                                          (memq (cl-caadr cl--loop-args) 
hash-types)
-                                          (not (eq (cl-caadr cl--loop-args) 
word)))
-                                     (cadr (cl-pop2 cl--loop-args))
-                                   (error "Bad `using' clause"))
-                               (make-symbol "--cl-var--"))))
+               (or (memq (car cl--loop-args) '(in of))
+                    (error "Expected `of'"))
+               (let* ((table (cl--pop2 cl--loop-args))
+                      (other
+                        (if (eq (car cl--loop-args) 'using)
+                            (if (and (= (length (cadr cl--loop-args)) 2)
+                                     (memq (cl-caadr cl--loop-args) hash-types)
+                                     (not (eq (cl-caadr cl--loop-args) word)))
+                                (cadr (cl--pop2 cl--loop-args))
+                              (error "Bad `using' clause"))
+                          (make-symbol "--cl-var--"))))
                  (if (memq word '(hash-value hash-values))
                      (setq var (prog1 other (setq other var))))
                  (setq cl--loop-map-form
@@ -1182,16 +1201,19 @@
 
               ((memq word '(symbol present-symbol external-symbol
                             symbols present-symbols external-symbols))
-               (let ((ob (and (memq (car cl--loop-args) '(in of)) (cl-pop2 
cl--loop-args))))
+               (let ((ob (and (memq (car cl--loop-args) '(in of))
+                               (cl--pop2 cl--loop-args))))
                  (setq cl--loop-map-form
                        `(mapatoms (lambda (,var) . --cl-map) ,ob))))
 
               ((memq word '(overlay overlays extent extents))
                (let ((buf nil) (from nil) (to nil))
                  (while (memq (car cl--loop-args) '(in of from to))
-                   (cond ((eq (car cl--loop-args) 'from) (setq from (cl-pop2 
cl--loop-args)))
-                         ((eq (car cl--loop-args) 'to) (setq to (cl-pop2 
cl--loop-args)))
-                         (t (setq buf (cl-pop2 cl--loop-args)))))
+                   (cond ((eq (car cl--loop-args) 'from)
+                           (setq from (cl--pop2 cl--loop-args)))
+                         ((eq (car cl--loop-args) 'to)
+                           (setq to (cl--pop2 cl--loop-args)))
+                         (t (setq buf (cl--pop2 cl--loop-args)))))
                  (setq cl--loop-map-form
                        `(cl--map-overlays
                          (lambda (,var ,(make-symbol "--cl-var--"))
@@ -1203,11 +1225,13 @@
                      (var1 (make-symbol "--cl-var1--"))
                      (var2 (make-symbol "--cl-var2--")))
                  (while (memq (car cl--loop-args) '(in of property from to))
-                   (cond ((eq (car cl--loop-args) 'from) (setq from (cl-pop2 
cl--loop-args)))
-                         ((eq (car cl--loop-args) 'to) (setq to (cl-pop2 
cl--loop-args)))
+                   (cond ((eq (car cl--loop-args) 'from)
+                           (setq from (cl--pop2 cl--loop-args)))
+                         ((eq (car cl--loop-args) 'to)
+                           (setq to (cl--pop2 cl--loop-args)))
                          ((eq (car cl--loop-args) 'property)
-                          (setq prop (cl-pop2 cl--loop-args)))
-                         (t (setq buf (cl-pop2 cl--loop-args)))))
+                          (setq prop (cl--pop2 cl--loop-args)))
+                         (t (setq buf (cl--pop2 cl--loop-args)))))
                  (if (and (consp var) (symbolp (car var)) (symbolp (cdr var)))
                      (setq var1 (car var) var2 (cdr var))
                    (push (list var `(cons ,var1 ,var2)) loop-for-sets))
@@ -1217,15 +1241,17 @@
                          ,buf ,prop ,from ,to))))
 
               ((memq word key-types)
-               (or (memq (car cl--loop-args) '(in of)) (error "Expected `of'"))
-               (let ((cl-map (cl-pop2 cl--loop-args))
-                     (other (if (eq (car cl--loop-args) 'using)
-                                (if (and (= (length (cadr cl--loop-args)) 2)
-                                         (memq (cl-caadr cl--loop-args) 
key-types)
-                                         (not (eq (cl-caadr cl--loop-args) 
word)))
-                                    (cadr (cl-pop2 cl--loop-args))
-                                  (error "Bad `using' clause"))
-                              (make-symbol "--cl-var--"))))
+               (or (memq (car cl--loop-args) '(in of))
+                    (error "Expected `of'"))
+               (let ((cl-map (cl--pop2 cl--loop-args))
+                     (other
+                       (if (eq (car cl--loop-args) 'using)
+                           (if (and (= (length (cadr cl--loop-args)) 2)
+                                    (memq (cl-caadr cl--loop-args) key-types)
+                                    (not (eq (cl-caadr cl--loop-args) word)))
+                               (cadr (cl--pop2 cl--loop-args))
+                             (error "Bad `using' clause"))
+                         (make-symbol "--cl-var--"))))
                  (if (memq word '(key-binding key-bindings))
                      (setq var (prog1 other (setq other var))))
                  (setq cl--loop-map-form
@@ -1245,7 +1271,8 @@
                        loop-for-steps)))
 
               ((memq word '(window windows))
-               (let ((scr (and (memq (car cl--loop-args) '(in of)) (cl-pop2 
cl--loop-args)))
+               (let ((scr (and (memq (car cl--loop-args) '(in of))
+                                (cl--pop2 cl--loop-args)))
                      (temp (make-symbol "--cl-var--"))
                      (minip (make-symbol "--cl-minip--")))
                  (push (list var (if scr
@@ -1340,7 +1367,8 @@
 
      ((memq word '(minimize minimizing maximize maximizing))
       (let* ((what (pop cl--loop-args))
-            (temp (if (cl--simple-expr-p what) what (make-symbol 
"--cl-var--")))
+            (temp (if (cl--simple-expr-p what) what
+                     (make-symbol "--cl-var--")))
             (var (cl--loop-handle-accum nil))
             (func (intern (substring (symbol-name word) 0 3)))
             (set `(setq ,var (if ,var (,func ,var ,temp) ,temp))))
@@ -1351,7 +1379,8 @@
      ((eq word 'with)
       (let ((bindings nil))
        (while (progn (push (list (pop cl--loop-args)
-                                 (and (eq (car cl--loop-args) '=) (cl-pop2 
cl--loop-args)))
+                                 (and (eq (car cl--loop-args) '=)
+                                       (cl--pop2 cl--loop-args)))
                            bindings)
                      (eq (car cl--loop-args) 'and))
          (pop cl--loop-args))
@@ -1364,19 +1393,23 @@
       (push `(not ,(pop cl--loop-args)) cl--loop-body))
 
      ((eq word 'always)
-      (or cl--loop-finish-flag (setq cl--loop-finish-flag (make-symbol 
"--cl-flag--")))
+      (or cl--loop-finish-flag
+          (setq cl--loop-finish-flag (make-symbol "--cl-flag--")))
       (push `(setq ,cl--loop-finish-flag ,(pop cl--loop-args)) cl--loop-body)
       (setq cl--loop-result t))
 
      ((eq word 'never)
-      (or cl--loop-finish-flag (setq cl--loop-finish-flag (make-symbol 
"--cl-flag--")))
+      (or cl--loop-finish-flag
+          (setq cl--loop-finish-flag (make-symbol "--cl-flag--")))
       (push `(setq ,cl--loop-finish-flag (not ,(pop cl--loop-args)))
            cl--loop-body)
       (setq cl--loop-result t))
 
      ((eq word 'thereis)
-      (or cl--loop-finish-flag (setq cl--loop-finish-flag (make-symbol 
"--cl-flag--")))
-      (or cl--loop-result-var (setq cl--loop-result-var (make-symbol 
"--cl-var--")))
+      (or cl--loop-finish-flag
+          (setq cl--loop-finish-flag (make-symbol "--cl-flag--")))
+      (or cl--loop-result-var
+          (setq cl--loop-result-var (make-symbol "--cl-var--")))
       (push `(setq ,cl--loop-finish-flag
                    (not (setq ,cl--loop-result-var ,(pop cl--loop-args))))
            cl--loop-body))
@@ -1384,11 +1417,11 @@
      ((memq word '(if when unless))
       (let* ((cond (pop cl--loop-args))
             (then (let ((cl--loop-body nil))
-                    (cl-parse-loop-clause)
+                    (cl--parse-loop-clause)
                     (cl--loop-build-ands (nreverse cl--loop-body))))
             (else (let ((cl--loop-body nil))
                     (if (eq (car cl--loop-args) 'else)
-                        (progn (pop cl--loop-args) (cl-parse-loop-clause)))
+                        (progn (pop cl--loop-args) (cl--parse-loop-clause)))
                     (cl--loop-build-ands (nreverse cl--loop-body))))
             (simple (and (eq (car then) t) (eq (car else) t))))
        (if (eq (car cl--loop-args) 'end) (pop cl--loop-args))
@@ -1410,8 +1443,10 @@
        (push (cons 'progn (nreverse (cons t body))) cl--loop-body)))
 
      ((eq word 'return)
-      (or cl--loop-finish-flag (setq cl--loop-finish-flag (make-symbol 
"--cl-var--")))
-      (or cl--loop-result-var (setq cl--loop-result-var (make-symbol 
"--cl-var--")))
+      (or cl--loop-finish-flag
+          (setq cl--loop-finish-flag (make-symbol "--cl-var--")))
+      (or cl--loop-result-var
+          (setq cl--loop-result-var (make-symbol "--cl-var--")))
       (push `(setq ,cl--loop-result-var ,(pop cl--loop-args)
                    ,cl--loop-finish-flag nil) cl--loop-body))
 
@@ -1421,7 +1456,7 @@
        (or handler (error "Expected a cl-loop keyword, found %s" word))
        (funcall handler))))
     (if (eq (car cl--loop-args) 'and)
-       (progn (pop cl--loop-args) (cl-parse-loop-clause)))))
+       (progn (pop cl--loop-args) (cl--parse-loop-clause)))))
 
 (defun cl--loop-let (specs body par)   ; uses loop-*
   (let ((p specs) (temps nil) (new nil))
@@ -1440,10 +1475,12 @@
       (if (and (consp (car specs)) (listp (caar specs)))
          (let* ((spec (caar specs)) (nspecs nil)
                 (expr (cadr (pop specs)))
-                (temp (cdr (or (assq spec cl--loop-destr-temps)
-                               (car (push (cons spec (or (last spec 0)
-                                                         (make-symbol 
"--cl-var--")))
-                                          cl--loop-destr-temps))))))
+                (temp
+                  (cdr (or (assq spec cl--loop-destr-temps)
+                           (car (push (cons spec
+                                            (or (last spec 0)
+                                                (make-symbol "--cl-var--")))
+                                      cl--loop-destr-temps))))))
            (push (list temp expr) new)
            (while (consp spec)
              (push (list (pop spec)
@@ -1452,24 +1489,27 @@
            (setq specs (nconc (nreverse nspecs) specs)))
        (push (pop specs) new)))
     (if (eq body 'setq)
-       (let ((set (cons (if par 'cl-psetq 'setq) (apply 'nconc (nreverse 
new)))))
+       (let ((set (cons (if par 'cl-psetq 'setq)
+                         (apply 'nconc (nreverse new)))))
          (if temps `(let* ,(nreverse temps) ,set) set))
       `(,(if par 'let 'let*)
         ,(nconc (nreverse temps) (nreverse new)) ,@body))))
 
-(defun cl--loop-handle-accum (def &optional func)   ; uses loop-*
+(defun cl--loop-handle-accum (def &optional func) ; uses loop-*
   (if (eq (car cl--loop-args) 'into)
-      (let ((var (cl-pop2 cl--loop-args)))
+      (let ((var (cl--pop2 cl--loop-args)))
        (or (memq var cl--loop-accum-vars)
            (progn (push (list (list var def)) cl--loop-bindings)
                   (push var cl--loop-accum-vars)))
        var)
     (or cl--loop-accum-var
        (progn
-         (push (list (list (setq cl--loop-accum-var (make-symbol 
"--cl-var--")) def))
-                  cl--loop-bindings)
+         (push (list (list
+                       (setq cl--loop-accum-var (make-symbol "--cl-var--"))
+                       def))
+                cl--loop-bindings)
          (setq cl--loop-result (if func (list func cl--loop-accum-var)
-                             cl--loop-accum-var))
+                                  cl--loop-accum-var))
          cl--loop-accum-var))))
 
 (defun cl--loop-build-ands (clauses)
@@ -1516,7 +1556,7 @@
             ((&rest &or symbolp (symbolp &optional form form))
              (form body)
              cl-declarations body)))
-  (cl-expand-do-loop steps endtest body nil))
+  (cl--expand-do-loop steps endtest body nil))
 
 ;;;###autoload
 (defmacro cl-do* (steps endtest &rest body)
@@ -1524,9 +1564,9 @@
 
 \(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)"
   (declare (indent 2) (debug cl-do))
-  (cl-expand-do-loop steps endtest body t))
+  (cl--expand-do-loop steps endtest body t))
 
-(defun cl-expand-do-loop (steps endtest body star)
+(defun cl--expand-do-loop (steps endtest body star)
   `(cl-block nil
      (,(if star 'let* 'let)
       ,(mapcar (lambda (c) (if (consp c) (list (car c) (nth 1 c)) c))
@@ -1620,19 +1660,18 @@
 BODY forms are executed and their result is returned.  This is much like
 a `let' form, except that the list of symbols can be computed at run-time."
   (declare (indent 2) (debug (form form body)))
-  (let ((bodyfun (make-symbol "cl--progv-body"))
+  (let ((bodyfun (make-symbol "body"))
         (binds (make-symbol "binds"))
         (syms (make-symbol "syms"))
         (vals (make-symbol "vals")))
     `(progn
-       (defvar ,bodyfun)
        (let* ((,syms ,symbols)
               (,vals ,values)
               (,bodyfun (lambda () ,@body))
               (,binds ()))
          (while ,syms
            (push (list (pop ,syms) (list 'quote (pop ,vals))) ,binds))
-         (eval (list 'let ,binds '(funcall ,bodyfun)))))))
+         (eval (list 'let ,binds (list 'funcall (list 'quote ,bodyfun))))))))
 
 (defvar cl--labels-convert-cache nil)
 
@@ -1903,11 +1942,11 @@
   (declare (indent 1) (debug (cl-type-spec form)))
   form)
 
-(defvar cl-proclaim-history t)    ; for future compilers
-(defvar cl-declare-stack t)       ; for future compilers
+(defvar cl--proclaim-history t)    ; for future compilers
+(defvar cl--declare-stack t)       ; for future compilers
 
-(defun cl-do-proclaim (spec hist)
-  (and hist (listp cl-proclaim-history) (push spec cl-proclaim-history))
+(defun cl--do-proclaim (spec hist)
+  (and hist (listp cl--proclaim-history) (push spec cl--proclaim-history))
   (cond ((eq (car-safe spec) 'special)
         (if (boundp 'byte-compile-bound-variables)
             (setq byte-compile-bound-variables
@@ -1932,9 +1971,9 @@
                            '((0 nil) (1 t) (2 t) (3 t))))
               (safety (assq (nth 1 (assq 'safety (cdr spec)))
                             '((0 t) (1 t) (2 t) (3 nil)))))
-          (if speed (setq cl-optimize-speed (car speed)
+          (if speed (setq cl--optimize-speed (car speed)
                           byte-optimize (nth 1 speed)))
-          (if safety (setq cl-optimize-safety (car safety)
+          (if safety (setq cl--optimize-safety (car safety)
                            byte-compile-delete-errors (nth 1 safety)))))
 
        ((and (eq (car-safe spec) 'warn) (boundp 'byte-compile-warnings))
@@ -1946,10 +1985,10 @@
   nil)
 
 ;;; Process any proclamations made before cl-macs was loaded.
-(defvar cl-proclaims-deferred)
-(let ((p (reverse cl-proclaims-deferred)))
-  (while p (cl-do-proclaim (pop p) t))
-  (setq cl-proclaims-deferred nil))
+(defvar cl--proclaims-deferred)
+(let ((p (reverse cl--proclaims-deferred)))
+  (while p (cl--do-proclaim (pop p) t))
+  (setq cl--proclaims-deferred nil))
 
 ;;;###autoload
 (defmacro cl-declare (&rest specs)
@@ -1962,8 +2001,8 @@
 See Info node `(cl)Declarations' for details."
   (if (cl--compiling-file)
       (while specs
-       (if (listp cl-declare-stack) (push (car specs) cl-declare-stack))
-       (cl-do-proclaim (pop specs) nil)))
+       (if (listp cl--declare-stack) (push (car specs) cl--declare-stack))
+       (cl--do-proclaim (pop specs) nil)))
   nil)
 
 ;;; The standard modify macros.
@@ -2209,7 +2248,7 @@
         (copier (intern (format "copy-%s" name)))
         (predicate (intern (format "%s-p" name)))
         (print-func nil) (print-auto nil)
-        (safety (if (cl--compiling-file) cl-optimize-safety 3))
+        (safety (if (cl--compiling-file) cl--optimize-safety 3))
         (include nil)
         (tag (intern (format "cl-struct-%s" name)))
         (tag-symbol (intern (format "cl-struct-%s-tags" name)))
@@ -2454,7 +2493,8 @@
                             (if (consp (cadr type)) `(> ,val ,(cl-caadr type))
                               `(>= ,val ,(cadr type))))
                         ,(if (memq (cl-caddr type) '(* nil)) t
-                            (if (consp (cl-caddr type)) `(< ,val ,(cl-caaddr 
type))
+                            (if (consp (cl-caddr type))
+                                `(< ,val ,(cl-caaddr type))
                               `(<= ,val ,(cl-caddr type)))))))
          ((memq (car type) '(and or not))
           (cons (car type)
@@ -2479,7 +2519,7 @@
 STRING is an optional description of the desired type."
   (declare (debug (place cl-type-spec &optional stringp)))
   (and (or (not (cl--compiling-file))
-          (< cl-optimize-speed 3) (= cl-optimize-safety 3))
+          (< cl--optimize-speed 3) (= cl--optimize-safety 3))
        (let* ((temp (if (cl--simple-expr-p form 3)
                        form (make-symbol "--cl-var--")))
              (body `(or ,(cl--make-type-test temp type)
@@ -2499,7 +2539,7 @@
 omitted, a default message listing FORM itself is used."
   (declare (debug (form &rest form)))
   (and (or (not (cl--compiling-file))
-          (< cl-optimize-speed 3) (= cl-optimize-safety 3))
+          (< cl--optimize-speed 3) (= cl--optimize-safety 3))
        (let ((sargs (and show-args
                          (delq nil (mapcar (lambda (x)
                                              (unless (macroexp-const-p x)
@@ -2695,14 +2735,14 @@
 
 ;;; Things that are side-effect-free.
 (mapc (lambda (x) (put x 'side-effect-free t))
-      '(cl-oddp cl-evenp cl-signum last butlast cl-ldiff cl-pairlis cl-gcd 
cl-lcm
-       cl-isqrt cl-floor cl-ceiling cl-truncate cl-round cl-mod cl-rem 
cl-subseq
-       cl-list-length cl-get cl-getf))
+      '(cl-oddp cl-evenp cl-signum last butlast cl-ldiff cl-pairlis cl-gcd
+        cl-lcm cl-isqrt cl-floor cl-ceiling cl-truncate cl-round cl-mod cl-rem
+        cl-subseq cl-list-length cl-get cl-getf))
 
 ;;; Things that are side-effect-and-error-free.
 (mapc (lambda (x) (put x 'side-effect-free 'error-free))
-      '(eql cl-floatp-safe cl-list* cl-subst cl-acons cl-equalp 
cl-random-state-p
-       copy-tree cl-sublis))
+      '(eql cl-floatp-safe cl-list* cl-subst cl-acons cl-equalp
+        cl-random-state-p copy-tree cl-sublis))
 
 
 (run-hooks 'cl-macs-load-hook)

=== modified file 'lisp/emacs-lisp/cl-seq.el'
--- a/lisp/emacs-lisp/cl-seq.el 2012-09-28 23:30:52 +0000
+++ b/lisp/emacs-lisp/cl-seq.el 2012-12-06 21:29:29 +0000
@@ -105,6 +105,9 @@
        (eq (not (funcall cl-test ,x ,y)) cl-test-not)
      (eql ,x ,y)))
 
+;; Yuck!  These vars are set/bound by cl--parsing-keywords to match :if :test
+;; and :key keyword args, and they are also accessed (sometimes) via dynamic
+;; scoping (and some of those accesses are from macro-expanded code).
 (defvar cl-test) (defvar cl-test-not)
 (defvar cl-if) (defvar cl-if-not)
 (defvar cl-key)
@@ -333,7 +336,8 @@
 
 (defun cl--delete-duplicates (cl-seq cl-keys cl-copy)
   (if (listp cl-seq)
-      (cl--parsing-keywords (:test :test-not :key (:start 0) :end :from-end 
:if)
+      (cl--parsing-keywords
+          (:test :test-not :key (:start 0) :end :from-end :if)
          ()
        (if cl-from-end
            (let ((cl-p (nthcdr cl-start cl-seq)) cl-i)
@@ -776,7 +780,8 @@
             (setq cl-list1 (prog1 cl-list2 (setq cl-list2 cl-list1))))
         (while cl-list2
           (if (or cl-keys (numberp (car cl-list2)))
-              (setq cl-list1 (apply 'cl-adjoin (car cl-list2) cl-list1 
cl-keys))
+              (setq cl-list1
+                     (apply 'cl-adjoin (car cl-list2) cl-list1 cl-keys))
             (or (memq (car cl-list2) cl-list1)
                 (push (car cl-list2) cl-list1)))
           (pop cl-list2))


reply via email to

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