aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emacs-lisp/cl.el
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2012-06-22 17:24:54 -0400
committerStefan Monnier <[email protected]>2012-06-22 17:24:54 -0400
commit36cec983d4e680e28e7066fda505910cd549f509 (patch)
treef6dc7ad0e0822bc5edd4f12e963969059e0989b5 /lisp/emacs-lisp/cl.el
parentd35af63cd671563fd188c3b0a1ef30067027c7aa (diff)
Further GV/CL cleanups.
* lisp/emacs-lisp/gv.el (gv-get): Autoload functions to find their gv-expander. (gv--defun-declaration): New function. (defun-declarations-alist): Use it. (gv-define-modify-macro, gv-pushnew!, gv-inc!, gv-dec!): Remove. (gv-place): Autoload. * lisp/emacs-lisp/cl.el (cl--dotimes, cl--dolist): Remember subr.el's original definition of dotimes and dolist. * lisp/emacs-lisp/cl-macs.el (cl-expr-access-order): Remove unused. (cl-dolist, cl-dotimes): Use `dolist' and `dotimes'. * lisp/emacs-lisp/cl-lib.el: Move gv handlers from cl-macs to here. (cl-fifth, cl-sixth, cl-seventh, cl-eighth) (cl-ninth, cl-tenth): Move gv handler to the function's definition. * lisp/emacs-lisp/cl-extra.el (cl-subseq, cl-get, cl-getf): Move gv handler to the function's definition. * lisp/Makefile.in (COMPILE_FIRST): Re-order to speed it up by about 50%. * lisp/window.el: * lisp/files.el: * lisp/faces.el: * lisp/env.el: Don't use CL.
Diffstat (limited to 'lisp/emacs-lisp/cl.el')
-rw-r--r--lisp/emacs-lisp/cl.el18
1 files changed, 15 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/cl.el b/lisp/emacs-lisp/cl.el
index c7a48c500c..b17d6f4e67 100644
--- a/lisp/emacs-lisp/cl.el
+++ b/lisp/emacs-lisp/cl.el
@@ -107,6 +107,14 @@
))
(defvaralias var (intern (format "cl-%s" var))))
+;; Before overwriting subr.el's `dotimes' and `dolist', let's remember
+;; them under a different name, so we can use them in our implementation
+;; of `dotimes' and `dolist'.
+(unless (fboundp 'cl--dotimes)
+ (defalias 'cl--dotimes (symbol-function 'dotimes) "The non-CL `dotimes'."))
+(unless (fboundp 'cl--dolist)
+ (defalias 'cl--dolist (symbol-function 'dolist) "The non-CL `dolist'."))
+
(dolist (fun '(
(get* . cl-get)
(random* . cl-random)
@@ -501,6 +509,10 @@ Unlike `flet', this macro is fully compliant with the Common Lisp standard.
;; not 100% compatible: not worth the trouble to add them to cl-lib.el, but we
;; still to support old users of cl.el.
+;; FIXME: `letf' is unsatisfactory because it does not really "restore" the
+;; previous state. If the getter/setter loses information, that info is
+;; not recovered.
+
(defun cl--letf (bindings simplebinds binds body)
;; It's not quite clear what the semantics of let! should be.
;; E.g. in (let! ((PLACE1 VAL1) (PLACE2 VAL2)) BODY), while it's clear
@@ -581,7 +593,9 @@ the PLACE is not modified before executing BODY.
(declare (indent 1) (debug letf))
(cl--letf* bindings body))
-(defun cl--gv-adapt (cl-gv do) ;FIXME: needed during setf expansion!
+(defun cl--gv-adapt (cl-gv do)
+ ;; This function is used by all .elc files that use define-setf-expander and
+ ;; were compiled with Emacs>=24.2.
(let ((vars (nth 0 cl-gv))
(vals (nth 1 cl-gv))
(binds ())
@@ -774,7 +788,5 @@ from ARGLIST using FUNC: (define-modify-macro incf (&optional (n 1)) +)"
,store)))
(list accessor temp))))
-;; FIXME: More candidates: define-modify-macro, define-setf-expander.
-
(provide 'cl)
;;; cl.el ends here