GNU bug report logs - #14015
Feature request: highlight partial matches in Info's index-search

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Thu, 21 Mar 2013 17:38:01 UTC

Severity: wishlist

Done: Juri Linkov <juri <at> jurta.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 14015 in the body.
You can then email your comments to 14015 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14015; Package emacs. (Thu, 21 Mar 2013 17:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eli Zaretskii <eliz <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 21 Mar 2013 17:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Feature request: highlight partial matches in Info's index-search
Date: Thu, 21 Mar 2013 19:24:00 +0200
When 'i foo RET' yields a partial match, e.g., finding "foobar" in the
index, the stand-alone Info reader "highlights" the part that matched,
like this:

   Found FOObar in Some Node. (`,' tries to find next.)

(The stand-alone reader is a text-mode program, so it changes the
letter-case to emphasize the part that matched.)

It would be nice if Emacs did something similar, although it is
probably better to use colors if available.  (We could also use bold
or italic, but at least bold might cause annoying movement of the mode
line, to allow for slightly larger font.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14015; Package emacs. (Thu, 21 Mar 2013 22:37:02 GMT) Full text and rfc822 format available.

Message #8 received at 14015 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 14015 <at> debbugs.gnu.org
Subject: Re: bug#14015: Feature request: highlight partial matches in Info's
	index-search
Date: Fri, 22 Mar 2013 00:31:56 +0200
> When 'i foo RET' yields a partial match, e.g., finding "foobar" in the
> index, the stand-alone Info reader "highlights" the part that matched,
> like this:
>
>    Found FOObar in Some Node. (`,' tries to find next.)
>
> (The stand-alone reader is a text-mode program, so it changes the
> letter-case to emphasize the part that matched.)
>
> It would be nice if Emacs did something similar, although it is
> probably better to use colors if available.

info-look.el uses the following face to highlight found matches
in the Info reader:

  (defcustom info-lookup-highlight-face 'match
    "Face for highlighting looked up help items.
  Setting this variable to nil disables highlighting."
    :group 'info-lookup :type 'face)

Adding a similar face option to highlight the text matched by `Info-index'
will change the output of `Info-virtual-index' and `info-apropos'
to look exactly the same like as output of `occur' that is good
for consistency of the UI.  This is in addition to highlighting
the matches in the each area that you asked for:

=== modified file 'lisp/info.el'
--- lisp/info.el	2013-03-20 23:04:40 +0000
+++ lisp/info.el	2013-03-21 22:30:34 +0000
@@ -158,6 +158,13 @@ (defface info-header-node
   "Face for Info nodes in a node header."
   :group 'info)
 
+(defcustom Info-index-match-face 'match
+  "Face used by \\[Info-index] to show the text that matches.
+If the value is nil, don't highlight the matching portions specially."
+  :type 'face
+  :group 'info
+  :version "24.4")
+
 ;; This is a defcustom largely so that we can get the benefit
 ;; of custom-initialize-delay.  Perhaps it would work to make it a
 ;; defvar and explicitly give it a standard-value property, and
@@ -3295,12 +3302,14 @@ (defun Info-index (topic)
 	      (progn
 		(goto-char (point-min))
 		(while (re-search-forward pattern nil t)
-		  (push (list (match-string-no-properties 1)
-			      (match-string-no-properties 2)
-			      Info-current-node
-			      (string-to-number (concat "0"
-							(match-string 3))))
-			matches))
+		  (let ((entry (match-string-no-properties 1))
+			(nodename (match-string-no-properties 2))
+			(line (string-to-number (concat "0" (match-string 3)))))
+		    (when (and Info-index-match-face
+			       (string-match (regexp-quote topic) entry))
+		      (add-text-properties (match-beginning 0) (match-end 0)
+					   `(face ,Info-index-match-face) entry))
+		    (push (list entry nodename Info-current-node line) matches)))
 		(setq nodes (cdr nodes) node (car nodes)))
 	    (Info-goto-node node))
 	  (or matches
@@ -3559,12 +3568,15 @@ (defun Info-apropos-matches (string)
                         (progn
                           (goto-char (point-min))
                           (while (re-search-forward pattern nil t)
-			    (setq matches
-				  (cons (list manual
-					      (match-string-no-properties 1)
-					      (match-string-no-properties 2)
-					      (match-string-no-properties 3))
-					matches)))
+			    (let ((entry (match-string-no-properties 1))
+				  (nodename (match-string-no-properties 2))
+				  (line (match-string-no-properties 3)))
+			      (when (and Info-index-match-face
+					 (string-match (regexp-quote string) entry))
+				(add-text-properties (match-beginning 0) (match-end 0)
+						     `(face ,Info-index-match-face) entry))
+			      (setq matches (cons (list manual entry nodename line)
+						  matches))))
                           (setq nodes (cdr nodes) node (car nodes)))
                       (Info-goto-node node))))
 	    (error





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14015; Package emacs. (Fri, 22 Mar 2013 01:33:02 GMT) Full text and rfc822 format available.

Message #11 received at 14015 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> jurta.org>
Cc: 14015 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#14015: Feature request: highlight partial matches in Info's
	index-search
Date: Thu, 21 Mar 2013 21:29:50 -0400
> +(defcustom Info-index-match-face 'match
> +  "Face used by \\[Info-index] to show the text that matches.
> +If the value is nil, don't highlight the matching portions specially."
> +  :type 'face
> +  :group 'info
> +  :version "24.4")

Nowadays, we usually prefer to define a new face that inherits from
`match'.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14015; Package emacs. (Fri, 22 Mar 2013 10:11:02 GMT) Full text and rfc822 format available.

Message #14 received at 14015 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: 14015 <at> debbugs.gnu.org
Subject: Re: bug#14015: Feature request: highlight partial matches in Info's
	index-search
Date: Fri, 22 Mar 2013 12:08:59 +0200
> From: Juri Linkov <juri <at> jurta.org>
> Cc: 14015 <at> debbugs.gnu.org
> Date: Fri, 22 Mar 2013 00:31:56 +0200
> 
> >    Found FOObar in Some Node. (`,' tries to find next.)
> >
> > (The stand-alone reader is a text-mode program, so it changes the
> > letter-case to emphasize the part that matched.)
> >
> > It would be nice if Emacs did something similar, although it is
> > probably better to use colors if available.
> 
> info-look.el uses the following face to highlight found matches
> in the Info reader:
> 
>   (defcustom info-lookup-highlight-face 'match
>     "Face for highlighting looked up help items.
>   Setting this variable to nil disables highlighting."
>     :group 'info-lookup :type 'face)
> 
> Adding a similar face option to highlight the text matched by `Info-index'
> will change the output of `Info-virtual-index' and `info-apropos'
> to look exactly the same like as output of `occur' that is good
> for consistency of the UI.  This is in addition to highlighting
> the matches in the each area that you asked for:

Thanks, I like the result very much.

I think it warrants a NEWS entry.




Reply sent to Juri Linkov <juri <at> jurta.org>:
You have taken responsibility. (Sat, 23 Mar 2013 00:45:02 GMT) Full text and rfc822 format available.

Notification sent to Eli Zaretskii <eliz <at> gnu.org>:
bug acknowledged by developer. (Sat, 23 Mar 2013 00:45:02 GMT) Full text and rfc822 format available.

Message #19 received at 14015-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 14015-done <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#14015: Feature request: highlight partial matches in Info's
	index-search
Date: Sat, 23 Mar 2013 02:40:11 +0200
>> +(defcustom Info-index-match-face 'match
>> +  "Face used by \\[Info-index] to show the text that matches.
>> +If the value is nil, don't highlight the matching portions specially."
>> +  :type 'face
>> +  :group 'info
>> +  :version "24.4")
>
> Nowadays, we usually prefer to define a new face that inherits from
> `match'.

I installed with defface that inherits from `match' instead of using defcustom.
All other Info faces are defined with defface too, so a new defface will be
consistent with other Info faces.

However, a new face `list-matching-lines-prefix-face' that I proposed
in bug#14017 is better to define with defcustom for consistency with other
occur-related faces `list-matching-lines-buffer-name-face' and
`list-matching-lines-face' that are defined with defcustom:

  (defcustom list-matching-lines-face 'match
    "Face used by \\[list-matching-lines] to show the text that matches.
  If the value is nil, don't highlight the matching portions specially."
    :type 'face
    :group 'matching)

  (defcustom list-matching-lines-buffer-name-face 'underline
    "Face used by \\[list-matching-lines] to show the names of buffers.
  If the value is nil, don't highlight the buffer names specially."
    :type 'face
    :group 'matching)

I'm not sure whether they should be turned info defface as well
because this will also require converting more related faces to defface,
e.g. grep faces:

  (defvar grep-match-face	'match
    "Face name to use for grep matches.")

  (defvar grep-context-face 'shadow
    "Face name to use for grep context lines.")

And even after adding deffaces for them these old variables should still remain
for backward compatibility with definitions like:

  (defcustom list-matching-lines-face 'occur-match

  (defvar grep-match-face 'grep-match




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 20 Apr 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 29 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.