Subject: bug#75982: lisp-fontify-confusables failure with recent Ubuntu, Fedora

From: Anders Lindgren <[email-masked]>
Date: Sat, 1 Feb 2025 10:11:10 +0100

Hi!

I assume I was CC:ed since I'm the author of *faceup* (which is a package
for testing for font-lock packages). From what I read from the text the
code tries to verify that the package font-lock-confusables highlight the
buffer properly. (This package is new to me, but it appears to highlight
quotes in Emacs Lisp expressions.)

For example (on-line 1 ("«w:‘»foo \\‘foo") ("«w:«:quote:‘»»foo \\‘foo")
should be read that the quote character on the line should be highlighted
with font-lock-warning-face ("«w:‘») . However, this test fails since it is
highlighted both with font-lock-warning face and the face quote (
«w:«:quote:‘»»).

I don't know where the quote face is introduced. It's not in Emacs 29.4
that I use, but might be part of Emacs 30?

Anyway, to fix it you have to decide what the correct highlighting is and
adopt the test and/or font-lock-confusables accordingly. (Having two
packages highlight the same quote character, with different faces, seems a
little bit strange to me.)

Sincerely,
    Anders Lindgren

On Fri, Jan 31, 2025 at 11:24 PM Paul Eggert <[email-masked]> wrote:

> I get a test failure running "make check" with the latest Emacs master
> (commit bd39ec062d0078c97140b8ad4ddf7c47e6f6e4ee). I've been getting
> this for a while, on both Ubuntu 24.10 and Fedora 41 (both x86-64). Here
> are symptoms:
>
> $ (cd test && make lisp/emacs-lisp/lisp-mode-tests)
> make[1]: Entering directory '/home/eggert/src/gnu/emacs/tmp/test'
>    GEN      lisp/emacs-lisp/lisp-mode-tests.log
> Running 23 tests (2025-01-31 14:20:43-0800, selector ‘(not (or (tag
> :unstable) (tag :nativecomp)))’)
>     passed   1/23  indent-sexp (0.000801 sec)
>     passed   2/23  indent-sexp-cant-go (0.000081 sec)
>     passed   3/23  indent-sexp-go (0.000103 sec)
>     passed   4/23  indent-sexp-in-string (0.000070 sec)
>     passed   5/23  indent-sexp-stop (0.000074 sec)
>     passed   6/23  indent-sexp-stop-before-eol-comment (0.000069 sec)
>     passed   7/23  indent-sexp-stop-before-eol-non-lisp (0.014561 sec)
>     passed   8/23  indent-subsexp (0.000081 sec)
>     passed   9/23  lisp-comment-indent-1 (0.000105 sec)
>     passed  10/23  lisp-comment-indent-2 (0.000082 sec)
> '(description "This is a very long string which is indented by a
> considerable value, causing it to protrude from the configured
> `fill-column' since lisp-fill-paragraph was refactored in version 28.")
>     passed  11/23  lisp-fill-paragraph-as-displayed (0.000216 sec)
>     passed  12/23  lisp-fill-paragraph-docstring-boundaries (0.000118 sec)
> Test lisp-fontify-confusables backtrace:
>    signal(ert-test-failed (((should (faceup-test-font-lock-buffer 'emac
>    ert-fail(((should (faceup-test-font-lock-buffer 'emacs-lisp-mode fac
>    (if (unwind-protect (setq value-122 (apply fn-120 args-121)) (setq f
>    (let (form-description-124) (if (unwind-protect (setq value-122 (app
>    (let ((value-122 'ert-form-evaluation-aborted-123)) (let (form-descr
>    (let* ((fn-120 #'faceup-test-font-lock-buffer) (args-121 (condition-
>    (let ((faceup (buffer-string))) (faceup-clean-buffer) (let* ((fn-120
>    (progn (let ((tail '(8216 8217 8219 8220 8221 8223 12318 65282 65287
>    (unwind-protect (progn (let ((tail '(8216 8217 8219 8220 8221 8223 1
>    (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
>    (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current
>    #f(lambda () [t] (let ((temp-buffer (generate-new-buffer " *temp*" t
>    #f(compiled-function () #<bytecode -0x6d135f9ef4d75f7>)()
>    handler-bind-1(#f(compiled-function () #<bytecode -0x6d135f9ef4d75f7
>    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
>    ert-run-test(#s(ert-test :name lisp-fontify-confusables :documentati
>    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
>    ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
>    ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
>    ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
>    eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
>    command-line-1(("-L" ":." "-l" "ert" "--eval" "(setq treesit-extra-l
>    command-line()
>    normal-top-level()
> Test lisp-fontify-confusables condition:
>      (ert-test-failed
>       ((should (faceup-test-font-lock-buffer 'emacs-lisp-mode faceup))
>        :form
>        (faceup-test-font-lock-buffer emacs-lisp-mode
>                                     "«w:‘»foo \\‘foo\n«w:’»foo
> \\’foo\n«w:‛»foo \\‛foo\n«w:“»foo
> \\“foo\n«w:”»foo \\”foo\n«w:‟»foo \\‟foo\n«w:〞»foo \\〞foo\n«w:＂»foo
> \\＂foo\n«w:＇»foo \\＇foo\n")
>        :value nil :explanation
>        ((on-line 1 ("«w:‘»foo \\‘foo") ("«w:«:quote:‘»»foo \\‘foo"))
>         (on-line 2 ("«w:’»foo \\’foo") ("«w:«:quote:’»»foo \\’foo"))
>         (on-line 3 ("«w:‛»foo \\‛foo") ("«w:«:quote:‛»»foo \\‛foo"))
>         (on-line 4 ("«w:“»foo \\“foo") ("«w:«:quote:“»»foo \\“foo"))
>         (on-line 5 ("«w:”»foo \\”foo") ("«w:«:quote:”»»foo \\”foo"))
>         (on-line 6 ("«w:‟»foo \\‟foo") ("«w:«:quote:‟»»foo \\‟foo"))
>         (on-line 7 ("«w:〞»foo \\〞foo") ("«w:«:quote:〞»»foo \\〞foo"))
>         (on-line 8 ("«w:＂»foo \\＂foo") ("«w:«:quote:＂»»foo \\＂foo"))
>         (on-line 9 ("«w:＇»foo \\＇foo") ("«w:«:quote:＇»»foo \\＇foo")))))
>     FAILED  13/23  lisp-fontify-confusables (0.000562 sec) at
> lisp/emacs-lisp/lisp-mode-tests.el:361
> Indenting region...
> Indenting region...done
>     passed  14/23  lisp-indent-defun (0.000928 sec)
> Indenting region...
> Indenting region...done
> Indenting region...
> Indenting region...done
> Indenting region...
> Indenting region...done
>     passed  15/23  lisp-indent-region (0.000568 sec)
> Indenting region...
> Indenting region...done
>     passed  16/23  lisp-indent-region-after-string-literal (0.000118 sec)
> Indenting region...
> Indenting region...done
>     passed  17/23  lisp-indent-region-defun-with-docstring (0.000108 sec)
> Indenting region...
> Indenting region...done
>     passed  18/23  lisp-indent-region-in-sexp (0.000119 sec)
> Indenting region...
> Indenting region...done
>     passed  19/23  lisp-indent-region-open-paren (0.000102 sec)
> Indenting region...
> Indenting region...done
>     passed  20/23  lisp-indent-unfinished-string (0.000049 sec)
>     passed  21/23  lisp-indent-with-read-only-field (0.000048 sec)
>     passed  22/23  test-font-lock-keywords (0.002377 sec)
>     passed  23/23  test-lisp-current-defun-name (0.010519 sec)
>
> Ran 23 tests, 22 results as expected, 1 unexpected (2025-01-31
> 14:20:43-0800, 0.082472 sec)
>
> 1 unexpected results:
>     FAILED  lisp-fontify-confusables
>
> make[1]: *** [Makefile:185: lisp/emacs-lisp/lisp-mode-tests.log] Error 1
> make[1]: Leaving directory '/home/eggert/src/gnu/emacs/tmp/test'
> make: *** [Makefile:251: lisp/emacs-lisp/lisp-mode-tests] Error 2
>