From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.help Subject: Re: comment / uncomment region Date: 03 Aug 2004 10:21:31 +0200 Organization: [posted via Easynet Spain] Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87smb4zl6c.fsf@thalassa.informatimago.com> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1091521675 4221 80.91.224.253 (3 Aug 2004 08:27:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 3 Aug 2004 08:27:55 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 03 10:27:44 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Brue7-0007Fj-00 for ; Tue, 03 Aug 2004 10:27:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BruhY-0007OE-IA for geh-help-gnu-emacs@m.gmane.org; Tue, 03 Aug 2004 04:31:16 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!news.glorb.com!easynet-monga!easynet.net!easynet-post2!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-Lines: 42 Original-NNTP-Posting-Host: 62.93.174.79 Original-X-Trace: DXC=FPHl>BSB5]L@f38CEWJ:=OEY<>`XO4V7M>Uh List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:19957 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19957 exits funnel writes: > > Or, if you don't want to program a mode for your > > grammar files you > > could have a find-file-hook that would check the > > file type (or file > > name extension) and would initialize the buffer > > environment when it > > finds that a grammar is being opened. Something > > like: > > > > (add-hook 'find-file-hook > > (lambda () > > (when (string-match "\\.grammar$" > > (buffer-file-name)) > > (setf comment-start "//") > > ;; ... > > ))) > > Actually, I was surprised to find that adding this to > my .emacs file didn't have any affect. If I replaced > the setf with a call to message( ) it similarly was > not being exectued when I visited a .grammar file. > I'm running emacs 21.3.1 on Redhat Linux. This seems > simple enough. Any thoughts? Thanks. Sorry, there's an 's' at find-file-hooks: (add-hook 'find-file-hooks (lambda () (when (string-match "\\.grammar$" (buffer-file-name)) (setf comment-start "//") ;; ... ))) With this variable, it works. -- __Pascal Bourguignon__ http://www.informatimago.com/ There is no worse tyranny than to force a man to pay for what he does not want merely because you think it would be good for him. -- Robert Heinlein