Subject: bug#60012: 30.0.50; bug-reference-prog-mode: Error during redisplay with tree-sitter modes

From: Aleksandr Vityazev <[email-masked]>
Date: Mon, 12 Dec 2022 16:38:10 +0000

Hi,

The error was discovered when I was watching
https://github.com/zevlg/telega.el. I will add copies of the necessary
files from there to reproduce the behavior.

1. mkidr ~/test-project
2. mv test-project
2. Add a .dir-locals.el file with the following content:

--8<---------------cut here---------------start------------->8---
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((nil . ((bug-reference-url-format . "https://github.com/zevlg/telega.el/issues/%s")
         (bug-reference-bug-regexp
          . "<https?://\\(github)\\.com/zevlg/telega.el/issues/\\([0-9]+\\)>"))))
--8<---------------cut here---------------end--------------->8---

3. Add Dockerfile file with the following content:

--8<---------------cut here---------------start------------->8---
FROM alpine:latest AS builder
ARG tdlib_branch=master
ARG telega_branch=master
CMD ["/bin/bash"]
--8<---------------cut here---------------end--------------->8---

4. with emacs -Q (add-hook 'prog-mode-hook 'bug-reference-prog-mode)
5. C-x C-f ~/test-project/Dockerfile
6. The file will be opened with dockerfile-ts-mode
7. See that syntax highlighting does not work

At this time the following should be in the *Messages* buffer:
Error during redisplay: (jit-lock-function 1) signaled (invalid-regexp
"Unmatched ( or \\(")

You can get the same if you add some C file and open it with c-ts-mode.
If you open the file in normal c-mode. There are no such errors.

I do not see any errors in the regular expression - 
"<https?://\\(github)\\.com/zevlg/telega.el/issues/\\([0-9]+\\)>".

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.30, cairo version 1.16.0)
System Description: Guix System

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash
 SHELL=/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash
 --prefix=/gnu/store/lhhh9jsxc05pw24151ibdj8d4j1d8b4j-emacs-rrr-next-30.0.50-29.77d0793
 --enable-fast-install --with-pgtk --without-libsystemd
 --with-tree-sitter --with-xwidgets --with-native-compilation
 --with-modules --with-cairo --disable-build-details'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP
NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM XWIDGETS GTK3 ZLIB

Important settings:
  value of $EMACSLOADPATH: /home/akagi/.guix-home/profile/share/emacs/site-lisp:/gnu/store/lhhh9jsxc05pw24151ibdj8d4j1d8b4j-emacs-rrr-next-30.0.50-29.77d0793/share/emacs/30.0.50/lisp
  value of $EMACSNATIVELOADPATH: /home/akagi/.guix-home/profile/lib/emacs/native-site-lisp
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  telega-adblock-mode: t
  telega-x-mode: t
  global-telega-mnz-mode: t
  telega-root-auto-fill-mode: t
  telega-active-locations-mode: t
  telega-patrons-mode: t
  telega-notifications-mode: t
  openwith-mode: t
  skempo-mode: t
  highlight-defined-mode: t
  eros-mode: t
  flymake-mode: t
  debbugs-browse-mode: t
  bug-reference-prog-mode: t
  hl-line-mode: t
  hl-todo-mode: t
  page-break-lines-mode: t
  diff-hl-mode: t
  pixel-scroll-mode: t
  fancy-battery-mode: t
  display-time-mode: t
  global-so-long-mode: t
  savehist-mode: t
  save-place-mode: t
  reverse-im-mode: t
  minibuffer-depth-indicate-mode: t
  electric-pair-mode: t
  company-posframe-mode: t
  global-company-mode: t
  company-mode: t
  av-compile-mode: t
  midnight-mode: t
  global-guix-prettify-mode: t
  guix-prettify-mode: t
  project-x-mode: t
  org-roam-db-autosync-mode: t
  recentf-mode: t
  server-mode: t
  hes-mode: t
  envrc-global-mode: t
  envrc-mode: t
  shell-dirtrack-mode: t
  global-auto-revert-mode: t
  prot-vc-git-setup-mode: t
  marginalia-mode: t
  vertico-mode: t
  mood-line-mode: t
  fnhh-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
/gnu/store/qs2hwr0l3nkay905aqz11f6dajq12gwy-emacs-soap-client-3.2.1/share/emacs/site-lisp/soap-client-3.2.1/soap-inspect hides /gnu/store/lhhh9jsxc05pw24151ibdj8d4j1d8b4j-emacs-rrr-next-30.0.50-29.77d0793/share/emacs/30.0.50/lisp/net/soap-inspect
/gnu/store/qs2hwr0l3nkay905aqz11f6dajq12gwy-emacs-soap-client-3.2.1/share/emacs/site-lisp/soap-client-3.2.1/soap-client hides /gnu/store/lhhh9jsxc05pw24151ibdj8d4j1d8b4j-emacs-rrr-next-30.0.50-29.77d0793/share/emacs/30.0.50/lisp/net/soap-client

