emacs-devel
[Top][All Lists]
Advanced

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

Trying to get rid of completion-string in completion.el


From: Juanma Barranquero
Subject: Trying to get rid of completion-string in completion.el
Date: Mon, 11 Apr 2011 13:56:43 +0200

This question is for people with experience in completion.el.


While trying to compile completion.el under lexical-binding, I came
across the dynamic variable completion-string, which is shadowed by
the COMPLETION-STRING parameter of a couple of functions
(`add-completion-to-head' and `delete-completion', to be precise).

AFAICS all references to the completion-string variable through
completion.el are really references to the parameters, not to the
dynamic variable, except this clause of `cond' in
`locate-completion-entry':

            (cmpl-db-debug-p
             ;; not found, error if debug mode
             (error "Completion entry exists but not on prefix list - %s"
                    completion-string))

which is the only place where the dynamic binding comes into effect.

Now, as locate-completion-entry is only called from places where
completion-string comes from a parameter COMPLETION-STRING (namely,
the two functions mentioned above, and as a recursive call from
locate-completion-entry-retry), that means that it would be possible
to rename the dynamic variable and just let-bind it from inside the
two relevant functions. Problem solved.

The question is: perhaps it would be better to change that error call
and get rid of the variable, if possible. The message talks about the
completion entry and the prefix list, but it displays the completion
string. I cannot really say that I understand what it is trying to
tell the user. Isn't completion-entry or prefix-list what would be
expected there?

Comments?

   Juanma



reply via email to

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