emacs-devel
[Top][All Lists]
Advanced

[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: Mon, 19 Apr 2010 19:26:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

On 2010-04-19 07:29 +0100, Stefan Monnier wrote:
>> The abbrev itself should match \\(\\(\\sw\\|\\s_\\|\\s\\\\)+\\). Since
>> currently :regexp also needs to match part of the text before the
>> abbrev, how to prepend \\(\\(\\sw\\|\\s_\\|\\s\\\\)+\\) so that abbrevs
>> can be correctly found? Something similar to \\(\\Sw\\|\\S_\\|\\S\\\\)
>> but without adding the extra group.
>
> Adding an extra group is no problem, as long as you make it shy
> (i.e. an \(?:..\) rather than \(..\) so that it doesn't get a group
> number).  Remember that "The submatch 1 is treated
> as the potential name of an abbrev" so the subgroup nb 1 can be preceded
> by any text you like.

I have been trying all afternoon to construct such a regexp. Asking also
on irc #emacs and emacs-help and I haven't received an answer yet.

Is it possible for you to provide an actual regexp to find abbrevs that
contains word, symbol or \?

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

Do you think it worthwhile to provide another property :syntax to allow
user to easily specify, for example, a value "w_\\" and find the abbrev
name correctly?

Leo





reply via email to

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