all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Oleh Krehel <ohwoeowho@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Questions about the `completing-read-function' interface
Date: Fri, 17 Apr 2015 10:18:35 -0400	[thread overview]
Message-ID: <jwv8udqyhka.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87lhhrxeg2.fsf@gmail.com> (Oleh Krehel's message of "Fri, 17 Apr 2015 11:59:57 +0200")

> 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.

So far we haven't tried to enforce this and if require-match is not set,
then I don't think we should require it.

> 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.

Actually, icomplete-mode does not touch completing-read-function.

> 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.

Indeed.

> 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.

I don't think it's worth the trouble.  `completing-read-function' should
reflect the user's explicit choice, and if the user enables
several of those modes at the same time, she gets what she deserves.

IOW I think it's OK if ivy-mode thinks it's enabled and yet it is not
active because some other mode has overridden completing-read-function.

I agree that there are potential for actual problems if the
completing-read-function is not properly reverted when the modes are
disabled.  For that reason I recommend you use `add-function' and
`remove-function' rather than `setq'.


        Stefan



  parent reply	other threads:[~2015-04-17 14:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-17  9:59 Questions about the `completing-read-function' interface Oleh Krehel
2015-04-17 14:10 ` Drew Adams
2015-04-17 14:32   ` Oleh Krehel
2015-04-17 15:06     ` Drew Adams
2015-04-17 14:18 ` Stefan Monnier [this message]
2015-04-17 14:47   ` Oleh Krehel
2015-04-17 15:31     ` Stefan Monnier
2015-04-17 15:40       ` Oleh Krehel
2015-04-17 18:04         ` Stefan Monnier
2015-04-17 18:15           ` Oleh Krehel
2015-04-17 19:05             ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv8udqyhka.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=ohwoeowho@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.