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: 01 Aug 2004 03:57:32 +0200 Organization: [posted via Easynet Spain] Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87isc339ir.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 1091325722 24387 80.91.224.253 (1 Aug 2004 02:02:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 1 Aug 2004 02:02:02 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Aug 01 04:01:53 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 1Br5fd-0000g5-00 for ; Sun, 01 Aug 2004 04:01:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Br5iw-0002qo-2B for geh-help-gnu-emacs@m.gmane.org; Sat, 31 Jul 2004 22:05:18 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!feed.news.tiscali.de!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: 56 Original-NNTP-Posting-Host: 62.93.174.79 Original-X-Trace: DXC=6oE6\<[9BMZObTWlK\Kao\0mDM\=e`RhXm9FY3?HjZ5P Original-Xref: shelby.stanford.edu gnu.emacs.help:124574 Original-To: help-gnu-emacs@gnu.org 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: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:19908 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19908 exits funnel writes: > Hello, > > I'm having trouble getting comment-region and > uncomment-region to work in the .grammar files I'm > editing. I'm pretty new to Emacs but I understnad > they don't work because there is no major mode for > these sablecc grammar files. I've looked at the doc a > bit and I understand that I have to set the variable > comment-start to "//" but when I evaluate (setq > comment-start) in the scratch buffer it seems to > change the value only for that buffer. Can anyone > give me a jump start here? Ideally, I'd like to be > able to put something in my .emacs file which will set > its value for any active .grammar file, but I'd be > satisfied if I could at least figure out how to set it > interactively for the current buffer. Thanks in > advance. Yes, that's because comment-start is a buffer-local variable. You have to set it in your grammar buffer. You can do it manually with: M-x eval-expression RET (setq comment-start "//") RET or rather: M-x set-variable RET comment-start RET "//" RET You could put this at the end of each of your grammar files: // Local Variables: // comment-start: "//" // End: 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 "//") ;; ... ))) -- __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