all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: (X)Emacs abbrev mode
Date: Wed, 24 Feb 2010 16:48:31 -0500	[thread overview]
Message-ID: <jwvy6iis454.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: mailman.1833.1267043154.14305.help-gnu-emacs@gnu.org

>>> I was wondering if you could tell me why the following works in XEmacs and
>>> not in Emacs.
>> Because Emacs only accepts "words" as abbreviations by default.
>> If you want to support something else (i.e. abbreviations that contains
>> chars that are not marked as words in the syntax-table), then you need
>> to tweak your abbreviation table by setting its :regexp property.
> as this question comes into my mind from time to time: is there any reason
> to limit the chars usable as abbrevs at all?

Obviously, no good one since XEmacs does it.
As for the not-so-good ones:
- limiting them to word-chars means that you can just "grab the word
  before point" and then "look it up in the table".  Whereas XEmacs
  can't do that and has to loop through the table and check each and
  every abbrev to see if the text before point happens to be one
  of them.
- there is implicitly a notion of "boundary" that's important.  E.g. if
  "foo" is an abbrev, you don't want it to apply to "afoo".  OTOH you do
  want it to apply to ",foo".  The abbrev definition never makes this
  boundary specification clear.  IIUC XEmacs uses a heuristic which is
  that if the abbrev starts with a word-component then it only matches
  if the char before is not itself a word-component (i.e. this
  reproduces the convention used in Emacs) and that if the first char of
  the abbrev is not a word-component than it is its own boundary so an
  abbrev "\foo" will also be expanded when the text before point is
  "\\foo" for example.


-- Stefan


  parent reply	other threads:[~2010-02-24 21:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1444.1266504194.14305.help-gnu-emacs@gnu.org>
2010-02-24 19:37 ` (X)Emacs abbrev mode Stefan Monnier
2010-02-24 20:27   ` Andreas Röhler
     [not found]   ` <mailman.1833.1267043154.14305.help-gnu-emacs@gnu.org>
2010-02-24 21:48     ` Stefan Monnier [this message]
2010-02-17 17:14 Fabrizio Sidoli

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

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

  git send-email \
    --in-reply-to=jwvy6iis454.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.