Subject: Re: bug#14595: Erroneous composition of lambda in emacs-lisp buffers with prog-prettify-symbols enabled

From: Juanma Barranquero <[email-masked]>
Date: Sat, 15 Jun 2013 19:35:38 +0200

On Sat, Jun 15, 2013 at 11:12 AM, Eli Zaretskii <[email-masked]> wrote:

> The incorrect display happens when the underlined part below
>
>       (compose-region start end (cdr (assoc (match-string 0) alist)))))
>                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> is nil.  When that happens, (match-string 0) is "(", the left
> parenthesis, not the expected "lambda".

The call to syntax-ppss inside prog--prettify-font-lock-compose-symbol
is altering the match-string data. I saved (match-string 0) in the
let* as ms0, and then for the erroneous lines I get this log:

start = 2507 / end = 2513 / (match-string 0) = #("(" 0 1 (fontified
t)) / ms0 = #("lambda" 0 6 (fontified t)) / alist = (("lambda" . 955))

so it was correct when the function was called. Then I wrapped the
syntax-ppss call inside save-match-data and the bug disappears.

> I hope fontification gurus will be able to tell us why this could
> happen.

Yep.