[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Completing with anything

From: Antoine Levitt
Subject: Re: Completing with anything
Date: Tue, 24 May 2011 16:45:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]