emacs-devel
[Top][All Lists]
Advanced

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

Questions about the `completing-read-function' interface


From: Oleh Krehel
Subject: Questions about the `completing-read-function' interface
Date: Fri, 17 Apr 2015 11:59:57 +0200

Hi all,

I'd like to know, if a function calls `completing-read', should the
members of DEF be inside COLLECTION? I haven't found info on this in the
doc, and `completing-read-default' doesn't seem to handle DEF not being
in COLLECTION.

But, for instance, `magit-completing-read' (and some other functions) do
make that assumption. And `helm-mode' has code to deal with that.  I'm
thinking of adding a similar work-around to `ivy-mode' as well, but
maybe it would be better if it was somehow mandated that DEF should be
in COLLECTION. Because, theoretically, DEF can be a list, and it would
be inefficient for the completion engine to go through the whole
collection just to make sure that DEF isn't there, and then add it
there.

As second question is about this interface:

    (setq completing-read-function 'foo)

We've accumulated a bunch of packages that call this: icomplete-mode,
helm-mode, icy-mode, ivy-mode. If these functions are called in
succession, each of them will think that they are on, however, the
resource (`completing-read-function') will belong only to the last one.

Maybe we could have this type of interface:

    (set-completing-read-function 'foo callback)

So that each time `set-completing-read-function' is called, the current
minor mode is properly shut down in the callback.  We could keep the
current interface for single-use completion through a let binding. But
all the minor modes mentioned would use `set-completing-read-function'.

Oleh



reply via email to

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