Subject: bug#55282: 27.2; Unknown symbols in compilation-error-regexp-alist cause

From: Troy Daniels <[email-masked]>
Date: Thu, 5 May 2022 17:24:36 -0400

(A description is also at
https://emacs.stackexchange.com/questions/71644/limiting-compilation-error-to-symbols-that-are-not-always-loaded/71650#71650
)

Summary: I have customized compilation-error-regexp-alist to only
include errors from languages that I frequently use.  This starts with

cargo rustc-colon rustc rustc-refs

Those values do not get added to compilation-error-regexp-alist-alist
until rust-mode is loaded.  If I start a compilation before I have
loaded a rust file (and thus loaded rust mode), compilation-parse-errors
repeatedly raises errors (dozens of times in a few seconds in a typical
case) and locks emacs until the compilation stops producing output.

If there is a symbol that maps to nil, that symbol should be silently
ignored (or a warning issued the first time a symbol fails to map).

It looks like the code after

    (if (symbolp item)
        (setq item (cdr (assq item
                              compilation-error-regexp-alist-alist))))

should be wrapped in (when ...) statement.

Reproduce:

$ emacs -Q
(require 'compile)
M-x customize-variable RET compilation-error-regexp-alist RET
Add a new entry: rust
Set for current session
M-x compile RET
Change the command from `make -k' to `yes'

At this point, emacs will make a strange noise, as it signals many
errors almost simultaneously.  *Messages* will have many instances of

error in process filter: cond: Wrong type argument: stringp, nil
error in process filter: Wrong type argument: stringp, nil

and the probably several

error in process filter: Variable binding depth exceeds max-specpdl-size

and related errors.

In GNU Emacs 27.2 (build 1, x86_64-apple-darwin20.6.0, NS appkit-2022.60
Version 11.6.4 (Build 20G417))
 of 2022-03-02 built on str-mac-0869
Windowing system distributor 'Apple', version 10.3.2022
System Description:  macOS 11.6.5

Recent messages:
[2022-05-05 16:50:49.075] Mark saved where search started
[2022-05-05 16:51:10.114] Mark saved where search started
[2022-05-05 16:51:35.161] Mark saved where search started
[2022-05-05 16:51:36.837] Mark set
[2022-05-05 16:55:40.613] Save file
/Users/tda0106/projects/sigmaPlus/git/py-mod-query-builder/queries/src/
arcs.rs? (y, n, !, ., q, C-r, C-f, d or C-h)
[2022-05-05 16:55:40.880] Save file
/Users/tda0106/projects/sigmaPlus/git/py-mod-query-builder/queries/src/
arcs.rs? (y, n, !, ., q, C-r, C-f, d or C-h) y
[2022-05-05 16:55:40.891] Saving file
/Users/tda0106/projects/sigmaPlus/git/py-mod-query-builder/queries/src/arcs.rs...
[2022-05-05 16:55:41.068] Formatted buffer with rustfmt.
Wrote
/Users/tda0106/projects/sigmaPlus/git/py-mod-query-builder/queries/src/
arcs.rs
[2022-05-05 17:01:08.968] Making completion list...

Configured using:
 'configure --enable-locallisppath=/usr/local/share/emacs/site-lisp
 --infodir=/usr/local/Cellar/emacs-head@27/27.2_1/share/info/emacs
 --prefix=/usr/local/Cellar/emacs-head@27/27.2_1 --without-x
 --without-dbus --with-imagemagick --with-modules --with-gnutls
 --with-rsvg --with-xml2 --with-xwidgets --with-ns
 --disable-ns-self-contained'

Configured features:
RSVG IMAGEMAGICK GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS XIM NS MODULES THREADS XWIDGETS JSON PDUMPER LCMS2
GMP

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

Major mode: Rust

Minor modes in effect:
  racer-mode: t
  treemacs-filewatch-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: t
  treemacs-fringe-indicator-mode: t
  which-function-mode: t
  global-semantic-decoration-mode: t
  global-semanticdb-minor-mode: t
  flycheck-color-mode-line-mode: t
  wucuo-mode: t
  highlight-indent-guides-mode: t
  idle-highlight-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  default-text-scale-mode: t
  balanced-windows-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  company-mode: t
  beacon-mode: t
  shell-dirtrack-mode: t
  pallet-mode: t
  pyvenv-tracking-mode: t
  pyvenv-mode: t
  ido-grid-mode: t
  global-hl-line-mode: t
  desktop-save-mode: t
  global-semantic-idle-breadcrumbs-mode: t
  global-semantic-idle-completions-mode: t
  global-semantic-idle-scheduler-mode: t
  global-semantic-idle-local-symbol-highlight-mode: t
  global-semantic-idle-summary-mode: t
  global-semantic-highlight-func-mode: t
  global-semantic-stickyfunc-mode: t
  semantic-mode: t
  show-paren-mode: t
  global-so-long-mode: t
  cl-old-struct-compat-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Load-path shadows:
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-xml
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-xml
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-csharp
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-csharp
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-erlang
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-erlang
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-haxe
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-haxe
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-terraform
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-terraform
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-pwsh
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-pwsh
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-elm
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-elm
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-html
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-html
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-mode-autoloads
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-mode-autoloads
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-verilog
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-verilog
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-vetur
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-vetur
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-clojure
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-clojure
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-yaml
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-yaml
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-eslint
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-eslint
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-solargraph
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-solargraph
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-fsharp
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-fsharp
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-vhdl
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-vhdl
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-pyls
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-pyls
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-mode
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-mode
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-css
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-css
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-json
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-json
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-go
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-go
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-rust
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-rust
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/lsp-mode-20220502.459/lsp-mode-pkg
hides /Users/tda0106/.emacs.d/elpa/lsp-mode-20200215.943/lsp-mode-pkg
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/cask-20220503.1109/cask
hides /usr/local/share/emacs/site-lisp/cask/cask
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/cask-20220503.1109/cask-bootstrap
hides /usr/local/share/emacs/site-lisp/cask/cask-bootstrap
/Users/tda0106/dotfiles/.emacs.d/.cask/27.2/elpa/eldoc-1.11.1/eldoc hides
/usr/local/Cellar/emacs-head@27
/27.2_1/share/emacs/27.2/lisp/emacs-lisp/eldoc

Features:
(shadow mail-extr emacsbug sendmail ediff company-semantic racer sort
find-dired rst conf-mode gitlab-ci-mode yaml-mode shell-here rust-utils
rust-mode rust-rustfmt rust-playpen rust-compile rust-cargo edebug
dabbrev jka-compr cl-print debug backtrace find-file-in-project
adaptive-wrap wucuo-flyspell-html-verify windmove find-file lsp-protocol
lsp-mode spinner markdown-mode noutline outline ewoc em-glob
dash-functional lsp-treemacs-themes treemacs treemacs-header-line
treemacs-compatibility treemacs-mode treemacs-bookmarks hydra lv thunk
treemacs-interface treemacs-extensions treemacs-mouse-interface
treemacs-tags treemacs-faces treemacs-persistence
treemacs-filewatch-mode treemacs-follow-mode treemacs-rendering
treemacs-annotations bookmark treemacs-async treemacs-visuals
treemacs-fringe-indicator treemacs-icons treemacs-themes
treemacs-workspaces treemacs-scope treemacs-dom treemacs-core-utils
treemacs-macros treemacs-logging treemacs-customization pfuture ht
inline posframe tar-mode autoload mm-archive message rfc822 mml mml-sec
epa epg gnus-util rmail rmail-loaddefs text-property-search mailabbrev
gmm-utils mailheader mm-decode mm-bodies mm-encode mail-utils gnutls
network-stream url-http mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr url-gw nsm rmc puny url-cache url-auth url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap epg-config semantic/tag-write
semantic/analyze/complete xml tabify ace-window avy semantic/complete
eieio-opt two-column misearch multi-isearch view hi-lock benchmark
semantic/db-typecache rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid
rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn
nxml-ns nxml-mode nxml-outln nxml-rap sgml-mode dom nxml-util nxml-enc
xmltok add-log semantic/edit powerline powerline-separators
adjust-parens ac-ispell auto-complete popup powerline-themes
my-manoj-dark-theme highlight-operators tmmofl jdibug jdibug-menu
jdibug-run jdibug-ui jdibug-expr jdibug-java-expr-wy jdi jdwp
jdibug-util bindat tree-mode elog cap-words superword subword
jdee-flycheck semantic/wisent/javascript-jv semantic/wisent/js-wy
which-func semantic/tag-file semantic/wisent/python
semantic/decorate/include semantic/db-find semantic/db-ref
semantic/decorate/mode semantic/dep semantic/wisent/python-wy
semantic/db-mode semantic/wisent/java-tags semantic/wisent/javat-wy
srecode/mode semantic/wisent semantic/wisent/wisent srecode/insert
srecode/filters srecode/args ede/speedbar ede/files ede ede/detect
ede/base ede/auto ede/source eieio-speedbar eieio-custom srecode/find
srecode/map srecode/ctxt srecode/compile srecode/dictionary
srecode/fields srecode/table srecode jdee-plugins jdee-package jdee
jdee-wiz jdee-test jdee-stacktrace jdee-refactor dired-aux
jdee-project-file jdee-maven jdee-keys jdee-jdb jdee-java-grammar
jdee-which-method jdee-font-lock jdee-issues jdee-help jdee-gen tempo
jdee-find jdee-deps jdee-cygwin jdee-custom jdee-compile jdee-class
jdee-bytecode jdee-bug jdee-run jdee-jdk-manager jdee-dbs jdee-dbo
jdee-widgets tree-widget jdee-db jdee-open-source semantic/senator
semantic/decorate jdee-import jdee-complete jdee-archive memoize
jdee-parse jdee-backend jdee-bsh jdee-util arc-mode archive-mode
jdee-parse-expr beanshell semantic/sb speedbar sb-image dframe
jdee-imenu semantic/imenu semantic/db-file data-debug cedet-files
semantic/java semantic/doc jdee-avl-tree avl-tree efc jdee-annotations
jdee-abbrev jdee-classpath jdee-files jdee-activator jdee-log
dockerfile-mode sh-script smie executable origami origami-parsers cl
json-mode json-snatcher js imenu cc-mode cc-fonts cc-guess cc-menus
cc-cmds vc-git flycheck-color-mode-line face-remap company-oddmuse
company-keywords company-etags company-gtags company-dabbrev-code
company-dabbrev company-files company-clang company-template
company-cmake company-bbdb wucuo wucuo-sdk find-lisp dired
dired-loaddefs flyspell ispell highlight-indent-guides color
idle-highlight-mode matlab matlab-scan matlab-syntax matlab-compat pulse
flycheck default-text-scale aggressive-indent balanced-windows
common-lisp-snippets java-snippets yasnippet highlight-indentation
flymake-proc flymake thingatpt company-capf company pcase help-fns
radix-tree elpy elpy-rpc elpy-shell elpy-profile elpy-django
elpy-refactor diff-mode python tramp-sh docker-tramp tramp-cache tramp
tramp-loaddefs trampver tramp-integration tramp-compat parse-time
iso8601 time-date ls-lisp format-spec hideshow files-x etags fileloop
generator xref project cus-edit wid-edit beacon bash-completion shell
pcomplete auto-auto-indent es-lib es-lib-total-line es-lib-lexical
es-lib-buffer-local-set-key es-lib-text-navigate es-lib-core-functions
es-lib-core-macros pallet hocon-mode use-package-core pyvenv eshell
esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups
esh-util ido-grid-mode hl-line ido desktop frameset server semantic/idle
semantic/analyze semantic/sort semantic/scope semantic/analyze/fcn
semantic/db eieio-base semantic/format ezimage semantic/tag-ls
semantic/find semantic/ctxt semantic/util-modes semantic/util semantic
pp semantic/tag semantic/lex semantic/fw mode-local find-func cedet
paren grep compile comint ring cus-start cus-load dmacro advice
autorevert filenotify ediff-merg ediff-mult ediff-wind ediff-diff
ediff-help ediff-util ediff-init sharp-sexp derived easy-mmode cc-styles
cc-align cc-engine cc-vars cc-defs edmacro kmacro string-inflection
ansi-color so-long no-littering compat rx warnings cask cl-extra
help-mode cask-bootstrap ansi package-recipe-mode package-build-badges
package-build package-recipe eieio-compat lisp-mnt shut-up epl git
commander f dash s finder-inf info package easymenu browse-url
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type 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 elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic 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 charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads
xwidget-internal kqueue cocoa ns lcms2 multi-tty make-network-process
emacs)

Memory information:
((conses 16 5984602 406751)
 (symbols 48 67667 2)
 (strings 32 551375 30743)
 (string-bytes 1 13484187)
 (vectors 16 293396)
 (vector-slots 8 3582139 430544)
 (floats 8 584 3866)
 (intervals 56 532087 2447)
 (buffers 1000 202))