From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Toby Cubitt Newsgroups: gmane.emacs.bugs Subject: bug#47272: 27.1; cl-progv binds variables in wrong order Date: Sat, 20 Mar 2021 00:27:03 +0000 Message-ID: <20210320002701.GA23146@bb84.Home> Reply-To: Toby Cubitt Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21377"; mail-complaints-to="usenet@ciao.gmane.io" To: 47272@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 20 01:28:36 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lNPTn-0005Nc-1h for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Mar 2021 01:28:35 +0100 Original-Received: from localhost ([::1]:45910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lNPTm-0008L9-1W for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Mar 2021 20:28:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNPTG-0008KB-3M for bug-gnu-emacs@gnu.org; Fri, 19 Mar 2021 20:28:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39661) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lNPTF-0007Kn-Rm for bug-gnu-emacs@gnu.org; Fri, 19 Mar 2021 20:28:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lNPTF-00062V-NF for bug-gnu-emacs@gnu.org; Fri, 19 Mar 2021 20:28:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Toby Cubitt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Mar 2021 00:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47272 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161620005223174 (code B ref -1); Sat, 20 Mar 2021 00:28:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Mar 2021 00:27:32 +0000 Original-Received: from localhost ([127.0.0.1]:51207 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lNPSm-00061i-C6 for submit@debbugs.gnu.org; Fri, 19 Mar 2021 20:27:32 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:47440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lNPSk-00061a-78 for submit@debbugs.gnu.org; Fri, 19 Mar 2021 20:27:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNPSj-0008GZ-W9 for bug-gnu-emacs@gnu.org; Fri, 19 Mar 2021 20:27:30 -0400 Original-Received: from mail1.protonmail.ch ([185.70.40.18]:27851) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNPSf-00076s-MT for bug-gnu-emacs@gnu.org; Fri, 19 Mar 2021 20:27:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dr-qubit.org; s=protonmail; t=1616200031; bh=3QRfx0ATHMgYbcCMzj5NZghwXX1eOh9jwBOG3O75t/4=; h=Date:To:From:Reply-To:Subject:From; b=igT9Q5YWBkBVaMi6SYebfmXIP/UpQCnP/vJWgerMszCm2fw30eFhyTd9mNvJ8urIa wfsBksNSkgJcabQqeEZtDXHWodYgfFXwwvXjcCjuIKp224g5eGkQL/lD564P7H4s75 TWs1cHqWI2BhuCkoe/t1cCWMLX1bTfojNdJEhijn7JpdkFDuelK4aOZzv8qT3udRib r9tkPnEVcKidkSvmAkm4R/KjhosGeoRLvaSrTZJjGNMFNUo6+3XHc1WWQFFY38/SF+ QGgCIia/8FvXO8mwwunBDuLTrGqGkXjXVbX2jXeK1hbOLKH00Ru+KuDkFs5M+1WtEB hz95e2A/m2stw== Received-SPF: pass client-ip=185.70.40.18; envelope-from=toby@dr-qubit.org; helo=mail1.protonmail.ch X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:202715 Archived-At: The following (cl-progv (test test) (1 2) test) evaluates to 1. It should evaluate to 2. The docstring states that cl-progv "much like a let form", and (let ((test 1) (test 2)) test) evaluates to 2. This bug in cl-progv breaks org agenda settings in org-agenda-custom-commands, by preventing local variable settings in agenda blocks from overriding variable settings in the overall agenda command. (Broken since commit 129c33dddfa80202f23756ad5b513acdc036591c in the org-mode repo, which switched the agenda varable setting code in org-agenda to use cl-progv.) Fixed implementation of cl-progv: (defmacro cl-progv (symbols values &rest body) "Bind SYMBOLS to VALUES dynamically in BODY. The forms SYMBOLS and VALUES are evaluated, and must evaluate to lists. Each symbol in the first list is bound to the corresponding value in the second list (or to nil if VALUES is shorter than SYMBOLS); then the BODY forms are executed and their result is returned. This is much like a `let' form, except that the list of symbols can be computed at run-time." (declare (indent 2) (debug (form form body))) (let ((bodyfun (make-symbol "body")) (binds (make-symbol "binds")) (syms (make-symbol "syms")) (vals (make-symbol "vals"))) `(progn (let* ((,syms ,symbols) (,vals ,values) (,bodyfun (lambda () ,@body)) (,binds ())) (while ,syms (push (list (pop ,syms) (list 'quote (pop ,vals))) ,binds)) =09 (setq ,binds (nreverse ,binds)) (eval (list 'let ,binds (list 'funcall (list 'quote ,bodyfun))))))= )) -- Dr T. S. Cubitt Reader (Associate Professor) in Quantum Information Royal Society University Research Fellow Department of Computer Science University College London email: tsc25@cantab.net web: www.dr-qubit.org