[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
all-completions DTWT for "" and non-nil HIDE-SPACES
From: |
Drew Adams |
Subject: |
all-completions DTWT for "" and non-nil HIDE-SPACES |
Date: |
Fri, 12 May 2006 14:27:29 -0700 |
(all-completions "" ...) is an idiom that returns a list of all possible
completions (in the given context). It is very handy for this, but there is
a hitch.
To me, the following behavior, with non-nil HIDE-SPACES argument, is a bug:
(all-completions "" '((" a")("b")("c)) nil t) returns
("b" "c), not (" a" "b" "c")
This behavior is very old (at least back to Emacs 20), but I doubt that any
existing code depends on it (I have no proof). I cannot see any utility in
this behavior, whereas returning all of the completion candidates seems
appropriate and consistent, and it can be useful.
The doc string for all-completions says that if the first arg doesn't start
with a space then a non-nil 4th arg means ignore candidates that start with
a space. "Start with a space" means that the first character is a space.
This is undefined (ambiguous) if the string has no first character (doesn't
start at all; is empty).
I think the functionality should be changed, as well as the doc string,
which should explicitly mention the "" case. Something like this:
If the optional fourth argument HIDE-SPACES is non-nil,
then any strings in ALIST that start with a space
are ignored unless the first char of STRING is a space.
If STRING is empty (""), then all strings in ALIST are
returned.
Actually, the last sentence should be stated up front, and not only within
the context of HIDE-SPACES. That is, we should state that it is always true.
WDOT?