unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Philip Kaludercic <philipk@posteo.net>,
	gregory@heytings.org, silent2600@gmail.com, emacs-devel@gnu.org
Subject: Re: emacs master + org Wrong type argument: number-or-marker-p
Date: Mon, 1 Aug 2022 19:15:40 +0200	[thread overview]
Message-ID: <03AF0800-5252-429C-86BC-85DF9DF449F9@acm.org> (raw)
In-Reply-To: <83zggn2a0c.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 245 bytes --]

1 aug. 2022 kl. 18.39 skrev Eli Zaretskii <eliz@gnu.org>:

> 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?


[-- Attachment #2: narrow-to-region.diff --]
[-- Type: application/octet-stream, Size: 3373 bytes --]

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;
 	  }
 

[-- Attachment #3: Type: text/plain, Size: 2 bytes --]




  reply	other threads:[~2022-08-01 17:15 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 13:13 emacs master + org Wrong type argument: number-or-marker-p hx
2022-08-01 13:37 ` Eli Zaretskii
2022-08-01 15:11   ` Philip Kaludercic
2022-08-01 15:52     ` Eli Zaretskii
2022-08-01 16:07       ` Philip Kaludercic
2022-08-01 16:34         ` Visuwesh
2022-08-01 16:11       ` Gregory Heytings
2022-08-01 16:25         ` Eli Zaretskii
2022-08-01 16:34           ` Philip Kaludercic
2022-08-01 16:39             ` Eli Zaretskii
2022-08-01 17:15               ` Mattias Engdegård [this message]
2022-08-01 17:24                 ` Eli Zaretskii
2022-08-01 17:36                   ` Mattias Engdegård
2022-08-01 17:59                     ` Eli Zaretskii
2022-08-01 18:06                       ` Gregory Heytings
2022-08-01 18:25                         ` Eli Zaretskii
2022-08-01 19:14                           ` Gregory Heytings
2022-08-01 18:47                         ` Mattias Engdegård
2022-08-01 19:16                           ` Gregory Heytings
2022-08-01 20:05                             ` Alan Mackenzie
2022-08-02 13:46                               ` Eli Zaretskii
2022-08-02 18:59                                 ` Alan Mackenzie
2022-08-02 19:15                                   ` Eli Zaretskii
2022-08-02 20:28                                     ` Alan Mackenzie
2022-08-03  1:21                                       ` Po Lu
2022-08-03  2:38                                         ` Eli Zaretskii
2022-08-03  4:34                                           ` Po Lu
2022-08-03 12:02                                             ` Eli Zaretskii
2022-08-03 12:07                                               ` Po Lu
2022-08-03 12:34                                                 ` Eli Zaretskii
2022-08-03 13:10                                                   ` Po Lu
2022-08-03 13:36                                                     ` Eli Zaretskii
2022-08-04  1:04                                                       ` Po Lu
2022-08-04  1:09                                                         ` Gregory Heytings
2022-08-04  1:27                                                           ` Po Lu
2022-08-04  6:45                                                           ` Eli Zaretskii
2022-08-03 20:47                                               ` Stefan Monnier
2022-08-04  5:51                                                 ` Eli Zaretskii
2022-08-04  6:19                                                   ` Po Lu
2022-08-04  7:10                                                     ` Eli Zaretskii
2022-08-04  7:31                                                       ` Po Lu
2022-08-04  7:58                                                         ` Eli Zaretskii
2022-08-04  8:42                                                           ` Po Lu
2022-08-04  9:06                                                             ` Eli Zaretskii
2022-08-04 10:18                                                               ` Alan Mackenzie
2022-08-04 13:18                                                                 ` Eli Zaretskii
2022-08-04 16:07                                                                   ` Alan Mackenzie
2022-08-04 16:37                                                                     ` Eli Zaretskii
2022-08-04 10:26                                                               ` Po Lu
2022-08-04 11:33                                                                 ` Werner LEMBERG
2022-08-04 13:10                                                                 ` Eli Zaretskii
2022-08-04 21:56                                                           ` Stefan Monnier
2022-08-03  7:21                                         ` Gregory Heytings
2022-08-03 11:07                                           ` Po Lu
2022-08-03 12:25                                             ` Eli Zaretskii
2022-08-03 15:25                                             ` Gregory Heytings
2022-08-04  1:02                                               ` Po Lu
2022-08-04  1:08                                                 ` Gregory Heytings
2022-08-04  9:14                                                 ` Stefan Monnier
2022-08-05  3:19                                               ` Richard Stallman
2022-08-03  8:57                                         ` Stefan Monnier
2022-08-03 11:05                                           ` Po Lu
2022-08-03 11:50                                       ` Eli Zaretskii
2022-08-02  8:25                             ` Mattias Engdegård
2022-08-02  8:43                               ` Gregory Heytings
2022-08-02  8:28                           ` Stefan Monnier
2022-08-02  8:40                             ` Mattias Engdegård
2022-08-01 16:36           ` Gregory Heytings
2022-08-01 16:49           ` Lars Ingebrigtsen
2022-08-01 17:23             ` Andreas Schwab
2022-08-07 15:22           ` Julien Cubizolles
2022-08-01 16:39         ` Andreas Schwab
2022-08-02 16:37         ` Opcode Versioning Was: " Sam Steingold
2022-08-02 22:10           ` Stefan Monnier
2022-08-04 14:59             ` Sam Steingold
2022-08-04 22:11               ` Stefan Monnier
2022-08-02  8:59       ` Po Lu
  -- strict thread matches above, loose matches on Subject: below --
2022-08-01 13:45 Gerd Möllmann
2022-08-01 17:36 Gerd Möllmann
2022-08-01 17:58 ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=03AF0800-5252-429C-86BC-85DF9DF449F9@acm.org \
    --to=mattiase@acm.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=gregory@heytings.org \
    --cc=philipk@posteo.net \
    --cc=silent2600@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).