From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.devel Subject: Re: `completion-in-region' Date: Mon, 12 Apr 2010 16:51:06 +0100 Organization: University of Cambridge Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1271087586 4611 80.91.229.12 (12 Apr 2010 15:53:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 12 Apr 2010 15:53:06 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 12 17:53:05 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O1Lwc-0003ZB-A7 for ged-emacs-devel@m.gmane.org; Mon, 12 Apr 2010 17:53:02 +0200 Original-Received: from localhost ([127.0.0.1]:53485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1Lwb-0004cs-PR for ged-emacs-devel@m.gmane.org; Mon, 12 Apr 2010 11:53:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O1Lv4-0003tN-F8 for emacs-devel@gnu.org; Mon, 12 Apr 2010 11:51:26 -0400 Original-Received: from [140.186.70.92] (port=35624 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1Lv2-0003so-Sb for emacs-devel@gnu.org; Mon, 12 Apr 2010 11:51:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O1Lv0-0003XD-Uh for emacs-devel@gnu.org; Mon, 12 Apr 2010 11:51:24 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:35649) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O1Lv0-0003Ww-KQ for emacs-devel@gnu.org; Mon, 12 Apr 2010 11:51:22 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1O1Luy-0002W0-9C for emacs-devel@gnu.org; Mon, 12 Apr 2010 17:51:20 +0200 Original-Received: from smaug.linux.pwf.cam.ac.uk ([193.60.95.72]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Apr 2010 17:51:20 +0200 Original-Received: from sdl.web by smaug.linux.pwf.cam.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Apr 2010 17:51:20 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 85 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: smaug.linux.pwf.cam.ac.uk User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:yy/u96mFARzJ33ObOj4xeZtjD6w= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:123522 Archived-At: On 2010-04-11 16:32 +0100, Stefan Monnier wrote: >>> 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. >> BTW, some modern text editors (such as textmate) have started offering >> fuzzy completion as default. > > Interesting. Do you have any details of what is meant by "fuzzy"? > [ BTW, I expect fuzzy matching to be a completion-style rather than > a completion-ui. The IO part is the part that chooses which keys do > what, where/how to display the list of completions, etc... whereas > the completion-style controls what is the possible list of > completions given a completion-table and a user input. ] I haven't used textmate. I am afraid if I try it I might like it. So that comment is from me watching a few screencasts of textmate. There are a lot of them on the internet. And using ido and the fuzzy completion in slime. None seems to suggest it is a bad default. >> I was trying to return a list of (beg end collections) and let >> completion-in-region do the job. But in the end I did something like >> this: > >> (defun TeX-completion-at-point () >> (let ((list TeX-complete-list) entry) >> (while list >> (setq entry (car list) >> list (cdr list)) >> (if (TeX-looking-at-backward (car entry) 250) >> (setq list nil))) >> ;; ignore the useless ispell completion >> (when (numberp (nth 1 entry)) >> (when (looking-at "\\w") >> (forward-word 1)) >> (TeX-complete-symbol) >> ;; try leaving point in between parenthesis >> (when (looking-back "\\s)" (line-beginning-position)) >> (skip-syntax-backward ")")) >> ;; this is discouraged >> ;; return a function that does nothing >> 'ignore))) > > I don't see where this adds a terminating }. TeX-complete-symbol from AUCTeX does that automatically. >> I haven't used pcomplete before so I will look at it later on. > > My suggestion doesn't have anything to do with pcomplete.el except for > the fact that it's one place where I've used c-t-with-terminator. > I.e. I'm suggesting you use completion-table-with-terminator and the > pcomplete.el is just telling you where you can see it in use. > But "grep completion-table-with-terminator lisp/**/*.el" will show you > a few other uses (in meta-mode and make-mode, for example). OK. I will keep that in mind. [...] >> The completion I was talking about was for function >> `snippet-completion-at-point' which completes abbrevs and do the >> expansion if the completed string is an abbrev name; the abbrev >> expansion is then processed by snippet-region. > > I see. So what problems have you encountered in this context? Currently no except it returns a function which is discouraged as said in the doc string of `completion-at-point-functions'. > [ BTW, you may want to generalize it to abbrev-complete-at-point since > it's likely to be easy to generalize to any abbreviation table. > We could install this in abbrev.el. ] > > Stefan I have added this to my TODO. Unfortunately I might be away from internet for quite a while but I will send that in next time if nobody does that already. Thanks. Leo