bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33414: 27.0.50; inhibit-changing-match-data can be t in syntax-prope


From: Lars Ingebrigtsen
Subject: bug#33414: 27.0.50; inhibit-changing-match-data can be t in syntax-propertize functions, breaking backtrace and looking-at
Date: Thu, 12 Aug 2021 15:11:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> If I'm testing correctly,
>> 
>> (let ((inhibit-changing-match-data t)) (debug))
>> 
>> fails on both branches
>
> You are right, not sure what I did wrong when trying it a few moments
> ago.

It seems to fail reliably the first time executed, but after that it
only sometimes fails.  Below is the backtrace for the reliable breakage.

But...  I'm not sure this is supposed to work?  I mean, this is an
internal variable only supposed to be used in very limited
circumstances, and aren't ... particularly well defined.

But I see this was added in 2016:

7fb75680b38 (Noam Postavsky        2016-08-05  338)   /* If we are debugging an 
error while `inhibit-changing-match-data'
7fb75680b38 (Noam Postavsky        2016-08-05  339)      is bound to non-nil 
(e.g., within a call to `string-match-p'),
7fb75680b38 (Noam Postavsky        2016-08-05  340)      then make sure 
debugger code can still use match data.  */
7fb75680b38 (Noam Postavsky        2016-08-05  341)   specbind 
(Qinhibit_changing_match_data, Qnil);

To work around the problem.

`inhibit-changing-match-data' just seems like a bad interface to me.
Wouldn't it be better to change `looking-at' and `string-match' to allow
taking a parameter to not change the match data?  (And then just use
that in `looking-at-p'/`string-match-p'.)  That would avoid all these
weirdnesses...

Any opinions?

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  regexp-quote(nil)
  find-auto-coding("/home/larsi/src/emacs/trunk/lisp/emacs-lisp/cl-loa..." 
48494)
  set-auto-coding("/home/larsi/src/emacs/trunk/lisp/emacs-lisp/cl-loa..." 48494)
  insert-file-contents("/home/larsi/src/emacs/trunk/lisp/emacs-lisp/cl-loa...")
  
load-with-code-conversion("/home/larsi/src/emacs/trunk/lisp/emacs-lisp/cl-loa..."
 "/home/larsi/src/emacs/trunk/lisp/emacs-lisp/cl-loa..." t t)
  load("cl-loaddefs" noerror quiet)
  byte-code(... [provide cl-lib load "cl-loaddefs" noerror quiet require 
cl-macs cl-seq] 4)
  require(cl-lib)
  (debug)
  (let ((inhibit-changing-match-data t)) (debug))


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]