1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-15 19:31:29 -07:00
emacs/test/lisp/progmodes
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
..
autoconf-resources Improve autoconf-mode macro detection 2025-02-17 17:28:05 -08:00
c-ts-mode-resources Fix c-ts-mode indentation (bug#75442) 2025-01-12 22:23:36 -08:00
cperl-mode-resources ; cperl-mode.el: Indent labels only in code (Bug#79271) 2025-08-22 12:42:00 +02:00
csharp-mode-resources Fix last change 2024-04-25 18:59:25 +03:00
elisp-mode-resources elisp-scope.el: Add variable value specifications 2026-02-18 19:42:47 +01:00
elixir-ts-mode-resources December 2025 spelling fixes 2025-12-26 10:22:12 -08:00
flymake-resources Send useless output in flymake-tests to /dev/null (bug#70716) 2024-08-28 19:47:40 +02:00
go-ts-mode-resources Merge from origin/emacs-30 2025-03-01 10:01:54 -05:00
heex-ts-mode-resources Add expression handling to heex-ts-mode 2025-01-03 09:41:15 +01:00
java-ts-mode-resources indent.erts (Code): Don't modify the global state 2025-03-19 15:53:37 -04:00
js-resources
lua-mode-resources ; Add tests for 'lua-mode' 2025-08-25 09:59:04 +08:00
lua-ts-mode-resources Fontify all comment delimiters in 'lua-ts-mode' 2025-08-30 11:31:34 +03:00
m4-mode-resources Improve m4-mode font lock 2026-02-22 17:10:17 +01:00
project-resources
ruby-mode-resources Fix indentation of keyword argument arrays/hashes in ruby-mode 2025-11-26 01:31:12 +02:00
rust-ts-mode-resources rust-ts-mode: handle invalid rust syntax without signaling 2025-08-21 19:59:04 +03:00
sh-script-resources Make sh-script-tests.el more robust 2024-04-05 19:43:56 +02:00
typescript-ts-mode-resources Fix typescript-ts-mode tenary indentation (bug#77901) 2025-06-01 16:14:12 -07:00
xref-resources
asm-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
autoconf-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
bat-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
bug-reference-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
c-ts-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
cc-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
compile-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
cperl-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
csharp-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
eglot-tests.el Fix new eglot test failure due to project cache 2026-02-13 05:22:15 +02:00
elisp-mode-tests.el Fix recent test suite regression (bug#80177) 2026-01-11 18:26:53 -05:00
elixir-ts-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
etags-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
executable-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
f90-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
flymake-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
gdb-mi-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
glasses-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
go-ts-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
grep-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
heex-ts-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
hideshow-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
java-ts-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
js-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
json-ts-mode-tests.el Add JSON path utility command to json-ts-mode 2026-01-21 19:27:03 +02:00
lua-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
lua-ts-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
m4-mode-tests.el Improve m4-mode font lock 2026-02-22 17:10:17 +01:00
make-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
octave-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
opascal-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
pascal-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
peg-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
perl-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
project-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ps-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
python-tests.el Use a custom Pdb class in the Python shell 2026-02-21 16:51:28 +02:00
ruby-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ruby-ts-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
rust-ts-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
scheme-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
sh-script-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
sql-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
subword-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
tcl-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
typescript-ts-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
which-func-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
xref-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00