help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: comment / uncomment region


From: Pascal Bourguignon
Subject: Re: comment / uncomment region
Date: 03 Aug 2004 10:21:31 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

exits funnel <exitsfunnel@yahoo.com> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]