When writing a muse file it always annoyed me when I have written (for example) a-really-long-variable
somewhere else in the file and then when I type =a-rea
and press M-/
it fails to expand.
The way to fix this behaviour is by setting dabbrev-abbrev-skip-leading-regexp
(setq dabbrev-abbrev-skip-leading-regexp "[=*]")
(Edit: fixed the first regex per Billy’s comment below. Thanks)
Okay, you think, this doesn’t affect me – I don’t use muse (why not?) How about if you’re writing some html/xml.
(setq dabbrev-abbrev-skip-leading-regexp "[^ ]*[<>=*]")
Now <strong>long-word-
completes as you would expect.
There is also dabbrev-abbrev-char-regexp
if you want even more control over what should be considered a match.
Also, I’m no longer using autocomplete as I find vanilla dabbrev nicer to use.
Huh? The two setq are identical, no?
I’d forgotten about that variable. FYI, if you want to use hippie-expand, you can do something similar – I just wrote about it on my blog here: http://trey-jackson.blogspot.com/2009/05/emacs-tip-29-customizing-hippe-expand.html
@Billy – drat – you’re right. I was careless in my editing earlier. The first regex should have omitted the [^ ]* part as we only need to ignore = and *. Thanks for pointing that out – I’ve corrected the post.
I’ve also amended your comment to make it clearer you were quoting my post. I hope that’s okay.
@Trey – I tried out hippie-expand briefly but didn’t find it a huge step up from dabbrev. Are there compelling advantages or is it just that I’m used to the way dabbrev expands things?
I wonder did you try the package auto-completion?
Hi Zhangda, do you mean the autocomplete framework? Yes I used it for about 4 weeks before I decided that, while it is prettier than standard dabbrev, it doesn’t provide any advantage and provides some disadvantages, e.g. in the minibuffer.