all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <CAAeL0SQTjw4ua60-AJfUPjVkNXu7kMqBAZfTraRkQZo3Xfs7-w@mail.gmail.com> (raw)
In-Reply-To: <jwv4npu1365.fsf-monnier+emacs@gnu.org>

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

Something like this, you mean?

    Juanma


=== 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 return
 		   ;; value is rarely used.  It should not matter that other
 		   ;; warnings may be silenced, since `place' is used earlier and
 		   ;; 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	other threads:[~2012-06-29 16:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1SkNxg-0007ax-Gw@vcs.savannah.gnu.org>
2012-06-29 16:42 ` [Emacs-diffs] /srv/bzr/emacs/trunk r108794: lisp/emacs-lisp/cl-lib.el (cl-pushnew): Don't capture X (bug#11811) Stefan Monnier
2012-06-29 16:57   ` Juanma Barranquero [this message]
2012-06-30  4:08     ` Stefan Monnier
2012-06-30  7:01       ` Andreas Schwab
2012-06-30 14:21         ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAeL0SQTjw4ua60-AJfUPjVkNXu7kMqBAZfTraRkQZo3Xfs7-w@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.