emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs-30 6d94090cadc: * lisp/hi-lock.el: More fixes for revert-buffe


From: Andrea Corallo
Subject: Re: emacs-30 6d94090cadc: * lisp/hi-lock.el: More fixes for revert-buffer (bug#57534)
Date: Thu, 27 Jun 2024 15:03:32 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

Juri Linkov <juri@jurta.org> writes:

> branch: emacs-30
> commit 6d94090cadcff1b251457c2d82b287f4beb5a93d
> Author: Juri Linkov <juri@linkov.net>
> Commit: Juri Linkov <juri@linkov.net>
>
>     * lisp/hi-lock.el: More fixes for revert-buffer (bug#57534)
>     
>     (hi-lock-set-pattern): Put the text property 'regexp' on the lighter 
> string.
>     (hi-lock-revert-buffer-rehighlight): Get the real regexp from the
>     text property 'regexp'.  This fixes the case when the original
>     regexp gets lost after e.g. 'M-s . M-s h r'.
> ---
>  lisp/hi-lock.el | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
> index e1fa992cb12..c1b96431c16 100644
> --- a/lisp/hi-lock.el
> +++ b/lisp/hi-lock.el
> @@ -780,7 +780,10 @@ SPACES-REGEXP is a regexp to substitute spaces in 
> font-lock search."
>              (assoc (or lighter regexp) hi-lock-interactive-lighters))
>          (add-to-list 'hi-lock--unused-faces (face-name face))
>        (push pattern hi-lock-interactive-patterns)
> -      (push (cons (or lighter regexp) pattern) hi-lock-interactive-lighters)
> +      (push (cons (or (and lighter (propertize lighter 'regexp regexp))
> +                      regexp)
> +                  pattern)
> +            hi-lock-interactive-lighters)
>        (if (and font-lock-mode (font-lock-specified-p major-mode)
>                 (not hi-lock-use-overlays))
>         (progn
> @@ -888,7 +891,9 @@ Apply the previous patterns after reverting the buffer."
>            (setq hi-lock--unused-faces hi-lock-face-defaults)
>            (dolist (pattern (reverse patterns))
>              (let ((face (hi-lock-keyword->face (cdr pattern))))
> -              (highlight-regexp (car pattern) face)
> +              (highlight-regexp (or (get-text-property 0 'regexp (car 
> pattern))
> +                                    (car pattern))
> +                                face)
>                (setq hi-lock--unused-faces
>                      (remove (face-name face) hi-lock--unused-faces)))))))))
>  

Hi Juri,

just to mention this is causing a regression on my testbench:

FAILED  2/4  hi-lock-case-fold (0.000199 sec) at lisp/hi-lock-tests.el:53

Regards

  Andrea



reply via email to

[Prev in Thread] Current Thread [Next in Thread]