Subject: 31.0.50; python.el sets invalid entry for python-ts-mode in auto-mode-list

From: Mark Barton <[email-masked]>
Date: Sat, 28 Sep 2024 09:32:41 -0700

--text follows this line--
Steps to reproduce:
Compiled from master branch this morning (see details on the build for exact commit and options

emacs -Q
Switch to new buffer (C-x b test_auto-mode-alist.py)
Set mode (M-x python-ts-mode)
Now try to open any file that has an auto-mode, such as .el, .org, .py, etc

Error---
File mode specification error: (wrong-type-argument stringp python--auto-mode-alist-regexp)

Here is the auto-mode-alist variable with the invalid python-ts-mode entry added at the top:
#+begin_example
((python--auto-mode-alist-regexp . python-ts-mode)
 ("\\.\\(applescript\\|scpt\\)\\'" . applescript-mode)
 ("\\(?:build\\|profile\\)\\.boot\\'" . clojure-mode)
 ("\\.cljs\\'" . clojurescript-mode) ("\\.cljc\\'" . clojurec-mode)
 ("\\.\\(clj\\|cljd\\|dtm\\|edn\\|lpy\\)\\'" . clojure-mode)
 ("\\.ipynb\\'" . code-cells-convert-ipynb)
 ("\\(?:\\(?:\\.\\(?:b\\(?:\\(?:abel\\|ower\\)rc\\)\\|json\\(?:ld\\)?\\)\\|composer\\.lock\\)\\'\\)"
  . json-mode)
 ("\\.lua\\'" . lua-mode)
 ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'"
  . markdown-mode)
 ("\\.\\(plantuml\\|pum\\|plu\\)\\'" . plantuml-mode)
 ("\\.ps[dm]?1\\'" . powershell-mode) ("\\.tsv\\'" . tsv-mode)
 ("\\.[Cc][Ss][Vv]\\'" . csv-mode) ("\\.rktl\\'" . racket-mode)
 ("\\.rktd\\'" . racket-mode) ("\\.rkt\\'" . racket-mode)
 ("\\.jsx\\'" . rjsx-mode) ("/git-rebase-todo\\'" . git-rebase-mode)
 ("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode)
 ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file)
 ("\\.elc\\'" . elisp-byte-code-mode) ("\\.zst\\'" nil jka-compr)
 ("\\.dz\\'" nil jka-compr) ("\\.xz\\'" nil jka-compr)
 ("\\.lzma\\'" nil jka-compr) ("\\.lz\\'" nil jka-compr)
 ("\\.g?z\\'" nil jka-compr) ("\\.bz2\\'" nil jka-compr)
 ("\\.Z\\'" nil jka-compr) ("\\.vr[hi]?\\'" . vera-mode)
 ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|axlsx\\|jbuilder\\|rabl\\|gemspec\\|podspec\\)\\|/\\(?:Gem\\|Rake\\|Cap\\|Thor\\|Puppet\\|Berks\\|Brew\\|Fast\\|Vagrant\\|Guard\\|Pod\\)file\\)\\'"
  . ruby-mode)
 ("\\.re?st\\'" . rst-mode)
 ("/\\(?:Pipfile\\|\\.?flake8\\)\\'" . conf-mode)
 ("\\.\\(?:p\\(?:th\\|y[iw]?\\)\\)\\'" . python-mode)
 ("\\.m\\'" . octave-maybe-mode) ("\\.less\\'" . less-css-mode)
 ("\\.editorconfig\\'" . editorconfig-conf-mode)
 ("\\.scss\\'" . scss-mode) ("\\.cs\\'" . csharp-mode)
 ("\\.awk\\'" . awk-mode)
 ("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode)
 ("\\.idl\\'" . idl-mode) ("\\.java\\'" . java-mode)
 ("\\.m\\'" . objc-mode) ("\\.ii\\'" . c++-mode) ("\\.i\\'" . c-mode)
 ("\\.lex\\'" . c-mode) ("\\.y\\(acc\\)?\\'" . c-mode)
 ("\\.h\\'" . c-or-c++-mode) ("\\.c\\'" . c-mode)
 ("\\.\\(CC?\\|HH?\\)\\'" . c++-mode)
 ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode)
 ("\\.\\(cc\\|hh\\)\\'" . c++-mode)
 ("\\.\\(bat\\|cmd\\)\\'" . bat-mode)
 ("\\.[sx]?html?\\(\\.[a-zA-Z_]+\\)?\\'" . mhtml-mode)
 ("\\.svgz?\\'" . image-mode) ("\\.svgz?\\'" . xml-mode)
 ("\\.x[bp]m\\'" . image-mode) ("\\.x[bp]m\\'" . c-mode)
 ("\\.p[bpgn]m\\'" . image-mode) ("\\.tiff?\\'" . image-mode)
 ("\\.gif\\'" . image-mode) ("\\.png\\'" . image-mode)
 ("\\.jpe?g\\'" . image-mode) ("\\.webp\\'" . image-mode)
 ("\\.te?xt\\'" . text-mode) ("\\.[tT]e[xX]\\'" . tex-mode)
 ("\\.ins\\'" . tex-mode) ("\\.ltx\\'" . latex-mode)
 ("\\.dtx\\'" . doctex-mode) ("\\.org\\'" . org-mode)
 ("\\.dir-locals\\(?:-2\\)?\\.el\\'" . lisp-data-mode)
 ("\\.eld\\'" . lisp-data-mode) ("eww-bookmarks\\'" . lisp-data-mode)
 ("tramp\\'" . lisp-data-mode)
 ("/archive-contents\\'" . lisp-data-mode)
 ("places\\'" . lisp-data-mode)
 ("\\.emacs-places\\'" . lisp-data-mode)
 ("\\.el\\'" . emacs-lisp-mode) ("Project\\.ede\\'" . emacs-lisp-mode)
 ("\\(?:\\.\\(?:scm\\|sls\\|sld\\|stk\\|ss\\|sch\\)\\|/\\.guile\\)\\'"
  . scheme-mode)
 ("\\.l\\'" . lisp-mode) ("\\.li?sp\\'" . lisp-mode)
 ("\\.[fF]\\'" . fortran-mode) ("\\.for\\'" . fortran-mode)
 ("\\.p\\'" . pascal-mode) ("\\.pas\\'" . pascal-mode)
 ("\\.\\(dpr\\|DPR\\)\\'" . delphi-mode)
 ("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . perl-mode)
 ("Imakefile\\'" . makefile-imake-mode)
 ("Makeppfile\\(?:\\.mk\\)?\\'" . makefile-makepp-mode)
 ("\\.makepp\\'" . makefile-makepp-mode)
 ("\\.mk\\'" . makefile-bsdmake-mode)
 ("\\.make\\'" . makefile-bsdmake-mode)
 ("GNUmakefile\\'" . makefile-gmake-mode)
 ("[Mm]akefile\\'" . makefile-bsdmake-mode)
 ("\\.am\\'" . makefile-automake-mode)
 ("\\.texinfo\\'" . texinfo-mode) ("\\.te?xi\\'" . texinfo-mode)
 ("\\.[sS]\\'" . asm-mode) ("\\.asm\\'" . asm-mode)
 ("\\.css\\'" . css-mode) ("\\.mixal\\'" . mixal-mode)
 ("\\.gcov\\'" . compilation-mode)
 ("/\\.[a-z0-9-]*gdbinit" . gdb-script-mode)
 ("-gdb\\.gdb" . gdb-script-mode)
 ("[cC]hange\\.?[lL]og?\\'" . change-log-mode)
 ("[cC]hange[lL]og[-.][0-9]+\\'" . change-log-mode)
 ("\\$CHANGE_LOG\\$\\.TXT" . change-log-mode)
 ("\\.scm\\.[0-9]*\\'" . scheme-mode)
 ("\\.[ckz]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode)
 ("\\.bash\\'" . sh-mode)
 ("/bash-fc\\.[0-9A-Za-z]\\{6\\}\\'" . sh-mode)
 ("/PKGBUILD\\'" . sh-mode)
 ("\\(/\\|\\`\\)\\.\\(bash_\\(profile\\|history\\|log\\(in\\|out\\)\\)\\|z?log\\(in\\|out\\)\\)\\'"
  . sh-mode)
 ("\\(/\\|\\`\\)\\.\\(shrc\\|zshrc\\|m?kshrc\\|bashrc\\|t?cshrc\\|esrc\\)\\'"
  . sh-mode)
 ("\\(/\\|\\`\\)\\.\\([kz]shenv\\|xinitrc\\|startxrc\\|xsession\\)\\'"
  . sh-mode)
 ("\\.m?spec\\'" . sh-mode) ("\\.m[mes]\\'" . nroff-mode)
 ("\\.man\\'" . nroff-mode) ("\\.sty\\'" . latex-mode)
 ("\\.cl[so]\\'" . latex-mode) ("\\.bbl\\'" . latex-mode)
 ("\\.bib\\'" . bibtex-mode) ("\\.bst\\'" . bibtex-style-mode)
 ("\\.sql\\'" . sql-mode)
 ("\\(acinclude\\|aclocal\\|acsite\\)\\.m4\\'" . autoconf-mode)
 ("\\.m[4c]\\'" . m4-mode) ("\\.mf\\'" . metafont-mode)
 ("\\.mp\\'" . metapost-mode) ("\\.vhdl?\\'" . vhdl-mode)
 ("\\.article\\'" . text-mode) ("\\.letter\\'" . text-mode)
 ("\\.i?tcl\\'" . tcl-mode) ("\\.exp\\'" . tcl-mode)
 ("\\.itk\\'" . tcl-mode) ("\\.icn\\'" . icon-mode)
 ("\\.sim\\'" . simula-mode) ("\\.mss\\'" . scribe-mode)
 ("\\.f9[05]\\'" . f90-mode) ("\\.f0[38]\\'" . f90-mode)
 ("\\.indent\\.pro\\'" . fundamental-mode)
 ("\\.\\(pro\\|PRO\\)\\'" . idlwave-mode)
 ("\\.srt\\'" . srecode-template-mode) ("\\.prolog\\'" . prolog-mode)
 ("\\.tar\\'" . tar-mode)
 ("\\.\\(arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|cbr\\|7z\\|squashfs\\|ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\|SQUASHFS\\)\\'"
  . archive-mode)
 ("\\.oxt\\'" . archive-mode)
 ("\\.\\(deb\\|[oi]pk\\)\\'" . archive-mode)
 ("\\`/tmp/Re" . text-mode) ("/Message[0-9]*\\'" . text-mode)
 ("\\`/tmp/fol/" . text-mode) ("\\.oak\\'" . scheme-mode)
 ("\\.sgml?\\'" . sgml-mode) ("\\.x[ms]l\\'" . xml-mode)
 ("\\.dbk\\'" . xml-mode) ("\\.dtd\\'" . sgml-mode)
 ("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
 ("\\.js[mx]?\\'" . javascript-mode) ("\\.har\\'" . javascript-mode)
 ("\\.json\\'" . js-json-mode) ("\\.[ds]?va?h?\\'" . verilog-mode)
 ("\\.by\\'" . bovine-grammar-mode) ("\\.wy\\'" . wisent-grammar-mode)
 ("\\.erts\\'" . erts-mode)
 ("[:/\\]\\..*\\(emacs\\|gnus\\|viper\\)\\'" . emacs-lisp-mode)
 ("\\`\\..*emacs\\'" . emacs-lisp-mode)
 ("[:/]_emacs\\'" . emacs-lisp-mode)
 ("/crontab\\.X*[0-9]+\\'" . shell-script-mode)
 ("\\.ml\\'" . lisp-mode) ("\\.ld[si]?\\'" . ld-script-mode)
 ("ld\\.?script\\'" . ld-script-mode) ("\\.xs\\'" . c-mode)
 ("\\.x[abdsru]?[cnw]?\\'" . ld-script-mode) ("\\.zone\\'" . dns-mode)
 ("\\.soa\\'" . dns-mode) ("\\.asd\\'" . lisp-mode)
 ("\\.\\(asn\\|mib\\|smi\\)\\'" . snmp-mode)
 ("\\.\\(as\\|mi\\|sm\\)2\\'" . snmpv2-mode)
 ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode)
 ("\\.\\(dif\\|pat\\)\\'" . diff-mode)
 ("\\.[eE]?[pP][sS]\\'" . ps-mode)
 ("\\.\\(?:PDF\\|EPUB\\|CBZ\\|FB2\\|O?XPS\\|DVI\\|OD[FGPST]\\|DOCX\\|XLSX?\\|PPTX?\\|pdf\\|epub\\|cbz\\|fb2\\|o?xps\\|djvu\\|dvi\\|od[fgpst]\\|docx\\|xlsx?\\|pptx?\\)\\'"
  . doc-view-mode-maybe)
 ("configure\\.\\(ac\\|in\\)\\'" . autoconf-mode)
 ("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
 ("BROWSE\\'" . ebrowse-tree-mode)
 ("\\.ebrowse\\'" . ebrowse-tree-mode) ("#\\*mail\\*" . mail-mode)
 ("\\.g\\'" . antlr-mode) ("\\.mod\\'" . m2-mode)
 ("\\.ses\\'" . ses-mode) ("\\.docbook\\'" . sgml-mode)
 ("\\.com\\'" . dcl-mode)
 ("/config\\.\\(?:bat\\|log\\)\\'" . fundamental-mode)
 ("/\\.?\\(authinfo\\|netrc\\)\\'" . authinfo-mode)
 ("\\.\\(?:[iI][nN][iI]\\|[lL][sS][tT]\\|[rR][eE][gG]\\|[sS][yY][sS]\\)\\'"
  . conf-mode)
 ("\\.la\\'" . conf-unix-mode) ("\\.ppd\\'" . conf-ppd-mode)
 ("java.+\\.conf\\'" . conf-javaprop-mode)
 ("\\.properties\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-javaprop-mode)
 ("\\.toml\\'" . conf-toml-mode) ("\\.desktop\\'" . conf-desktop-mode)
 ("/\\.redshift\\.conf\\'" . conf-windows-mode)
 ("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|pam\\.d/.*\\|permissions\\(?:\\.d/.+\\)?\\|protocols\\|rpc\\|services\\)\\'"
  . conf-space-mode)
 ("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'"
  . conf-mode)
 ("[cC]hange[lL]og[-.][-0-9a-z]+\\'" . change-log-mode)
 ("/\\.?\\(?:gitconfig\\|gnokiirc\\|hgrc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'"
  . conf-mode)
 ("/\\.mailmap\\'" . conf-unix-mode)
 ("/\\.\\(?:asound\\|enigma\\|fetchmail\\|gltron\\|gtk\\|hxplayer\\|mairix\\|mbsync\\|msmtp\\|net\\|neverball\\|nvidia-settings-\\|offlineimap\\|qt/.+\\|realplayer\\|reportbug\\|rtorrent\\.\\|screen\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'"
  . conf-mode)
 ("/\\.\\(?:gdbtkinit\\|grip\\|mpdconf\\|notmuch-config\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'"
  . conf-mode)
 ("/\\.?X\\(?:default\\|resource\\|re\\)s\\>" . conf-xdefaults-mode)
 ("/X11.+app-defaults/\\|\\.ad\\'" . conf-xdefaults-mode)
 ("/X11.+locale/.+/Compose\\'" . conf-colon-mode)
 ("/X11.+locale/compose\\.dir\\'" . conf-javaprop-mode)
 ("\\.~?[0-9]+\\.[0-9][-.0-9]*~?\\'" nil t)
 ("\\.\\(?:orig\\|in\\|[bB][aA][kK]\\)\\'" nil t)
 ("[/.]c\\(?:on\\)?f\\(?:i?g\\)?\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'"
  . conf-mode-maybe)
 ("\\.[1-9]\\'" . nroff-mode) ("\\.art\\'" . image-mode)
 ("\\.avs\\'" . image-mode) ("\\.bmp\\'" . image-mode)
 ("\\.cmyk\\'" . image-mode) ("\\.cmyka\\'" . image-mode)
 ("\\.crw\\'" . image-mode) ("\\.dcr\\'" . image-mode)
 ("\\.dcx\\'" . image-mode) ("\\.dng\\'" . image-mode)
 ("\\.dpx\\'" . image-mode) ("\\.fax\\'" . image-mode)
 ("\\.heic\\'" . image-mode) ("\\.hrz\\'" . image-mode)
 ("\\.icb\\'" . image-mode) ("\\.icc\\'" . image-mode)
 ("\\.icm\\'" . image-mode) ("\\.ico\\'" . image-mode)
 ("\\.icon\\'" . image-mode) ("\\.jbg\\'" . image-mode)
 ("\\.jbig\\'" . image-mode) ("\\.jng\\'" . image-mode)
 ("\\.jnx\\'" . image-mode) ("\\.miff\\'" . image-mode)
 ("\\.mng\\'" . image-mode) ("\\.mvg\\'" . image-mode)
 ("\\.otb\\'" . image-mode) ("\\.p7\\'" . image-mode)
 ("\\.pcx\\'" . image-mode) ("\\.pdb\\'" . image-mode)
 ("\\.pfa\\'" . image-mode) ("\\.pfb\\'" . image-mode)
 ("\\.picon\\'" . image-mode) ("\\.pict\\'" . image-mode)
 ("\\.rgb\\'" . image-mode) ("\\.rgba\\'" . image-mode)
 ("\\.tga\\'" . image-mode) ("\\.wbmp\\'" . image-mode)
 ("\\.webp\\'" . image-mode) ("\\.wmf\\'" . image-mode)
 ("\\.wpg\\'" . image-mode) ("\\.xcf\\'" . image-mode)
 ("\\.xmp\\'" . image-mode) ("\\.xwd\\'" . image-mode)
 ("\\.yuv\\'" . image-mode) ("\\.tgz\\'" . tar-mode)
 ("\\.tbz2?\\'" . tar-mode) ("\\.txz\\'" . tar-mode)
 ("\\.tzst\\'" . tar-mode))

In GNU Emacs 31.0.50 (build 1, x86_64-apple-darwin23.6.0, NS
appkit-2487.70 Version 14.7 (Build 23H124)) of 2024-09-28 built on
C02FM1E2MD6T
Repository revision: a8a3f04f8a7330e0d7e238e32715b4088c9e4275
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.7

Configured using:
'configure --with-native-compilation --with-xwidgets
--with-tree-sitter'

Configured features:
ACL DBUS GIF GLIB GMP GNUTLS JPEG LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM XWIDGETS ZLIB

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-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
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr compile comp-run comp-common emacsbug message
mailcap yank-media puny rfc822 mml mml-sec password-cache epa derived
epg rfc6068 epg-config gnus-util mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date pp cl-print
thingatpt cl-extra text-property-search noutline outline icons help-fns
radix-tree help-mode python rx compat pcase treesit comint subr-x
ansi-osc ring ansi-color misearch multi-isearch dired-aux dired
dired-loaddefs vc-git diff-mode track-changes easy-mmode vc-dispatcher
cl-seq project byte-opt gv bytecomp byte-compile cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win 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
kqueue cocoa ns lcms2 multi-tty make-network-process native-compile
emacs)

Memory information:
((conses 16 165338 10519) (symbols 48 9070 0) (strings 32 30402 1497)
(string-bytes 1 1237390) (vectors 16 16243)
(vector-slots 8 214615 10142) (floats 8 47 15) (intervals 56 8325 0)
(buffers 992 15))