Features:
(shadow sort av-message mail-extr disass dabbrev org-eldoc oc-basic
av-eww find-dired c-ts-mode flymake-cc eglot external-completion array
jsonrpc ert consult-xref org-tree-slide org-timer org-clock
consult-flymake smerge-mode diff telega-adblock telega-x ol-telega
telega-mnz telega-dired-dwim telega-obsolete telega telega-tdlib-events
telega-webpage visual-fill-column telega-match telega-root telega-info
telega-chat telega-modes telega-company telega-emoji telega-user
telega-notifications telega-voip telega-msg telega-tme telega-sticker
telega-i18n telega-vvnote bindat telega-ffplay telega-sort telega-filter
telega-ins telega-folders telega-inline telega-util telega-media
telega-tdlib rainbow-identifiers telega-server telega-core cursor-sensor
telega-customize emacsbug av-ispell ispell consult-imenu debug backtrace
checkdoc dired-aux dired-x gnus-dired diff-hl-dired pulsar pulse color
project-rg rg rg-info-hack rg-menu rg-ibuffer rg-result wgrep-rg wgrep
rg-history rg-header ibuf-ext ibuffer ibuffer-loaddefs grep av-x av-comm
elisp-demos shortdoc cl-print av-ace-window ace-window copyright
executable misearch multi-isearch av-vc guix-devel edit-indirect
guix-misc guix-ui guix-ui-messages bui bui-list bui-info bui-entry
bui-core bui-history bui-button tramp-sh tramp-cmds mule-util autoinsert
dockerfile-ts-mode treesit vertico-repeat smtpmail openwith orderless
ebdb-message ebdb-gnus gnus-msg ebdb-mua ebdb-com crm ebdb-format ebdb
eieio-opt speedbar ezimage dframe eieio-base timezone company-elisp
package-lint-flymake package-lint let-alist imenu finder finder-inf
lisp-mnt package url-handlers av-skempo skempo skeleton mode-local
highlight-defined eros av-company-elisp flymake-guile flymake-proc
flymake av-flymake vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs
debbugs-browse bug-reference hl-line hl-todo disp-table page-break-lines
diff-hl log-view vc-dir ewoc pixel-scroll cua-base fancy-battery battery
time so-long savehist saveplace reverse-im quail mb-depth elec-pair
company-files company-keywords company-dabbrev-code company-dabbrev
company-capf company-ebdb company-posframe posframe company pcase
av-compile midnight guix-prettify guix-auto-mode guix-read
guix-help-vars guix-repl guix-profiles guix-geiser guix-guile
geiser-mode geiser-xref geiser-compile geiser-guile info-look info
transient edmacro geiser-debug geiser-repl compile geiser-image
geiser-capf geiser-doc geiser-menu geiser-autodoc geiser-edit etags
fileloop xref project-x project geiser-completion geiser-eval
geiser-connection tq geiser-syntax al-scheme scheme geiser-log
geiser-popup view guix-external guix-utils bui-utils guix-config
guix-build-config guix appt diary-lib diary-loaddefs org-roam-x
ucs-normalize org-roam-migrate org-roam-log org-roam-mode
org-roam-capture org-roam-id org-roam-node org-roam-db org-roam-utils
org-roam-compat org-roam org-capture org-attach ob-elixir org-crypt
org-tempo tempo ob-clojure ob-scheme geiser-impl help-fns radix-tree
geiser-custom geiser-base geiser ob-ledger ob-latex ob-shell ob-C
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs org-element org-persist org-id avl-tree generator ol-w3m
ol-rmail ol-mhe ol-irc ol-info org-habit av-org-agenda org-agenda
org-refile ol-gnus nnselect gnus-art mm-uu mml2015 mm-view mml-smime
smime gnutls dig gnus-sum gnus-group gnus-undo gnus-start gnus-dbus
gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int
gnus-range gnus-win ol-eww eww url-queue shr pixel-fill kinsoku url-file
svg dom av-browse-url embark-consult av-consult consult-vertico consult
av-recentf recentf tree-widget kmacro bookmark av-embark password-store
auth-source-pass with-editor comp comp-cstr server embark ffap avy
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util url-parse url-vars
mm-url gnus nnheader range ol-docview doc-view jka-compr image-mode exif
ol-bibtex bibtex ol-bbdb org ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-macro org-src ob-comint org-pcomplete org-list org-footnote
org-faces org-entities noutline outline ob-emacs-lisp ob-core ob-eval
org-cycle org-table ol org-fold org-fold-core org-keys oc org-loaddefs
find-func russian-holidays cal-menu calendar cal-loaddefs org-version
org-compat org-macs emacsql-sqlite advice emacsql emacsql-compiler
magit-section compat-27 compat-26 compat compat-macs
highlight-escape-sequences envrc inheritenv thingatpt dtache-shell
dtache tramp-cache time-stamp tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat shell pcomplete comint ansi-osc
ansi-color parse-time iso8601 ls-lisp format-spec auth-source cl-seq
eieio json map byte-opt bytecomp byte-compile notifications dbus xml
autorevert filenotify vc-git diff-mode easy-mmode prot-vc prot-common
log-edit message sendmail mailcap yank-media puny dired-subtree
dired-hacks-utils dash dired dired-loaddefs rfc822 mml mml-sec
password-cache gnus-util text-property-search time-date subr-x mm-decode
mm-bodies cus-start mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader ring
pcvs-util add-log vc vc-dispatcher epa-file epa derived epg rfc6068
epg-config av-elisp marginalia vertico-x vertico mood-line cl-extra
help-mode smart-hungry-delete warnings nordrrr-theme delsel fnhh
cus-edit pp cus-load icons wid-edit company-ebdb-autoloads
soap-client-autoloads debbugs-autoloads ebdb-autoloads eieio-core
cl-macs gv cl-loaddefs cl-lib transmission-autoloads
seriestracker-autoloads youtube-dl-autoloads eenime-autoloads
ytel-autoloads emms-autoloads elixir-ts-mode-autoloads
inf-elixir-autoloads ob-elixir-autoloads flymake-kondor-autoloads
kibit-helper-autoloads anakondo-autoloads spinner-autoloads
sesman-autoloads queue-autoloads epl-autoloads pkg-info-autoloads
parseclj-autoloads a-autoloads parseedn-autoloads clojure-mode-autoloads
cider-autoloads sly-stepper-autoloads popup-autoloads sly-asdf-autoloads
eros-autoloads sly-autoloads flymake-guile-autoloads al-scheme-autoloads
info-colors-autoloads elisp-demos-autoloads esh-help-autoloads
srfi-autoloads git-timemachine-autoloads browse-at-remote-autoloads
git-email-autoloads prot-vc-autoloads diff-hl-autoloads
password-store-autoloads oauth2-autoloads shikimori-autoloads
request-autoloads mastodon-autoloads elpher-autoloads dtache-autoloads
vterm-autoloads flymake-shellcheck-autoloads inheritenv-autoloads
envrc-autoloads marginalia-autoloads orderless-autoloads
vertico-x-autoloads vertico-autoloads
highlight-escape-sequences-autoloads highlight-defined-autoloads
page-break-lines-autoloads mood-line-autoloads nordrrr-autoloads
hl-todo-autoloads multitran-autoloads synosaurus-autoloads
adaptive-wrap-autoloads wordnut-autoloads org-roam-extra-autoloads
with-editor-autoloads compat-autoloads magit-autoloads pg-autoloads
finalize-autoloads emacsql-autoloads emacsql-sqlite3-autoloads
org-roam-autoloads russian-holidays-autoloads consult-dir-autoloads
consult-autoloads docker-compose-mode-autoloads json-snatcher-autoloads
json-mode-autoloads aio-autoloads docker-autoloads
company-reftex-autoloads math-symbol-lists-autoloads
company-math-autoloads auctex-autoloads tex-site ledger-mode-autoloads
eshell-syntax-highlighting-autoloads eshell-prompt-extras-autoloads
pcmpl-args-autoloads embark-autoloads f-autoloads eimp-autoloads
dired-hacks-autoloads daemons-autoloads cuirass-autoloads
magit-popup-autoloads geiser-guile-autoloads geiser-autoloads
edit-indirect-autoloads bui-autoloads guix-autoloads rx kv-autoloads
esxml-autoloads dash-autoloads nov-el-autoloads osm-autoloads
pdf-view-restore-autoloads tablist-autoloads pdf-tools-autoloads
org-contrib-autoloads org-tree-slide-autoloads orglink-autoloads
telega-contrib-autoloads telega-x-autoloads
rainbow-identifiers-autoloads visual-fill-column-autoloads
telega-autoloads debase-autoloads discomfort-autoloads
csv-mode-autoloads posframe-autoloads company-posframe-autoloads
company-autoloads package-lint-autoloads skempo-autoloads
simple-httpd-autoloads link-hint-autoloads avy-autoloads
ace-window-autoloads pulsar-autoloads project-x-autoloads
project-rg-autoloads markdown-mode-autoloads transpose-frame-autoloads
yaml-mode-autoloads markup-faces-autoloads adoc-mode-autoloads
gcmh-autoloads fancy-battery-autoloads smart-hungry-delete-autoloads
async-autoloads move-text-autoloads openwith-autoloads
olivetti-autoloads scratch-el-autoloads sudo-edit-autoloads
ibuffer-vc-autoloads ctable-autoloads wgrep-autoloads s-autoloads
rg-autoloads try-autoloads keycast-autoloads reverse-im-autoloads
fnhh-autoloads tmr-autoloads plz-autoloads srht-autoloads eiwc-autoloads
av-autoloads guix-emacs early-init xdg rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/pgtk-win pgtk-win term/common-win pgtk-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads
xwidget-internal dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo gtk pgtk lcms2 multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 2066116 199464)
 (symbols 48 72973 32)
 (strings 32 357850 18552)
 (string-bytes 1 11646317)
 (vectors 16 141323)
 (vector-slots 8 3301045 144818)
 (floats 8 102365 1040)
 (intervals 56 29411 9317)
 (buffers 984 93))

-- 
Best regards,
Aleksandr Vityazev