From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Use the new let-opt macro in place of pcase-let in lisp-mode.el Date: Mon, 18 May 2015 21:11:44 -0400 Message-ID: References: <87egmdncf7.fsf@gmail.com> <87oalh6blm.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1431997921 17186 80.91.229.3 (19 May 2015 01:12:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 May 2015 01:12:01 +0000 (UTC) Cc: emacs-devel@gnu.org To: Oleh Krehel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 19 03:11:52 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YuW4W-0001QO-AZ for ged-emacs-devel@m.gmane.org; Tue, 19 May 2015 03:11:52 +0200 Original-Received: from localhost ([::1]:43477 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuW4V-0006eI-Jm for ged-emacs-devel@m.gmane.org; Mon, 18 May 2015 21:11:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuW4S-0006eC-3m for emacs-devel@gnu.org; Mon, 18 May 2015 21:11:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YuW4O-0007eO-SE for emacs-devel@gnu.org; Mon, 18 May 2015 21:11:48 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:14039) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuW4O-0007eJ-OY for emacs-devel@gnu.org; Mon, 18 May 2015 21:11:44 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUFAGvvdVTO+LMW/2dsb2JhbAA3gVOhb4EIgXUBAQQBViMFCwsOJhIUGA0kiBOiEYxkCQMBAoM+Aw6DYgSjY4RY X-IPAS-Result: AgUFAGvvdVTO+LMW/2dsb2JhbAA3gVOhb4EIgXUBAQQBViMFCwsOJhIUGA0kiBOiEYxkCQMBAoM+Aw6DYgSjY4RY X-IronPort-AV: E=Sophos;i="5.11,557,1422939600"; d="scan'208";a="120741573" Original-Received: from 206-248-179-22.dsl.teksavvy.com (HELO pastel.home) ([206.248.179.22]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 18 May 2015 21:11:44 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 0FC7F2B99; Mon, 18 May 2015 21:11:44 -0400 (EDT) In-Reply-To: <87oalh6blm.fsf@gmail.com> (Oleh Krehel's message of "Mon, 18 May 2015 19:26:29 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:186607 Archived-At: >> IOW, define a let-when-compile macro which uses progv to setup the >> bindings and then calls `macroexpand-all' on the body. The body's >> `eval-when-compile' can then use those vars just fine. > I wrote this: > (defmacro let-when-compile (bindings &rest body) > "Like `let', but allows for compile time optimization. > \n(fn BINDINGS BODY)" > (declare (indent 1) (debug let)) > `(progv ',(mapcar #'car bindings) > ',(mapcar (lambda (x) (eval (cadr x))) bindings) > ,@body)) That's not what I suggest. The `progv' should be done at macroexpansion-time (otherwise, you're better off using `let'). Stefan