Subject: Re: bug#28349: 26.0.50; compilation mode syntax highlighting incorrect

From: Richard Copley <[email-masked]>
Date: Sun, 10 Sep 2017 23:41:45 +0100

On 10 September 2017 at 20:57, Richard Copley <[email-masked]> wrote:
> On 10 September 2017 at 20:42, Eli Zaretskii <[email-masked]> wrote:
>>> From: Richard Copley <[email-masked]>
>>> Date: Sun, 10 Sep 2017 19:33:44 +0100
>>> Cc: Tom Tromey <[email-masked]>, [email-masked]
>>>
>>> Thanks. There seems to be another similar issue remaining.
>>> Font-locking still fails for some lines "at random". This time the errors are
>>>
>>> Error during redisplay: (jit-lock-function 94586) signaled
>>> (args-out-of-range 0 3)
>>> Error during redisplay: (jit-lock-function 284681) signaled
>>> (args-out-of-range 0 3)
>>> Error during redisplay: (jit-lock-function 285181) signaled
>>> (args-out-of-range 0 3)
>>
>> Can you show a more informative Lisp backtrace?
>
> If I disable jit-lock and enable debug-on-error, then re-run the
> compilation (toggling font-lock-mode is not sufficient), I get:
>
> Debugger entered--Lisp error: (args-out-of-range 0 3)
>   add-text-properties(0 3 (compilation-message #s(compilation--message
> :loc (nil 37 (("addpm.c" "c:/projects/emacs/nt") nil (37 #3)) nil nil)
> :type 0 :end-loc nil) help-echo "mouse-2: visit this file and line"
> keymap compilation-button-map mouse-face highlight))
>   compilation-parse-errors(6217 #<marker at 6913 in *compilation*>)
>   compilation--parse-region(6217 #<marker at 6913 in *compilation*>)
>   compilation--ensure-parse(6913)
>   font-lock-fontify-keywords-region(6217 6913 nil)
>   font-lock-default-fontify-region(6217 6913 nil)
>   font-lock-fontify-region(6217 6913)
>   font-lock-after-change-function(6217 6913 0)
>   compilation-filter(#<process compilation> "make[1]: Entering
> directory '/c/projects/emacs/lib'\n  AR       libgnu.a\nmake[1]:
> Leaving directory '/c/projects/emacs/lib'\nmake[1]: Entering directory
> '/c/projects/emacs/nt'\n  CCLD     addpm.exe\naddpm.c:42:0: warning:
> \"_WIN32_WINNT\" redefined\n #define _WIN32_WINNT _WIN32_WINNT_WIN7\n
> \nIn file included from
> C:/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10:0,\n
>         from C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:9,\n
>                 from
> addpm.c:37:\nC:/msys64/mingw64/x86_64-w64-mingw32/include/_mingw.h:225:0:
> note: this is the location of the previous definition\n #define
> _WIN32_WINNT 0x502\n \nmake[1]: Leaving directory
> '/c/projects/emacs/nt'\nmake -C lib-src all\n")

This is the backtrace when string-match sets the match data to (0 3):

  (file-truename (cdr file))
  (if (cdr file) (progn (file-truename (cdr file)) (debug)))
  (let ((filename (car file)) (spec-directory (if (cdr file)
(file-truename (cdr file))))) (if (and (boundp
'comint-file-name-prefix) (not (equal comint-file-name-prefix "")))
(progn (if (file-name-absolute-p filename) (setq filename (concat
comint-file-name-prefix filename)) (if spec-directory (setq
spec-directory (file-truename (concat comint-file-name-prefix
spec-directory))))))) (if compilation-parse-errors-filename-function
(progn (setq filename (funcall
compilation-parse-errors-filename-function filename)))) (setq filename
(command-line-normalize-file-name filename)) (puthash file (or
(gethash (cons filename spec-directory) compilation-locs) (puthash
(cons filename spec-directory) (cons (list filename spec-directory)
(cons fmt nil)) compilation-locs)) compilation-locs))
  (or (gethash file compilation-locs) (let ((filename (car file))
(spec-directory (if (cdr file) (file-truename (cdr file))))) (if (and
(boundp 'comint-file-name-prefix) (not (equal comint-file-name-prefix
""))) (progn (if (file-name-absolute-p filename) (setq filename
(concat comint-file-name-prefix filename)) (if spec-directory (setq
spec-directory (file-truename (concat comint-file-name-prefix
spec-directory))))))) (if compilation-parse-errors-filename-function
(progn (setq filename (funcall
compilation-parse-errors-filename-function filename)))) (setq filename
(command-line-normalize-file-name filename)) (puthash file (or
(gethash (cons filename spec-directory) compilation-locs) (puthash
(cons filename spec-directory) (cons (list filename spec-directory)
(cons fmt nil)) compilation-locs)) compilation-locs)))
  compilation-get-file-structure(("addpm.c" . "/c/projects/emacs/nt") nil)
  compilation-internal-error-properties(("addpm.c" .
"/c/projects/emacs/nt") 37 nil nil nil 0 nil)
  compilation-error-properties(1 2 nil 3 nil 0 nil)
  compilation-parse-errors(290 #<marker at 742 in *compilation*>)
  compilation--parse-region(290 #<marker at 742 in *compilation*>)
  compilation--ensure-parse(742)
  font-lock-fontify-keywords-region(290 742 nil)
  font-lock-default-fontify-region(290 742 nil)
  font-lock-fontify-region(290 742)
  font-lock-after-change-function(290 742 0)
  compilation-filter(#<process compilation> "  CCLD
addpm.exe\naddpm.c:42:0: warning: \"_WIN32_WINNT\" redefined\n #define
_WIN32_WINNT _WIN32_WINNT_WIN7\n \nIn file included from
C:/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10:0,\n
        from C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:9,\n
                from
addpm.c:37:\nC:/msys64/mingw64/x86_64-w64-mingw32/include/_mingw.h:225:0:
note: this is the location of the previous definition\n #define
_WIN32_WINNT 0x502\n \n")