* Re: emacs-30 6d94090cadc: * lisp/hi-lock.el: More fixes for revert-buffer (bug#57534)
[not found] ` <20240627180913.2E298C1FB74@vcs2.savannah.gnu.org>
@ 2024-06-27 19:03 ` Andrea Corallo
2024-06-28 6:43 ` remove-overlays test [was: * lisp/hi-lock.el: More fixes for revert-buffer (bug#57534)] Juri Linkov
0 siblings, 1 reply; 3+ messages in thread
From: Andrea Corallo @ 2024-06-27 19:03 UTC (permalink / raw)
To: emacs-devel; +Cc: Juri Linkov
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* remove-overlays test [was: * lisp/hi-lock.el: More fixes for revert-buffer (bug#57534)]
2024-06-27 19:03 ` emacs-30 6d94090cadc: * lisp/hi-lock.el: More fixes for revert-buffer (bug#57534) Andrea Corallo
@ 2024-06-28 6:43 ` Juri Linkov
2024-06-28 11:54 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2024-06-28 6:43 UTC (permalink / raw)
To: Andrea Corallo; +Cc: emacs-devel
> just to mention this is causing a regression on my testbench:
Thanks for the heads-up. The problem is that in 'remove-overlays'
values are compared with 'eq', and there is no way to specify
another test function.
This important detail is still missing in (info "(elisp) Managing Overlays")
(this could be added now), whereas the docstring was updated recently via
bug#13648.
This example demonstrates the problem:
(with-temp-buffer
(insert "str")
(let ((prop "a")
(ov (make-overlay (point-min) (point-max))))
(overlay-put ov 'prop prop)
(remove-overlays nil nil 'prop prop)
(overlays-in (point-min) (point-max))))
=> nil
(with-temp-buffer
(insert "str")
(let ((ov (make-overlay (point-min) (point-max))))
(overlay-put ov 'prop "a")
(remove-overlays nil nil 'prop "a")
(overlays-in (point-min) (point-max))))
=> (#<overlay in no buffer>)
So this is fixed now by using the same string for 'eq'.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: remove-overlays test [was: * lisp/hi-lock.el: More fixes for revert-buffer (bug#57534)]
2024-06-28 6:43 ` remove-overlays test [was: * lisp/hi-lock.el: More fixes for revert-buffer (bug#57534)] Juri Linkov
@ 2024-06-28 11:54 ` Eli Zaretskii
0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2024-06-28 11:54 UTC (permalink / raw)
To: Juri Linkov; +Cc: acorallo, emacs-devel
> From: Juri Linkov <juri@linkov.net>
> Cc: emacs-devel@gnu.org
> Date: Fri, 28 Jun 2024 09:43:30 +0300
>
> > just to mention this is causing a regression on my testbench:
>
> Thanks for the heads-up. The problem is that in 'remove-overlays'
> values are compared with 'eq', and there is no way to specify
> another test function.
>
> This important detail is still missing in (info "(elisp) Managing Overlays")
> (this could be added now), whereas the docstring was updated recently via
> bug#13648.
Please in the future when you find some documentation flaw, fix that
right away. Keeping our documentation in good shape is a shared
responsibility of all of us, and leaving this unfixed runs the risk of
missing the opportunities to fix it.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-28 11:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <171951175019.5752.4559993590758222831@vcs2.savannah.gnu.org>
[not found] ` <20240627180913.2E298C1FB74@vcs2.savannah.gnu.org>
2024-06-27 19:03 ` emacs-30 6d94090cadc: * lisp/hi-lock.el: More fixes for revert-buffer (bug#57534) Andrea Corallo
2024-06-28 6:43 ` remove-overlays test [was: * lisp/hi-lock.el: More fixes for revert-buffer (bug#57534)] Juri Linkov
2024-06-28 11:54 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).