unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* `completion-in-region'
@ 2010-04-06 14:37 Leo
  2010-04-09  3:05 ` `completion-in-region' Stefan Monnier
  0 siblings, 1 reply; 20+ messages in thread
From: Leo @ 2010-04-06 14:37 UTC (permalink / raw)
  To: emacs-devel

Hello,

I experimented with this new feature yesterday by using it in my local copy of
snippet.el and AUCTeX completion. I think the feature is elegant in that it
allows consistent behaviour of TAB by (setq tab-always-indent 'complete). I
have also quite a few problems (I suspect the feature is not yet stable).

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.

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.

`minibuffer-complete' seems entirely designed for interactive use since it
does not pass on the return value from completion--do-completion, something
desirable when writing a function for completion-in-region-functions. One can
still use try- all- test-completion(s) but that seems to defeat the purpose of
completion-in-region.

Ever since enable (setq tab-always-indent 'complete), I have found the (ding)
noise due to no match occurs far too often and very annoying.

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

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

Leo





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

end of thread, other threads:[~2010-04-12 18:10 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-06 14:37 `completion-in-region' Leo
2010-04-09  3:05 ` `completion-in-region' Stefan Monnier
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

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