GNU bug report logs -
#60241
29.0.60; Fix regexp pattern case in hi-lock
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Wed, 21 Dec 2022 17:30:03 UTC
Severity: normal
Tags: patch
Fixed in version 29.0.60
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60241 in the body.
You can then email your comments to 60241 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60241
; Package
emacs
.
(Wed, 21 Dec 2022 17:30:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> linkov.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 21 Dec 2022 17:30:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Version: 29.0.60
Tags: patch
0. emacs -Q
1. Type [ M-< C-s [ M-s h r RET M-s h u
Debugger entered--Lisp error: (invalid-regexp "Unmatched [ or [^")
hi-lock--regexps-at-point()
command-execute(unhighlight-regexp)
Here is a patch to fix this error:
[hi-lock--regexps-at-point.patch (text/x-diff, inline)]
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index a45e74eca26..bc631747e6d 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -569,24 +569,29 @@ hi-lock--regexps-at-point
(when (and face-before face-after (not (eq face-before face-after)))
(setq face-before nil))
(when (or face-after face-before)
- (let* ((hi-text
- (buffer-substring-no-properties
- (if face-before
- (or (previous-single-property-change (point) 'face)
- (point-min))
- (point))
- (if face-after
- (or (next-single-property-change (point) 'face)
- (point-max))
- (point)))))
+ (let* ((beg (if face-before
+ (or (previous-single-property-change (point) 'face)
+ (point-min))
+ (point)))
+ (end (if face-after
+ (or (next-single-property-change (point) 'face)
+ (point-max))
+ (point))))
;; Compute hi-lock patterns that match the
;; highlighted text at point. Use this later in
;; during completing-read.
(dolist (hi-lock-pattern hi-lock-interactive-patterns)
- (let ((regexp (or (car (rassq hi-lock-pattern hi-lock-interactive-lighters))
- (car hi-lock-pattern))))
- (if (string-match regexp hi-text)
- (push regexp regexps)))))))
+ (let ((pattern (or (rassq hi-lock-pattern hi-lock-interactive-lighters)
+ (car hi-lock-pattern))))
+ (cond
+ ((stringp pattern)
+ (when (string-match pattern (buffer-substring-no-properties beg end))
+ (push pattern regexps)))
+ ((functionp (cadr pattern))
+ (save-excursion
+ (goto-char beg)
+ (when (funcall (cadr pattern) end)
+ (push (car pattern) regexps))))))))))
regexps))
(defvar-local hi-lock--unused-faces nil
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60241
; Package
emacs
.
(Thu, 29 Dec 2022 17:47:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 60241 <at> debbugs.gnu.org (full text, mbox):
close 60241 29.0.60
quit
> 1. Type [ M-< C-s [ M-s h r RET M-s h u
>
> Debugger entered--Lisp error: (invalid-regexp "Unmatched [ or [^")
> hi-lock--regexps-at-point()
> command-execute(unhighlight-regexp)
>
> Here is a patch to fix this error:
Pushed and closed.
bug marked as fixed in version 29.0.60, send any further explanations to
60241 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net>
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org
.
(Thu, 29 Dec 2022 17:47:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 27 Jan 2023 12:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 147 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.