[A68-MODE][COMMITTED] a68-font-lock-keywords: fix _ in bold tags and quote faces properly

Jose E. Marchesi jemarch@gnu.org
Fri Mar 21 21:28:22 GMT 2025


Also highlight trailing _s in bold tags (which get ignored by both
Algol 68 Genie and GCC) with a warning face.

Thanks to Stefan Monnier for reporting these problems and for
suggesting solutions.
---
 a68-mode.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/a68-mode.el b/a68-mode.el
index d936bf1..a06fa4a 100644
--- a/a68-mode.el
+++ b/a68-mode.el
@@ -101,19 +101,21 @@
    (cons (rx word-start
              (eval `(or ,@a68-keywords))
              word-end)
-         'font-lock-keyword-face)
+         ''font-lock-keyword-face)
    (cons (rx word-start
              (eval `(or ,@a68-std-modes))
              word-end)
-         'font-lock-type-face)
+         ''font-lock-type-face)
    (cons (rx word-start
              (or "TRUE" "FALSE")
              word-end)
-         'font-lock-constant-face)
+         ''font-lock-constant-face)
    ;; only valid for bold stropping
-   (cons (concat "\\<[A-Z]+[A-Z_]*\\>") 'font-lock-type-face)
+   '("\\<\\([A-Z]+[A-Z_]*\\>\\)\\(_+\\)?"
+     (1 'font-lock-type-face)
+      (2 'font-lock-warning-face nil t))
    (cons "\\('\\w*'\\)"
-         'font-lock-variable-name-face))
+         ''font-lock-variable-name-face))
   "Highlighting expressions for Algol 68 mode.")
 
 (defun a68-within-string ()
-- 
2.30.2



More information about the Algol68 mailing list