Subject: Re: bug#2490: compilation only highlights the "E" of error

From: Johan Bockgård <[email-masked]>
Date: Mon, 11 Jul 2011 23:12:40 +0200

Lars Magne Ingebrigtsen <[email-masked]> writes:

> Glenn Morris <[email-masked]> writes:
>
>> emacs -Q foo.el, where foo.el contains everything between start and end:
>>
>> ;; start
>> (setq foo 1)
>>
>> (
>> ;; end
>>
>> M-x byte-compile-file RET foo.el RET
>>
>> The "*Compile-Log*" buffer contains:
>>
>>  foo.el:1:7:Warning: assignment to free variable `foo'
>>  foo.el:3:1:Error: End of file during parsing
>>
>> On the warning line, everything up to and including the "g" in "Warning"
>> is underlined and has mouse-face.
>>
>> On the error line, the underline/mouse-face stops at the "E" in error.
>
> I'm able to reproduce this in Emacs 24, but I'm not able to make any
> sense of how compilation mode parses and fontifies the buffer...

font-lock-keywords -> compilation--ensure-parse ->
compilation--parse-region -> compilation-parse-errors ->
compilation-error-regexp-alist-alist

The lines in *Compile-Log* are matched by the `gnu' entry in
compilation-error-regexp-alist-alist (try `compilation-debug'):

     "^\\(?:[[:alpha:]][-[:alnum:].]+: ?\\|[ \t]+\\(?:in \\|from \\)\\)?\
\\([0-9]*[^0-9\n]\\(?:[^\n :]\\| [^-/\n]\\|:[^ \n]\\)*?\\): ?\
\\([0-9]+\\)\\(?:[.:]\\([0-9]+\\)\\)?\
\\(?:-\\([0-9]+\\)?\\(?:\\.\\([0-9]+\\)\\)?\\)?:\
\\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\
                                   ^^^^^^^^^^
 *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\|instantiated from\\|[Nn]ote\\)\\|\
\[0-9]?\\(?:[^0-9\n]\\|$\\)\\|[0-9][0-9][0-9]\\)"
            ^^^^^^^^
               E(rror)