From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: emacs master + org Wrong type argument: number-or-marker-p Date: Mon, 1 Aug 2022 19:15:40 +0200 Message-ID: <03AF0800-5252-429C-86BC-85DF9DF449F9@acm.org> References: <83bkt42ifq.fsf@gnu.org> <87a68ovw0b.fsf@posteo.net> <835yjc2c6f.fsf@gnu.org> <8335eg2ao9.fsf@gnu.org> <875yjbexde.fsf@posteo.net> <83zggn2a0c.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_D17E20E7-AAD4-4A4C-9E1C-B789D7DCBD46" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5951"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Philip Kaludercic , gregory@heytings.org, silent2600@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 01 19:18:45 2022 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 1oIZ40-0001LC-QG for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Aug 2022 19:18:44 +0200 Original-Received: from localhost ([::1]:50094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIZ3z-0003Pp-Sh for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Aug 2022 13:18:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIZ1E-0001YL-Q9 for emacs-devel@gnu.org; Mon, 01 Aug 2022 13:15:52 -0400 Original-Received: from mail33c50.megamailservers.eu ([91.136.10.43]:36718) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIZ1C-0006Dg-2F; Mon, 01 Aug 2022 13:15:52 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1659374143; bh=NxmtHqYGw3+TaT2dA7cbYuc+K+7qrwiHUHFO2G5nFSs=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=QtTOiafwfBhFgSsqrytvapaL+0cAcEQqsVlddMBdS1fHPlXYHVUIfqK5pkVC8fS51 W+MOZXOnq8cKmT86E5kCQDcNTBOFWGtNIL5WBwfxoBFIoGg/It4HWbnaUWMYA0V1j1 63Qj4zsGuWTKXQBMzdaPBG4QG/nmLZhnMVG/u70A= Feedback-ID: mattiase@acm.or Original-Received: from smtpclient.apple (c188-150.188-179.bredband.tele2.se [188.150.188.179] (may be forged)) (authenticated bits=0) by mail33c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 271HFerc113326; Mon, 1 Aug 2022 17:15:42 +0000 In-Reply-To: <83zggn2a0c.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) X-CTCH-RefID: str=0001.0A782F22.62E80A3F.0012, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.10.43; envelope-from=mattiase@acm.org; helo=mail33c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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" Xref: news.gmane.io gmane.emacs.devel:292951 Archived-At: --Apple-Mail=_D17E20E7-AAD4-4A4C-9E1C-B789D7DCBD46 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii 1 aug. 2022 kl. 18.39 skrev Eli Zaretskii : > If indeed the change in narrow-to-region caused the problem, > can we make the change in a way that doesn't break backward > compatibility of the byte code Does this fix it for you? --Apple-Mail=_D17E20E7-AAD4-4A4C-9E1C-B789D7DCBD46 Content-Disposition: attachment; filename=narrow-to-region.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="narrow-to-region.diff" Content-Transfer-Encoding: 7bit diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 1ecd77f751..0f2dbe4efb 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -767,7 +767,7 @@ 121 (byte-defop 122 0 byte-char-syntax) (byte-defop 123 -1 byte-buffer-substring) (byte-defop 124 -1 byte-delete-region) -(byte-defop 125 -2 byte-narrow-to-region) +(byte-defop 125 -1 byte-narrow-to-region) (byte-defop 126 1 byte-widen) (byte-defop 127 0 byte-end-of-line) @@ -3711,7 +3711,7 @@ byte-defop-compiler is the function and the second element is the bytecode-symbol. The second element may be nil, meaning there is no opcode. COMPILE-HANDLER is the function to use to compile this byte-op, or -may be the abbreviations 0, 1, 2, 2-and, 3, 0-1, 1-2, 1-3, or 2-3. +may be the abbreviations 0, 1, 2, 2-and, 3, 0-1, 1-2, 1-3, 2-3, or 2-call. If it is nil, then the handler is \"byte-compile-SYMBOL.\"" (let (opcode) (if (symbolp function) @@ -3731,6 +3731,7 @@ byte-defop-compiler (1-2 . byte-compile-one-or-two-args) (2-3 . byte-compile-two-or-three-args) (1-3 . byte-compile-one-to-three-args) + (2-call . byte-compile-two-args-or-call) ))) compile-handler (intern (concat "byte-compile-" @@ -3833,7 +3834,7 @@ setcar (byte-defop-compiler setcdr 2) (byte-defop-compiler buffer-substring 2) (byte-defop-compiler delete-region 2) -(byte-defop-compiler narrow-to-region 2-3) +(byte-defop-compiler narrow-to-region 2-call) (byte-defop-compiler (% byte-rem) 2) (byte-defop-compiler aset 3) @@ -3911,6 +3912,12 @@ byte-compile-two-or-three-args ((= len 4) (byte-compile-three-args form)) (t (byte-compile-subr-wrong-args form "2-3"))))) +(defun byte-compile-two-args-or-call (form) + "Compile using a byte-op for 2 args, plain call for anything else." + (if (= (length form) 3) + (byte-compile-two-args form) + (byte-compile-normal-call form))) + (defun byte-compile-one-to-three-args (form) (let ((len (length form))) (cond ((= len 2) (byte-compile-three-args (append form '(nil nil)))) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 4354ea03a4..6e9132e430 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -1915,7 +1915,11 @@ comp-limplify-lap-inst (byte-char-syntax auto) (byte-buffer-substring auto) (byte-delete-region auto) - (byte-narrow-to-region auto) + (byte-narrow-to-region + (comp-emit-set-call (comp-call 'narrow-to-region + (comp-slot) + (comp-slot+1) + (make-comp-mvar :constant nil)))) (byte-widen (comp-emit-set-call (comp-call 'widen))) (byte-end-of-line auto) diff --git a/src/bytecode.c b/src/bytecode.c index 2b1eccdc51..310bc065ef 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -1480,8 +1480,10 @@ #define DEFINE(name, value) [name] = &&insn_ ## name, CASE (Bnarrow_to_region): { - Lisp_Object v2 = POP, v1 = POP; - TOP = Fnarrow_to_region (TOP, v1, v2); + /* To preserve bytecode compatibility, this opcode does not + accept the optional third argument added in Emacs 29. */ + Lisp_Object v1 = POP; + TOP = Fnarrow_to_region (TOP, v1, Qnil); NEXT; } --Apple-Mail=_D17E20E7-AAD4-4A4C-9E1C-B789D7DCBD46 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_D17E20E7-AAD4-4A4C-9E1C-B789D7DCBD46--