Subject: bug#39121: 27.0.60; occur: Add bindings for next-error-no-select

From: Juri Linkov <[email-masked]>
Date: Fri, 16 Jul 2021 01:10:44 +0300

> Sorry about stirring in this pile again, but it looks like there is
> unfinished business with respect to `occur-highlight-regexp`
> introduced by this patch:
>
> +(defvar occur-highlight-regexp t
> +  "Regexp matching part of visited source lines to highlight temporarily.
> +Highlight entire line if t; don't highlight source lines if nil.")
>
> Are the t and nil cases really handled? As far as I can tell:
>
> - `occur-mode-goto-occurrence` and `occur-mode-display-occurrence`
>    both crash if `occur-highlight-regexp` isn't a string
> - `occur--highlight-occurrence` does not distinguish t from nil
> - `occur--highlight-occurrence` is only called from the two other (crashing) functions
>
> This was discovered when using an external package that uses
> occur-mode for their own purposes and don't actually have a regexp to
> match (only start and end markers).
>
> Since `occur-highlight-regexp` appears to serve an internal purpose only,
> perhaps we can use some other method to get at the text to highlight?

It seems `compilation-highlight-regexp` was supposed to duplicate the logic
of the existing variable `compilation-highlight-regexp` that is t by default.
But I see such conditions `(stringp highlight-regexp)` in `compilation-goto-locus`,
so maybe 'occur' needs to do the same.