From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.devel Subject: &allow-other-keys + &rest body in cl-defmacro (was: Permanently fix org versioning breakage during builds?) Date: Mon, 25 Dec 2023 11:26:29 +0000 Message-ID: <87a5pya5ga.fsf@localhost> References: <25989.50971.995591.385250@google.com> <87a5q0dc9m.fsf@localhost> <87edfbbyzm.fsf@localhost> <875y0n4px0.fsf@localhost> <87r0jb34hi.fsf@localhost> <878r5j31v0.fsf@localhost> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24943"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "T.V Raman" , emacs-devel To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 25 12:24:25 2023 Return-path: Envelope-to: ged-emacs-devel@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 1rHj4K-0006Iu-Ri for ged-emacs-devel@m.gmane-mx.org; Mon, 25 Dec 2023 12:24:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rHj3X-0003ev-Nv; Mon, 25 Dec 2023 06:23:35 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rHj3U-0003em-JN for emacs-devel@gnu.org; Mon, 25 Dec 2023 06:23:33 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rHj3O-0004TS-ER for emacs-devel@gnu.org; Mon, 25 Dec 2023 06:23:30 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id C06A6240103 for ; Mon, 25 Dec 2023 12:23:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1703503397; bh=9YL67JlqWv/BKd5+Swy49kREi5gu7WnmBHgpaCi36Rs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=hrFGORbsf9fTxBtaYYVFoN3r/m3BtJYT134/NVugcM8PbZ+EbybVti4vSvJ/RxN6v 6Y0WCWm3SvBe/QuY4dPLXIxsvK44Vtty9OzVhHFsLNh5ru+B2S1t60FGX9z0SBAR5c kBj8LofNWPMeBmsWAHTQ8p6lRkBdloxAHqdzDeYh/8GKBkTen+K/jNYR0hXZ6h527w YfQO9WeN/r5Xh7tnJPWlQ6A71f7C6/PzO6GAUsmH+9SBO5hcPidrHp6Vb6/rZia/Lb hCLfOIaJY9wRdkE4MSyYF6nVoSjnYX/7M10Ig1SWlFyia7dMTTH+HYU3XJVdQiLYkm m6CEpxzjNtf7g== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SzFrj0Y8Mz6ty2; Mon, 25 Dec 2023 12:23:17 +0100 (CET) In-Reply-To: Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:314201 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Jo=C3=A3o T=C3=A1vora writes: >> Hmm... It actually looks like a problem with `cl-defmacro' rather than >> with macro definition itself. > > No, Common Lisp's DEFMACRO works exactly like this. You need to understand > how &rest works with &key and &allow-other-keys. It _also_ keeps the keys. > That's just how it works. Now I feel a bit like RMS when he complained about CL-lib introducing alien concepts to Elisp :) What about non-breaking change like the attached? --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-org-element-with-buffer-copy-org-export-with-buffer-.patch Content-Transfer-Encoding: quoted-printable >From 3ebf5565196e2dfa3548564cf5a266e51e35cd9d Mon Sep 17 00:00:00 2001 Message-ID: <3ebf5565196e2dfa3548564cf5a266e51e35cd9d.1703503500.git.yantar= 92@posteo.net> From: Ihor Radchenko Date: Mon, 25 Dec 2023 12:20:10 +0100 Subject: [PATCH] org-element-with-buffer-copy, org-export-with-buffer-copy: Fix expansion MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * lisp/org-element.el (org-element-with-buffer-copy): * lisp/ox.el (org-export-with-buffer-copy): Make sure that keyword arguments in the macro are not duplicated into BODY, which happens for &rest body + &allow-other-keys in `cl-defmacro'. Reported-by: Jo=C3=A3o T=C3=A1vora Link: https://yhetil.org/emacs-devel/CALDnm53p7nXdnbA2PuH-VHL7EeGQUXYy3x_87= hp3oj2pkyWS9Q@mail.gmail.com/ --- lisp/org-element.el | 3 +++ lisp/ox.el | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lisp/org-element.el b/lisp/org-element.el index 0924c56fe..842cf8857 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -669,6 +669,9 @@ (cl-defmacro org-element-with-buffer-copy ( &rest body copy. TO-BUFFER, DROP-VISIBILITY, DROP-NARROWING, DROP-CONTENTS, and DROP-LOCALS are passed as arguments to `org-element-copy-buffer'." (declare (debug t)) + ;; Drop keyword arguments from BODY. + (while (memq (car body) '(:to-buffer :drop-visibility :drop-narrowing :d= rop-contents :drop-locals)) + (pop body) (pop body)) (org-with-gensyms (buf-copy) `(let ((,buf-copy (org-element-copy-buffer :to-buffer ,to-buffer diff --git a/lisp/ox.el b/lisp/ox.el index b661b59c3..a54b3d809 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -2599,6 +2599,9 @@ (cl-defmacro org-export-with-buffer-copy ( &rest body In addition, buffer-local variables are set according to #+BIND: keywords." (declare (debug t)) + ;; Drop keyword arguments from BODY. + (while (memq (car body) '(:to-buffer :drop-visibility :drop-narrowing :d= rop-contents :drop-locals)) + (pop body) (pop body)) (org-with-gensyms (bind-variables) `(let ((,bind-variables (org-export--list-bound-variables))) (org-element-with-buffer-copy --=20 2.42.0 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--