help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

seemingly superfluous completions from code in completion.el


From: Alan
Subject: seemingly superfluous completions from code in completion.el
Date: Sun, 3 Apr 2011 21:11:20 -0700 (PDT)
User-agent: G2/1.0

This is a post seeking enlightenment on the behavior of completion
functions as provided by the code in "completion.el".  I initialize
this by the lines

(require 'completion)
(dynamic-completion-mode)

in my initialization file.  I am using GNU Emacs 23.3.1 (i386-mingw-
nt5.1.2600) of 2011-03-10 on 3249CTO.

In the *scratch* buffer I type the following

01234567890123456789

I then type the line

012

and use the function "complete" five times, which offers me the typed-
in string shortened by one character each time after the first.  If I
then use function "save-completions-to-file" and examine the result, I
see

("0123456789012345" . 361635)
("01234567890123456" . 361635)
("012345678901234567" . 361635)
("0123456789012345678" . 361635)
("01234567890123456789" . 361635)

as the saved completions.  Four of these seem superfluous and not of
interest.

I can avoid these superfluous completions by making a change that
affects what the function "completion-before-command" does.  It is
present in the hook:

 "pre-command-hook" is "(completion-before-command tooltip-hide)"

The original definition is

(defun completion-before-command ()
  (funcall (or (and (symbolp this-command)
                    (get this-command 'completion-function))
               'use-completion-under-or-before-point)))

One way to make the change is to add to the property list of "self-
insert-command" the pair "completion-function (lambda ())", so that
'use-completion-under-or-before-point never gets used ahead of "self-
insert-command".

The enlightenment I seek is an explanation of what utility these
seemingly superfluous completions might have.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]