From mboxrd@z Thu Jan 1 00:00:00 1970 From: Antoine Levitt Subject: Re: Completing with anything Date: Tue, 24 May 2011 11:16:41 +0200 Message-ID: <87aaecihl2.fsf@gmail.com> References: <87r5bhysp6.fsf@keller.adm.naquadah.org> <87k4h7ua23.fsf@member.fsf.org> <87vd0romky.fsf@keller.adm.naquadah.org> <87mxm2na63.fsf@member.fsf.org> <87vd0qfhu3.fsf@member.fsf.org> <87y63jpii5.fsf@keller.adm.naquadah.org> <871v0ecwe4.fsf@keller.adm.naquadah.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org To: emacs-devel@gnu.org Cc: emacs-orgmode@gnu.org List-Id: emacs-orgmode.gnu.org 24/05/11 05:14, Stefan Monnier >> > So at least cycling-completion seems fundamentally incompatible with >> > this idea of abbrev-expansion-after-completion, at least if you want to >> > allow arbitrarily complex abbrevs like skeletons. >> Indeed, this is a real problem. > > I've now added a :exit-function property that > completion-at-point-functions can return which is a function that gets > called when completion is finished. It operates outside of the > completion-table, so has access to the buffer text and can do things > like abbrev-expand. > > It gets a status argument which tells it whether the completion is > `exact' (basically, it's valid according to the completion-table, but > there may be further completions available), `sole' (it's the only > completion), and `finished' (not only it's the sole completion, but the > user is not expected to want to change it). `sole' is used by cycling, > so the :exit-function can call abbrev-expand when the status is > `finished' and it won't interfere with cycling (which simply won't > benefit from abbrev-expansion). So, could you add 'failed, which means that no function was able to complete? That way I could do something like (setq completion-extra-properties '(:exit-function my-exit-function)) (defun my-exit-function (string finished) (when (eq finished 'failed) (dabbrev-expand))) and always get a dabbrev-expand as fallback to completion-at-point?