Re: how to define a comment syntax for files having a specific extension?
  Home FAQ Contact Sign in
gnu.emacs.help only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: how to define a comment syntax for files having a specific extension?         

Group: gnu.emacs.help · Group Profile
Author: Pascal Bourguignon
Date: Apr 3, 2007 00:30

"gento" hotmail.com> writes:
>> You need to create a major mode for those types of files.
>> Check out sample-mode.el
>
> Thank you Stefan.
>
> Is there a simplest way for reaching this scope,
> for example by modifying the ~/.emacs file only?

Well, there is first the simpliest way to do it: insert a file
variable comment in these files. (info "(emacs)File Variables")

/ -*- mode:text; comment-start:"/"; coding:utf-8

on the first or second line, or:

/ Local Variables:
/ mode: text
/ comment-start: "/"
/ coding: utf-8
/ End:

at the end.

You don't necessarily need to make a major mode, you can put any
function in auto-mode-alist.

(require 'cl)
(push `(\\.jou$" . ,(lambda ()
(text-mode)
(setf comment-start "/")))
auto-mode-alist)

should work (not tested).

Also you could do it with a find-file-hook, etc.

no comments
diggit! del.icio.us! reddit!