unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: :regexp to abbrev table
Date: Mon, 19 Apr 2010 19:26:39 +0100	[thread overview]
Message-ID: <xbaiy6gjz4bk.fsf@cam.ac.uk> (raw)
In-Reply-To: jwv633ouffj.fsf-monnier+emacs@gnu.org

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	other threads:[~2010-04-19 18:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-16 10:06 :regexp to abbrev table Leo
2010-04-19  6:29 ` Stefan Monnier
2010-04-19 18:26   ` Leo [this message]
     [not found]     ` <jwvljcj8ee1.fsf-monnier+emacs@gnu.org>
2010-04-20 13:37       ` Leo
2010-04-20 15:22         ` Stefan Monnier
2010-04-20 16:32           ` Leo
2010-04-20 18:39             ` Leo
2010-04-21  4:26               ` Stefan Monnier
2010-04-21  6:37                 ` Leo
     [not found]                   ` <jwv4oj46gfy.fsf-monnier+emacs@gnu.org>
2010-04-21 15:09                     ` Leo
     [not found]                       ` <jwvaasw4s7w.fsf-monnier+emacs@gnu.org>
2010-04-21 19:25                         ` Leo
2010-04-23  3:23                           ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xbaiy6gjz4bk.fsf@cam.ac.uk \
    --to=sdl.web@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).