From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#14015: Feature request: highlight partial matches in Info's index-search Date: Fri, 22 Mar 2013 00:31:56 +0200 Organization: JURTA Message-ID: <87a9pwidur.fsf@mail.jurta.org> References: <83boaczmxb.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1363905322 25453 80.91.229.3 (21 Mar 2013 22:35:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Mar 2013 22:35:22 +0000 (UTC) Cc: 14015@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 21 23:35:48 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UIo5L-0007dv-QE for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Mar 2013 23:35:48 +0100 Original-Received: from localhost ([::1]:35977 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIo4y-0006Lk-GX for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Mar 2013 18:35:24 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIo4q-0006L2-U6 for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2013 18:35:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIo4k-0002kR-4b for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2013 18:35:16 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35358) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIo4j-0002kN-SD for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2013 18:35:10 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UIo6Y-0000Y2-E3 for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2013 18:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Mar 2013 22:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14015 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 14015-submit@debbugs.gnu.org id=B14015.13639053832051 (code B ref 14015); Thu, 21 Mar 2013 22:37:02 +0000 Original-Received: (at 14015) by debbugs.gnu.org; 21 Mar 2013 22:36:23 +0000 Original-Received: from localhost ([127.0.0.1]:39467 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UIo5t-0000X1-RK for submit@debbugs.gnu.org; Thu, 21 Mar 2013 18:36:22 -0400 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:34330 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UIo5r-0000Wt-5a for 14015@debbugs.gnu.org; Thu, 21 Mar 2013 18:36:20 -0400 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 3DC49258B92960; Thu, 21 Mar 2013 15:34:24 -0700 (PDT) In-Reply-To: <83boaczmxb.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 21 Mar 2013 19:24:00 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:72768 Archived-At: > 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