From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Peter Michaux" Newsgroups: gmane.emacs.help Subject: Re: Trouble using snippet.el with abbrev tables Date: Wed, 6 Feb 2008 21:56:44 -0800 Message-ID: <3cbaf1c80802062156pde267bw1ba94eb8cf9af1b1@mail.gmail.com> References: <87fxw7yztp.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1202389921 10230 80.91.229.12 (7 Feb 2008 13:12:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Feb 2008 13:12:01 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Niels Giesen" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 07 14:12:22 2008 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 1JN6Xy-00056u-L4 for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Feb 2008 14:12:10 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JN6XV-00079z-S7 for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Feb 2008 08:11:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JMzkg-0004mk-71 for help-gnu-emacs@gnu.org; Thu, 07 Feb 2008 00:56:50 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JMzkd-0004mY-Qa for help-gnu-emacs@gnu.org; Thu, 07 Feb 2008 00:56:48 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JMzkd-0004mV-LZ for help-gnu-emacs@gnu.org; Thu, 07 Feb 2008 00:56:47 -0500 Original-Received: from wa-out-1112.google.com ([209.85.146.179]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JMzkd-0007Je-Cl for help-gnu-emacs@gnu.org; Thu, 07 Feb 2008 00:56:47 -0500 Original-Received: by wa-out-1112.google.com with SMTP id k34so839072wah.10 for ; Wed, 06 Feb 2008 21:56:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=pJrJkhsaHKhnUeI7eX0yhs7STa3Yk2RVUKCZG9Iv4lY=; b=aX13zrUTg1CpdG93aNnymXIA0/IEFWEJyY45gYfpu17e0/upQcbvei0QAJWl1o+4qV5VaUJZT06mtafaG3tvGZ4CHwriVWnCGsBxxC2QSsx1AJeDCVIFGsIV3IPAKwLIhELSfuku/lpTD2Tm3U7IelxQf3BbcAUIaTRubqE+QTs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ZvndJohcOBCluBZ1GGJcfNnlgJG9gBWik4w1CUJ12Z8O3LDrhlz4U3oWqWuJ57HbnMRA5miT7WfiLPaTtdMcWqd/p4oZn147wYlHlaqOWystfwREsTQBsHHesRKTs/WtincuL+oxWinSLJq8leHIyD9BfiSiOgKhy1cknKzEkJU= Original-Received: by 10.115.94.1 with SMTP id w1mr3494793wal.85.1202363804437; Wed, 06 Feb 2008 21:56:44 -0800 (PST) Original-Received: by 10.114.77.10 with HTTP; Wed, 6 Feb 2008 21:56:44 -0800 (PST) In-Reply-To: <87fxw7yztp.fsf@gmail.com> Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-Mailman-Approved-At: Thu, 07 Feb 2008 08:11:21 -0500 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:51294 Archived-At: On Feb 5, 2008 11:21 AM, Niels Giesen wrote: > "Peter Michaux" writes: > > I'm new to Emacs and having trouble getting snippet.el working. > > > > http://www.kazmier.com/computer/snippet.el > > (autoload 'javascript-mode "javascript" nil t) > (add-to-list 'auto-mode-alist '("\\.js\\'" . javascript-mode)) > (require 'snippet) > > (add-hook 'javascript-mode-hook > (lambda () > (abbrev-mode 1) > (unless (boundp 'javascript-mode-abbrev-table) > (define-abbrev-table 'javascript-mode-abbrev-table ()) > (snippet-with-abbrev-table > javascript-mode-abbrev-table > ("for" . "for $${element} in $${sequence}:") > ("im" . "import $$") > ("if" . "if $${True}:") > ("wh" . "while $${True}:"))) > (setq local-abbrev-table javascript-mode-abbrev-table))) I tried the above. It threw errors at first because the last two instances of javascript-mode-abbrev-table seem to need quoting. When I quote those I still don't get the desired snippet behavior when I type "for" and then space. I tired many simpler combinations also that didn't involve the unless statement. No luck either. Does the above code really work for you? I can get snippets working with python mode. I have a python-snippets.el file with the following ; ------------------------------------------------- (snippet-with-abbrev-table 'python-mode-abbrev-table ("for" . "for $${element} in $${sequence}:") ("im" . "import $$") ("if" . "if $${True}:") ("wh" . "while $${True}:") ) (provide 'python-snippets) ; -------------------------------------------------- and then in my .emacs file I have just the following because the python mode file defines the abbrev table ; ------------------------------------------------- (add-hook 'python-mode-hook (lambda () (abbrev-mode 1) (require 'snippet) (require 'python-snippets) ) ) ; ------------------------------------------------- Any ideas why the JavaScript version doesn't work? Thanks, Peter