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

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

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


From: Pascal Bourguignon
Subject: Re: how to define a comment syntax for files having a specific extension?
Date: Tue, 03 Apr 2007 09:30:12 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.94 (gnu/linux)

"gento" <gento_distefano@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.

-- 
__Pascal Bourguignon__
http://www.informatimago.com
http://pjb.ogamita.org


reply via email to

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