unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* all-completions DTWT for "" and non-nil HIDE-SPACES
@ 2006-05-12 21:27 Drew Adams
  2006-05-12 21:37 ` Drew Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Drew Adams @ 2006-05-12 21:27 UTC (permalink / raw)


(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?

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-05-15 17:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-12 21:27 all-completions DTWT for "" and non-nil HIDE-SPACES Drew Adams
2006-05-12 21:37 ` Drew Adams
2006-05-12 22:36 ` Andreas Schwab
2006-05-13  0:26   ` Drew Adams
2006-05-13  6:35     ` Andreas Schwab
2006-05-15 17:20       ` Kevin Rodgers
2006-05-13 14:57     ` Drew Adams
2006-05-13  8:27 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).