From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: (X)Emacs abbrev mode Date: Wed, 24 Feb 2010 16:48:31 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1267051253 13034 80.91.229.12 (24 Feb 2010 22:40:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 24 Feb 2010 22:40:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 24 23:40:49 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NkPuR-0000m7-Gr for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Feb 2010 23:40:47 +0100 Original-Received: from localhost ([127.0.0.1]:36504 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkPuQ-0004id-Vu for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Feb 2010 17:40:47 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.glorb.com!news2.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe10.iad.POSTED!7564ea0f!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.92 (gnu/linux) Cancel-Lock: sha1:+PY3LChK/DZMa4IZF55JRODgCww= Original-Lines: 29 Original-X-Complaints-To: abuse@UsenetServer.com Original-NNTP-Posting-Date: Wed, 24 Feb 2010 21:48:32 UTC Original-Xref: news.stanford.edu gnu.emacs.help:177079 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:72117 Archived-At: >>> 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