1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-13 02:12:18 -07:00
emacs/test/lisp
Basil L. Contovounesios d01a33662c Improve m4-mode font lock
Emacs 28 started fontifying several 'composite' (non-builtin) GNU M4
macros which, while listed under '(m4) Macro index', are not defined
by GNU M4, and are included in its manual for illustrative purposes.

These macro keywords range from clearly misleading (e.g., 'example',
which the GNU M4 manual explicitly describes as nonexistent),
to common in Autoconf's M4sugar layer (e.g., 'm4_quote'),
to variations thereof (e.g., 'foreachq').

It is arguably too late to revert all of these additions, so this
patch selects a handful to remove, and categorizes the rest; this
should make it easier to hide some categories behind a font lock
level or user option in the future, if desired.

This patch reverts the Emacs 28 addition of 'example', and removes
the older 'file', 'line', and 'gnu' macros.  GNU M4 renamed 'gnu' to
'__gnu__' already in 1990; and I couldn't find references to the
other two which exist as '__file__' and '__line__', respectively.

The remaining macros are partitioned into three sets: built-in,
M4sugar-like, and other (bug#80412).  For discussion, see also:
https://lists.gnu.org/r/emacs-devel/2025-10/msg00357.html

* lisp/progmodes/m4-mode.el (m4-program-options): Remove stale
commentary.
(m4--macro-list): Remove, replacing with...
(m4--builtin, m4--autoconf, m4--composite): ...these new rx
definitions.  All uses changed.  Remove 'example', 'file', 'gnu',
and 'line' as keywords.
(m4-font-lock-keywords): For consistency with real #-comments,
fontify dnl macro with font-lock-comment-delimiter-face, and only
the rest of its line with font-lock-comment-face.  Fontify argument
references with font-lock-variable-use-face rather than
font-lock-variable-name-face.  Use font lock faces rather than their
eponymous but obsolete variables.  Remove redundant entries for $@
and $*.  Prefer shy regexp groups where applicable.
(m4-mode-syntax-table): Quote syntactically special characters.
(m4-m4-buffer): DRY using m4-m4-region.
(m4-m4-region): Take region bounds as optional arguments, as
recommended under '(elisp) The Mark'.  Quote shell command.
Support non-contiguous regions.
(m4-current-defun-name): Recognize m4 backtick in addition to
Autoconf bracket.  Prefer shy regexp groups where applicable.
(m4-mode): Simplify font-lock-defaults.

* test/lisp/progmodes/m4-mode-resources/font-lock.m4:
* test/lisp/progmodes/m4-mode-tests.el: New test files.
2026-02-22 17:10:17 +01:00
..
align-resources
auth-source-resources
bookmark-resources
calc calc: Improve handling of invalid 'calc-string-maximum-character' 2026-01-17 14:48:06 +02:00
calendar Support displaying more months in the calendar 2026-02-22 16:21:13 +02:00
cedet ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
custom-resources
dabbrev-resources ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
dired-resources/insert-directory
emacs-lisp ; Fix package-vc-tests for older versions of Git 2026-01-29 10:29:40 +02:00
emulation ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
epg-resources
erc ; Don't use cl-letf with generic function in ERC test 2026-01-11 05:25:03 -08:00
eshell Preserve the original order of Eshell aliases when loading 2026-02-21 17:13:46 -08:00
faces-resources ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
files-resources Ensure .dir-locals-2.el behavior as documented (bug#75890) 2025-03-22 16:47:27 -04:00
gnus ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
hfy-cmap-resources
image ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
international ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
language ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
loadhist-resources ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
mail Make Rmail summary address display customizable 2026-02-21 19:30:25 +02:00
mh-e ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
minibuffer-resources
net Escape attribute values and string DOMs when inserting them 2026-02-14 15:04:31 +02:00
nxml ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
obsolete ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
org ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
pcmpl-linux-resources
play ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
progmodes Improve m4-mode font lock 2026-02-22 17:10:17 +01:00
saveplace-resources
so-long-tests ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
term ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
textmodes ; Fix one of ispell-tests 2026-01-18 22:15:18 +02:00
time-resources
url ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
use-package ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
vc ; * test/lisp/vc/ediff-mult-tests.el: use ert-with-temp-directory 2026-02-05 17:36:18 +01:00
xdg-resources
abbrev-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
align-tests.el Fix aligning buffer regions containing multiple alignment sections 2026-02-05 10:51:16 +02:00
allout-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
allout-widgets-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ansi-color-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ansi-osc-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
apropos-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
arc-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
auth-source-pass-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
auth-source-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
autoinsert-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
autorevert-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
battery-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
bookmark-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
buff-menu-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
button-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
calculator-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
char-fold-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
color-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
comint-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
completion-preview-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
completion-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
cus-edit-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
custom-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
dabbrev-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
delim-col-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
descr-text-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
desktop-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
dired-aux-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
dired-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
dired-x-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
dnd-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
dom-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
edmacro-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
electric-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
elide-head-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
env-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
epg-config-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
epg-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
faces-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ffap-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
filenotify-tests.el ; Instrument filenotify test 2026-01-27 18:49:37 +01:00
files-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
files-x-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
find-cmd-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
follow-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
font-lock-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
format-spec-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
help-fns-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
help-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
help-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
hfy-cmap-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
hi-lock-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
hl-line-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
htmlfontify-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ibuffer-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ido-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
image-file-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
image-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
imenu-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
info-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
info-xref-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
isearch-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
jit-lock-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
json-tests.el Prefer value< with new 'sort' in json.el 2026-02-14 18:56:44 +01:00
jsonrpc-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
kmacro-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
loadhist-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
lpr-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ls-lisp-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
man-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
md4-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
minibuffer-tests.el Rewrite flex completion with Gotoh algorithm 2026-02-13 23:46:11 +00:00
misc-tests.el ; Minor changes to 'truncate-string-pixelwise' (bug#80244) 2026-02-07 14:49:15 +02:00
mouse-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
mwheel-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
newcomment-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
obarray-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
paren-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
password-cache-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
pcmpl-linux-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
pcomplete-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
proced-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ps-print-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
register-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
repeat-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
replace-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
rot13-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
savehist-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
saveplace-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
scroll-lock-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
server-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ses-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
shadowfile-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
shell-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
simple-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
sort-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
soundex-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
speedbar-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
sqlite-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
startup-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
subr-tests.el Support cons cell for 'line-spacing' 2026-01-24 13:32:44 +02:00
tab-bar-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
tabify-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
tar-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
tempo-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
term-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
thingatpt-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
thread-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
time-stamp-tests.el time-stamp-helper-string-used: New test 2026-01-05 15:23:01 -08:00
time-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
timezone-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
uniquify-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
version-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
visual-wrap-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
wdired-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
which-key-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
whitespace-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
wid-edit-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
winner-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
x-dnd-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
xdg-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
xml-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
xt-mouse-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
yank-media-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00