all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Leo <sdl.web@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: `completion-in-region'
Date: Thu, 08 Apr 2010 23:05:19 -0400	[thread overview]
Message-ID: <jwvd3y98hd9.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <xbai39z8y7cs.fsf@cam.ac.uk> (Leo's message of "Tue, 06 Apr 2010 15:37:55 +0100")

> completion-in-region allows a complete customise of its behaviour
> through completion-in-region-functions.  But minibuffer-message blocks
> execution for minibuffer-message-timeout seconds (default to 2) unless
> there's input from user.

Yes, that's a known problem in minibuffer-message, indeed.
Patches welcome.

> For example if I define my own:
> (defun my-completion-in-region (next-fun start end collection predicate)
>   (when (funcall next-fun start end collection predicate)
>   BODY))

> BODY will only be executed after 2 seconds that gives a false slow user
> experience. I can work around this problem by let-binding
> minibuffer-message-timeout to 0. But I think some improvement can be done
> here.

completion-in-region-functions is indeed meant for situations where you
want to either completely replace the completion UI with some other one
(à la completion-ui.el), or where you want to let-bind some completion
variables.  But indeed, it hasn't been used much yet, so maybe a better
interface would make sense.

> The above comments are based on my experience to write two
> completions: one for TeX: I want the completion to automatically
> include a 'close' string (i.e.  {} for LaTeX macros etc.), I can write
> a function for completion-at-point-functions which returns '(beg end
> completion-function) and do the adding in completion-function but it
> is difficult to control the position of point so that it locates
> between {}.

Could you expand on what problems you've encountered when trying to add
it in completion-function?  You may want to check how I used
completion-table-with-terminator in pcomplete.el for that same kind
of situation.

> Another solution is to customise completion-in-region through
> completion-in-region-functions but I need to isolate the interference
> between functions in completion-in-region-functions.

That doesn't seem like a good approach to add a terminating }

> Another for snippet (similar to abbrev), complete the snippet (abbrev) and
> then expand if completion succeeds.

Hmm... I do not understand the above two lines.  They seem to lack
context or something.


        Stefan




  reply	other threads:[~2010-04-09  3:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-06 14:37 `completion-in-region' Leo
2010-04-09  3:05 ` Stefan Monnier [this message]
2010-04-11 12:56   ` `completion-in-region' Leo
2010-04-11 15:32     ` `completion-in-region' Stefan Monnier
2010-04-11 18:05       ` `completion-in-region' Drew Adams
2010-04-11 19:44         ` `completion-in-region' Stefan Monnier
2010-04-11 19:56           ` `completion-in-region' Drew Adams
2010-04-11 20:49             ` `completion-in-region' Stefan Monnier
2010-04-11 21:13               ` `completion-in-region' Drew Adams
2010-04-11 20:08           ` `completion-in-region' Lennart Borgman
2010-04-11 20:51             ` `completion-in-region' Stefan Monnier
2010-04-11 21:06               ` `completion-in-region' Lennart Borgman
2010-04-12  2:10                 ` `completion-in-region' Stefan Monnier
2010-04-12  9:46                   ` `completion-in-region' Lennart Borgman
2010-04-12 13:10                     ` `completion-in-region' Stefan Monnier
2010-04-12 14:50                     ` `completion-in-region' Davis Herring
2010-04-11 21:12             ` `completion-in-region' Drew Adams
2010-04-12 15:36       ` `completion-in-region' Leo
2010-04-12 18:10         ` `completion-in-region' Stefan Monnier
2010-04-12 15:51       ` `completion-in-region' Leo

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=jwvd3y98hd9.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=sdl.web@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.