[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ERC completion
From: |
Stefan Monnier |
Subject: |
Re: ERC completion |
Date: |
Mon, 02 May 2011 12:02:08 -0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> Nowadays, I have in my .emacs the following, which actually works fine
> but which I now realize is utterly wrong :)
> (setq tab-always-indent 'complete)
> (defun my-dabbrev-expand ()
> (when (and (not (bolp))
> (looking-at "\\_>"))
> (dabbrev-expand nil)))
> (defun my-dabbrev-expand-and-nil ()
> (my-dabbrev-expand)
> nil)
Why my-dabbrev-expand-and-nil?
> (setq completion-at-point-functions '(my-dabbrev-expand-and-nil))
`setq' on a hook is almost always the wrong thing to do.
Either use `setq-default' here if you really intend to throw away the
default global completion functions, or otherwise use something like:
(add-hook 'completion-at-point-functions 'my-dabbrev-expand 'append)
> I seem to recall talks of priority for completions. Couldn't that be
> used here? That way, I'd set completion-at-point-functions to something
> that returns the list of dabbrev expands with a low priority, and every
> other completion would take precedence over it.
By placing it at the end of the hook, you're giving it the lowest priority.
> Yes it does. It does change the semantics of
> erc-pcomplete-nick-postfix though, by adding an extra space
> automatically. I guess nobody will ever need to complete without
> a space, so that's fine.
Every other erc-pcomplete completion adds a space, so it shouldn't be
too much of a surprise,
Stefan
- Re: ERC completion,
Stefan Monnier <=