GNU bug report logs -
#33852
26.1; unhighlight-regexp unnecessary prompt
Previous Next
Reported by: Xiansheng Ca <caxiansheng <at> gmail.com>
Date: Sun, 23 Dec 2018 18:19:02 UTC
Severity: minor
Tags: moreinfo
Found in version 26.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
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 33852 in the body.
You can then email your comments to 33852 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#33852
; Package
emacs
.
(Sun, 23 Dec 2018 18:19:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Xiansheng Ca <caxiansheng <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 23 Dec 2018 18:19:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello,
In hi-lock-mode, after highlighting a single regular expression such
as by M-s h r regexp <RET> <RET>, then unhighlighting with M-s h u,
I'm prompted "Regexp to unhighlight (default regexp):", but any choice
other than the default is rejected with the message "[No Match]". I
would prefer not to be prompted if there is only a single acceptable
choice.
I believe the patch below implements this proposed behavior. Thank you
for taking the time to consider this.
From c7918a6a09e91fc033a7288429ed4c466fba5e7c Mon Sep 17 00:00:00 2001
From: Ca Xiansheng <caxiansheng <at> gmail.com>
Date: Sun, 23 Dec 2018 03:30:50 -0600
Subject: [PATCH] * lisp/hi-lock.el (unhighlight-regexp): Do not prompt if one
choice.
---
lisp/hi-lock.el | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index 6eadd59..9377d84 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -602,13 +602,13 @@ then remove all hi-lock highlighting."
;; Infer the regexp to un-highlight based on cursor position.
(let* ((defaults (or (hi-lock--regexps-at-point)
(mapcar #'car hi-lock-interactive-patterns))))
- (list
- (completing-read (if (null defaults)
- "Regexp to unhighlight: "
- (format "Regexp to unhighlight (default %s): "
- (car defaults)))
- hi-lock-interactive-patterns
- nil t nil nil defaults))))))
+ (list (if (and (consp defaults) (null (cdr defaults))) (car defaults)
+ (completing-read (if (null defaults)
+ "Regexp to unhighlight: "
+ (format "Regexp to unhighlight
(default %s): "
+ (car defaults)))
+ hi-lock-interactive-patterns
+ nil t nil nil defaults)))))))
(dolist (keyword (if (eq regexp t) hi-lock-interactive-patterns
(list (assoc regexp hi-lock-interactive-patterns))))
(when keyword
--
2.20.1
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#33852
; Package
emacs
.
(Sat, 05 Jan 2019 08:57:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 33852 <at> debbugs.gnu.org (full text, mbox):
> From: Xiansheng Ca <caxiansheng <at> gmail.com>
> Date: Sun, 23 Dec 2018 04:49:30 -0600
>
> In hi-lock-mode, after highlighting a single regular expression such
> as by M-s h r regexp <RET> <RET>, then unhighlighting with M-s h u,
> I'm prompted "Regexp to unhighlight (default regexp):", but any choice
> other than the default is rejected with the message "[No Match]". I
> would prefer not to be prompted if there is only a single acceptable
> choice.
>
> I believe the patch below implements this proposed behavior. Thank you
> for taking the time to consider this.
> [...]
> + (list (if (and (consp defaults) (null (cdr defaults))) (car defaults)
> + (completing-read (if (null defaults)
> + "Regexp to unhighlight: "
> + (format "Regexp to unhighlight
> (default %s): "
> + (car defaults)))
> + hi-lock-interactive-patterns
> + nil t nil nil defaults)))))))
What happens if the command is invoked with point on a portion of text
that is highlighted by a hi-lock regexp? Wouldn't the command then
silently unhighlight only that regexp, and won't allow the user to
specify any other regexp?
IOW, if the list of completions has only one element (btw, this fact
can be more elegantly established by calling 'length'), it does not
necessarily mean that there's only one hi-lock regexp defined in the
buffer. Should we consider that as well?
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#33852
; Package
emacs
.
(Thu, 13 Aug 2020 12:16:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 33852 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Xiansheng Ca <caxiansheng <at> gmail.com>
>> Date: Sun, 23 Dec 2018 04:49:30 -0600
>>
>> In hi-lock-mode, after highlighting a single regular expression such
>> as by M-s h r regexp <RET> <RET>, then unhighlighting with M-s h u,
>> I'm prompted "Regexp to unhighlight (default regexp):", but any choice
>> other than the default is rejected with the message "[No Match]". I
>> would prefer not to be prompted if there is only a single acceptable
>> choice.
>>
>> I believe the patch below implements this proposed behavior. Thank you
>> for taking the time to consider this.
>> [...]
>> + (list (if (and (consp defaults) (null (cdr defaults))) (car defaults)
>> + (completing-read (if (null defaults)
>> + "Regexp to unhighlight: "
>> + (format "Regexp to unhighlight
>> (default %s): "
>> + (car defaults)))
>> + hi-lock-interactive-patterns
>> + nil t nil nil defaults)))))))
>
> What happens if the command is invoked with point on a portion of text
> that is highlighted by a hi-lock regexp? Wouldn't the command then
> silently unhighlight only that regexp, and won't allow the user to
> specify any other regexp?
>
> IOW, if the list of completions has only one element (btw, this fact
> can be more elegantly established by calling 'length'), it does not
> necessarily mean that there's only one hi-lock regexp defined in the
> buffer. Should we consider that as well?
That was 1.5 years ago. Any updates here? Xiansheng Ca, did you have a
chance to look at Eli's questions above?
Best regards,
Stefan Kangas
Added tag(s) moreinfo.
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Thu, 27 Aug 2020 12:50:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#33852
; Package
emacs
.
(Thu, 01 Oct 2020 01:58:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 33852 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefan <at> marxist.se> writes:
> That was 1.5 years ago. Any updates here? Xiansheng Ca, did you have a
> chance to look at Eli's questions above?
There was no followup here, so it seems unlikely that there'll be
further progress made in this bug report, and I'm closing it. If
progress can be made, please respond to the debbugs address and we'll
reopen the report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug closed, send any further explanations to
33852 <at> debbugs.gnu.org and Xiansheng Ca <caxiansheng <at> gmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 01 Oct 2020 01:59: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
.
(Thu, 29 Oct 2020 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 177 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.