[Top][All Lists]

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

Re: comment / uncomment region

From: Kevin Rodgers
Subject: Re: comment / uncomment region
Date: Mon, 02 Aug 2004 09:49:08 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv: Gecko/20020406 Netscape6/6.2.2

Pascal Bourguignon wrote:
> 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 "//")
>            ;; ...
>            )))

Those are all good suggestions, but I would recommend trying out
define-generic-mode: you can define your own major mode just by
specifying 6 values, most of which are just lists of strings
(keywords, etc.).

Kevin Rodgers

reply via email to

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