branch: master commit 08e7f159e8abe971608aea8cd9b08ec204c8ab8e Author: Arash Esbati <ar...@gnu.org> Commit: Arash Esbati <ar...@gnu.org>
Improve fontification of arguments * font-latex.el (font-latex-built-in-keyword-classes): Improve fontification of arguments provided as macros and not inside braces. * tests/latex/font-latex-test.el (font-latex-general-fontification): Adjust test. --- font-latex.el | 6 +++--- tests/latex/font-latex-test.el | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/font-latex.el b/font-latex.el index ec99d54c..70186748 100644 --- a/font-latex.el +++ b/font-latex.el @@ -241,9 +241,9 @@ variable `font-latex-fontify-sectioning'." ',num) "makeatletter" "makeatother" "newblock" "suppressfloats" "endinput") font-latex-warning-face 1 noarg) ("variable" - (("setlength" "|{\\{") ("settowidth" "|{\\{") ("settoheight" "{{") - ("settodepth" "{{") ("setcounter" "{|{\\") - ("addtolength" "|{\\{") ("addtocounter" "{|{\\") + (("setlength" "|{\\|{\\") ("addtolength" "|{\\|{\\") + ("settowidth" "|{\\|{\\") ("settoheight" "|{\\|{\\") ("settodepth" "|{\\|{\\") + ("setcounter" "{|{\\") ("addtocounter" "{|{\\") ("stepcounter" "{") ("refstepcounter" "{") ("counterwithin" "*[{{") ("counterwithout" "*[{{") ("arabic" "{") ("roman" "{") ("Roman" "{") ("alph" "{") ("Alph" "{") diff --git a/tests/latex/font-latex-test.el b/tests/latex/font-latex-test.el index 94150ac0..3039bf15 100644 --- a/tests/latex/font-latex-test.el +++ b/tests/latex/font-latex-test.el @@ -1,6 +1,6 @@ ;;; font-latex-test.el --- tests for font-latex -*- lexical-binding: t; -*- -;; Copyright (C) 2020-2023 Free Software Foundation, Inc. +;; Copyright (C) 2020-2024 Free Software Foundation, Inc. ;; This file is part of AUCTeX. @@ -107,6 +107,10 @@ $a$") (font-latex-fontify-sectioning 'color)) (insert "\ \\documentclass[10pt]{article} + +\\setlength{\\parskip}{3cm} +\\addtolength\\parskip\\foo + \\begin{document} \\section{Macros} @@ -186,6 +190,17 @@ x (should (font-latex-faces-present-p 'font-lock-function-name-face)) (end-of-line) + ;; Test for \setlength alternatives: + (re-search-forward "\\\\setlength{\\\\p") + (should (font-latex-faces-present-p 'font-lock-variable-name-face + (match-end 0))) + (re-search-forward "\\\\addtolength\\\\p") + (should (font-latex-faces-present-p 'font-lock-variable-name-face + (match-end 0))) + (re-search-forward "\\\\f") + (should (font-latex-faces-present-p 'font-lock-variable-name-face + (match-end 0))) + ;; Test for \section macro itself: (re-search-forward "\\\\sec\\(?1:t\\)ion{") (should (font-latex-faces-present-p 'font-lock-keyword-face