[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113493: * lisp/subr.el (add-to-list): Fix compiler-
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] trunk r113493: * lisp/subr.el (add-to-list): Fix compiler-macro when `append' is |
Date: |
Mon, 22 Jul 2013 17:24:35 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113493
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2013-07-22 13:24:31 -0400
message:
* lisp/subr.el (add-to-list): Fix compiler-macro when `append' is
not constant. Don't use `cl-member' for the base case.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/subr.el subr.el-20091113204419-o5vbwnq5f7feedwu-151
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-07-22 16:25:32 +0000
+++ b/lisp/ChangeLog 2013-07-22 17:24:31 +0000
@@ -1,5 +1,8 @@
2013-07-22 Stefan Monnier <address@hidden>
+ * subr.el (add-to-list): Fix compiler-macro when `append' is
+ not constant. Don't use `cl-member' for the base case.
+
* progmodes/subword.el: Fix boundary case (bug#13758).
(subword-forward-regexp): Make it a constant. Wrap optional \\W in its
own group.
=== modified file 'lisp/subr.el'
--- a/lisp/subr.el 2013-07-19 12:18:16 +0000
+++ b/lisp/subr.el 2013-07-22 17:24:31 +0000
@@ -1498,9 +1498,10 @@
;; FIXME: Something like this could be used for `set' as well.
(if (or (not (eq 'quote (car-safe list-var)))
(special-variable-p (cadr list-var))
- (and append compare-fn))
+ (not (macroexp-const-p append)))
exp
(let* ((sym (cadr list-var))
+ (append (eval append))
(msg (format "`add-to-list' can't use lexical var `%s'; use
`push' or `cl-pushnew'"
sym))
;; Big ugly hack so we only output a warning during
@@ -1513,13 +1514,17 @@
(when (assq sym byte-compile--lexical-environment)
(byte-compile-log-warning msg t :error))))
(code
- (if append
- (macroexp-let2 macroexp-copyable-p x element
- `(unless (member ,x ,sym)
- (setq ,sym (append ,sym (list ,x)))))
- (require 'cl-lib)
- `(cl-pushnew ,element ,sym
- :test ,(or compare-fn '#'equal)))))
+ (macroexp-let2 macroexp-copyable-p x element
+ `(unless ,(if compare-fn
+ (progn
+ (require 'cl-lib)
+ `(cl-member ,x ,sym :test ,compare-fn))
+ ;; For bootstrapping reasons, don't rely on
+ ;; cl--compiler-macro-member for the base case.
+ `(member ,x ,sym))
+ ,(if append
+ `(setq ,sym (append ,sym (list ,x)))
+ `(push ,x ,sym))))))
(if (not (macroexp--compiling-p))
code
`(progn
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113493: * lisp/subr.el (add-to-list): Fix compiler-macro when `append' is,
Stefan Monnier <=