From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: Substring matching for info index command Date: Sun, 7 Dec 2014 06:06:15 -0800 (PST) Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1417961222 12579 80.91.229.3 (7 Dec 2014 14:07:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Dec 2014 14:07:02 +0000 (UTC) To: Tom , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Dec 07 15:06:55 2014 Return-path: Envelope-to: geh-help-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 1XxcU8-0000Cz-An for geh-help-gnu-emacs@m.gmane.org; Sun, 07 Dec 2014 15:06:52 +0100 Original-Received: from localhost ([::1]:58102 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxcU7-0006BX-Nb for geh-help-gnu-emacs@m.gmane.org; Sun, 07 Dec 2014 09:06:51 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxcTo-0006BP-61 for help-gnu-emacs@gnu.org; Sun, 07 Dec 2014 09:06:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XxcTf-00085N-EH for help-gnu-emacs@gnu.org; Sun, 07 Dec 2014 09:06:32 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:32400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxcTf-00084S-6x for help-gnu-emacs@gnu.org; Sun, 07 Dec 2014 09:06:23 -0500 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id sB7E6FQ0024391 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 7 Dec 2014 14:06:16 GMT Original-Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id sB7E6E4D008533 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sun, 7 Dec 2014 14:06:15 GMT Original-Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id sB7E6EdF008527; Sun, 7 Dec 2014 14:06:14 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2 (807160) [OL 12.0.6691.5000 (x86)] X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:101466 Archived-At: > I've never used the builtin completion-styles, because I > use other completion packages, but I thought I give it a try > and try substring matching for the info index command. >=20 > I added this advice to the command which wraps it in a > let and sets completion-styles to substring: >=20 > (defadvice Info-index (around my-Info-index activate) > (let ((completion-styles '(substring))) > ad-do-it)) >=20 > However, it has no effect, it still uses the prefix > completion style. Why is that? The reason is that `Info-index' uses your input not only to match against the possible completions but also (and first) to come up with (calculate/find) the possible completions. And when it uses your input to gather the possible completions it simply searches the indexes of the manual for your input, prefixed by `* '. In other words, the problem is not with completion; it is with the way `Info-index' gathers the completion candidates from the indexes. It does that by simply searching for your input, as a prefix (prepended by `* ', which is what is on the index-entry line in the index. For example, in the Emacs manual, node `Command Index', there is an entry that looks like this: * ask-user-about-lock When you type `user' as input, `Info-index' searches all of the indexes for this regexp: " \\* +\\([^ ]*\\(user\\)[^ ]*\\):[ =09]+\\([^ ]*\\)\\.\\(?:[ =09 ]*(line +\\([0-9]+\\))\\)?" which is essentially a search for `* user'. It is only after gathering all matches for this regexp, across all indexes, that `Info-index' presents them to you, providing completion (substring completion, in your case). In sum, you would need to rewrite `Info-index' or heavily advise it, to get it to DTRT. Or you can just use Icicles. `i user S-TAB' shows these index-entry completion candidates for the Emacs manual: --user ange-ftp-default-user apropos-user-option=20 ask-user-about-lock backup, and user-id GDB User Interface layout=20 load init file of another user mail-user-agent package-user-dir=20 USER user name for remote file access user option=20 user options, changing user-full-name user-mail-address=20 user-mail-address <1> user-mail-address, initialization=20