[Top][All Lists]

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

Re: :regexp to abbrev table

From: Leo
Subject: Re: :regexp to abbrev table
Date: Tue, 20 Apr 2010 14:37:37 +0100

On 19 April 2010 19:56, Stefan Monnier <address@hidden> wrote:
>> Is it possible for you to provide an actual regexp to find abbrevs that
>> contains word, symbol or \?
> I'd start with "\\(?:^\\|[^[:word:]\\]\\)\\([[:word:]\\]+\\)[ \t]*".
> For symbols, I recommend you list the chars you want in the above regexp
> rather than rely on the `symbol' char syntax.

Many thanks for this. I will bear this in mind when writing the abbrev
completion code. Since TAB can be configured to perform two roles:
indentation and completion through (setq tab-always-indent 'complete).
Completion in the middle of a 'word' often lead to undesirable change
of the text in buffer. For example: (emacs-lis|p-mode) where | is the
cursor. TAB will change the text to (emacs-lisp-p-mode). I often type
TAB to check whether current line is correctly indented and so this
completion is annoying, for lisp-mode I have redefined
lisp-completion-at-point to work around this problem.

The same situation applies to abbrevs and the :regexp doesn't make it
easy to find the 'end' boundary.

>>>> Do you think using greedy looking-back in abbrev--before-point will make
>>>> creating the :regexp property easier?
>>> It often would, yes.   But it could also negatively affect performance.
>> I don't know the impact on performance. But since it is capped by
>> (line-beginning-position) will it matter that much? During the time I
>> enabled greedy looking-back, I haven't noticed any slow down.
> Under normal circumstances, I don't expect serious performance
> problems, indeed.  But since the code might be executed very often even
> for users who will almost never use those abbrevs, we have to be careful
> so it works in more cases than the expected one.
> This said, I do not know if my performance worries are justified.
>        Stefan


reply via email to

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