From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: abbrevs, skeletons, and comments Date: Sun, 03 Jun 2007 13:24:00 +1000 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <87odjxvhyn.fsf@lion.rapttech.com.au> References: <1180794889.290796.147660@m36g2000hse.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1180842062 21601 80.91.229.12 (3 Jun 2007 03:41:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 3 Jun 2007 03:41:02 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jun 03 05:41:01 2007 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.50) id 1Hugxg-00070J-Pa for geh-help-gnu-emacs@m.gmane.org; Sun, 03 Jun 2007 05:41:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hugxg-0003Fy-9C for geh-help-gnu-emacs@m.gmane.org; Sat, 02 Jun 2007 23:41:00 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news3.google.com!out01b.usenetserver.com!news.usenetserver.com!in04.usenetserver.com!news.usenetserver.com!news-in-02.newsfeed.easynews.com!easynews.com!easynews!sn-xt-sjc-02!sn-xt-sjc-09!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:O17jFhof2jg/lFHIUuTRn3SpJAM= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 19 Original-Xref: shelby.stanford.edu gnu.emacs.help:149045 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:44633 Archived-At: nobrowser@gmail.com writes: > In a module I'm writing, I'd like to bind abbrevs to code skeletons, > similar to what is done e.g. by sml-mode. But expanding the abbrevs > makes no sense when the point is inside a comment (or a string > literal). So I'd like to conditionally stop expansion. The main > opportunity for that seems to be pre-abbrev-expand-hook, but there are > only two ways it can stop an expansion: 1, throw an error, 2, change > the abbrev bindings (either by making changes in the current table or > by swapping in a whole new table). 1 is unacceptable - how many errors > before user gets mad and disables abbrevs altogether? 2, how to undo > the changes when the point leaves the comment or string? > maybe use an error handler that catches that specific error and ignores it? Tim -- tcross (at) rapttech dot com dot au