unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Pip Cet <pipcet@gmail.com>, 33414@debbugs.gnu.org
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	[thread overview]
Message-ID: <87r1eylsea.fsf@gnus.org> (raw)
In-Reply-To: <83k1lbu5xj.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 17 Nov 2018 16:36:40 +0200")

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	other threads:[~2021-08-12 13:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-17 13:30 bug#33414: 27.0.50; inhibit-changing-match-data can be t in syntax-propertize functions, breaking backtrace and looking-at Pip Cet
2018-11-17 13:46 ` Eli Zaretskii
2018-11-17 14:14   ` Pip Cet
2018-11-17 14:36     ` Eli Zaretskii
2021-08-12 13:11       ` Lars Ingebrigtsen [this message]
2021-09-04 18:39         ` Philipp
2021-09-04 19:33           ` bug#33414: [External] : " Drew Adams
2021-09-05  9:29           ` Lars Ingebrigtsen
2021-09-05  9:40             ` Eli Zaretskii
2021-09-05  9:45               ` Lars Ingebrigtsen
2021-09-05  9:55                 ` Eli Zaretskii
2021-10-07 18:49                   ` Lars Ingebrigtsen
2021-10-07 19:07                     ` bug#33414: [External] : " Drew Adams
2021-10-07 19:11                       ` 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=87r1eylsea.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=33414@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=pipcet@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).