From mboxrd@z Thu Jan 1 00:00:00 1970 From: Antoine Levitt Subject: Re: Completing with anything Date: Tue, 24 May 2011 16:45:19 +0200 Message-ID: <87zkmcf98g.fsf@gmail.com> References: <87r5bhysp6.fsf@keller.adm.naquadah.org> <87vd0qfhu3.fsf@member.fsf.org> <87y63jpii5.fsf@keller.adm.naquadah.org> <871v0ecwe4.fsf@keller.adm.naquadah.org> <87aaecihl2.fsf@gmail.com> <87lixwkzi4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: (Stefan Monnier's message of "Tue, 24 May 2011 11:05:43 -0300") 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: Stefan Monnier Cc: emacs-orgmode@gnu.org, emacs-devel@gnu.org List-Id: emacs-orgmode.gnu.org 24/05/11 16:05, Stefan Monnier >> (defadvice completion-at-point >> (after completion-at-point-complete-if-failed activate) >> "Fallback on dabbrev if completion didn't do anything useful." >> (unless ad-return-value >> (dabbrev-expand nil))) > > BTW, you can avoid the advice by using your own > > (defun al-completion-at-point () > (interactive) > (or (completion-at-point) > (dabbrev-expand nil))) I'd do that, but completion-at-point is used in places I don't fully understand when I set (setq tab-always-indent 'complete). Also there's some weirdness with dabbrev that makes it bug out when it's called indirectly. For instance, seemingly simple code like (artificial example here, but similar things happen when for instance you indent and then complete with the same key) (setq counter 0) (defun my-my-dabbrev-expand () (interactive) (setq counter (mod (+ 1 counter) 2)) (when (equal counter 0) (dabbrev-expand nil))) (local-set-key (kbd "C-c C-c") 'my-my-dabbrev-expand) behaves in a very unexpected way : it actually jumps (!) to the location where the completion was found. I wasn't able to understand this, but it's definitely a bug in dabbrev. It looks like it's related to the way dabbrev checks it's continuing a completion: (eq last-command this-command) but I wouldn't know how to fix this.