Subject: Re: bug#32676: [PATCH] Add option to highlight the 'next-error' error message

From: Juri Linkov <[email-masked]>
Date: Wed, 14 Oct 2020 22:30:55 +0300

> I've now applied the patch (after reworking slightly), and it seems to
> work well, so I've pushed it to Emacs 28.
>
>> 1. compilation-current-error should be generalized not to be too
>>    compilation-specific;
>
> Reading the code, it looks like that variable is always set, even in
> grep buffers and the like?  So it's a bad name, but...

Unsurprisingly, now using occur fails with the error

  next-error-found: Symbol’s value as variable is void: compilation-current-error

and when compile.el is loaded, occur fails with the error

  next-error-found: Wrong type argument: integer-or-marker-p, nil

This fails only when next-error-message-highlight is customized to t,
so there is no need to revert the patch, but it should be fixed ASAP.

> Is there a different variable that should be used instead?

I can't find another variable.  Maybe a new variable should be created,
with a name like next-error-current.

Then compilation-current-error could be declared as an obsolete alias.
Or maybe there is no need to remove the old variable, so they both
could be used: compilation-current-error in compilation-mode,
and next-error-current elsewhere.

PS: I see compilation-current-error is used also in
next-error-follow-mode-post-command-hook, and it works fine
when 'C-c C-f' (next-error-follow-minor-mode)
in enabled in occur buffers.