all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Tom <adatgyujto@gmail.com>, help-gnu-emacs@gnu.org
Subject: RE: Substring matching for info index command
Date: Sun, 7 Dec 2014 06:06:15 -0800 (PST)	[thread overview]
Message-ID: <d4ac20c6-a256-4e01-85e4-eb941212d1ca@default> (raw)
In-Reply-To: <loom.20141207T131109-263@post.gmane.org>

> 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.
> 
> I added this advice to the command which wraps it in a
> let and sets completion-styles to substring:
> 
> (defadvice Info-index (around my-Info-index activate)
>   (let ((completion-styles '(substring)))
>     ad-do-it))
> 
> 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\\)[^
]*\\):[ 	]+\\([^
]*\\)\\.\\(?:[ 	
]*(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 
ask-user-about-lock
backup, and user-id
GDB User Interface layout 
load init file of another user
mail-user-agent
package-user-dir 
USER
user name for remote file access
user option 
user options, changing
user-full-name
user-mail-address 
user-mail-address <1>
user-mail-address, initialization 



  reply	other threads:[~2014-12-07 14:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-07 12:15 Substring matching for info index command Tom
2014-12-07 14:06 ` Drew Adams [this message]
2014-12-07 14:16   ` Tom
2014-12-07 14:56     ` Drew Adams
2014-12-07 15:56 ` Eli Zaretskii
2014-12-07 16:02 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d4ac20c6-a256-4e01-85e4-eb941212d1ca@default \
    --to=drew.adams@oracle.com \
    --cc=adatgyujto@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.