[Top][All Lists]

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

Re: [Emacs-diffs] /srv/bzr/emacs/trunk r108794: lisp/emacs-lisp/cl-lib.e

From: Juanma Barranquero
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r108794: lisp/emacs-lisp/cl-lib.el (cl-pushnew): Don't capture X (bug#11811).
Date: Fri, 29 Jun 2012 18:57:14 +0200

On Fri, Jun 29, 2012 at 6:42 PM, Stefan Monnier
<address@hidden> wrote:
>> +       (let ((var (make-symbol "--cl-x--")))
>> +         `(let ((,var ,x))
> That's exactly what macroexp-let2 is for.

Something like this, you mean?


=== modified file 'lisp/emacs-lisp/cl-lib.el'
--- lisp/emacs-lisp/cl-lib.el   2012-06-28 23:04:27 +0000
+++ lisp/emacs-lisp/cl-lib.el   2012-06-29 16:53:17 +0000
@@ -151,16 +151,15 @@
                   [keywordp form])))
   (if (symbolp place)
       (if (null keys)
-         (let ((var (make-symbol "--cl-x--")))
-           `(let ((,var ,x))
-              (if (memql ,var ,place)
+         (macroexp-let2 nil var x
+           `(if (memql ,var ,place)
                   ;; This symbol may later on expand to actual code which then
                   ;; trigger warnings like "value unused" since cl-pushnew's 
                   ;; value is rarely used.  It should not matter that other
                   ;; warnings may be silenced, since `place' is used earlier 
                   ;; should have triggered them already.
                   (with-no-warnings ,place)
-                (setq ,place (cons ,var ,place)))))
+              (setq ,place (cons ,var ,place))))
        (list 'setq place (cl-list* 'cl-adjoin x place keys)))
     (cl-list* 'cl-callf2 'cl-adjoin x place keys)))

reply via email to

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