all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pascal Bourguignon <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: how to define a comment syntax for files having a specific extension?
Date: Tue, 03 Apr 2007 09:30:12 +0200	[thread overview]
Message-ID: <878xd9ud8b.fsf@voyager.informatimago.com> (raw)
In-Reply-To: 1175527400.955307.302630@b75g2000hsg.googlegroups.com

"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	other threads:[~2007-04-03  7:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-02  8:53 how to define a comment syntax for files having a specific extension? gento
2007-04-02 14:01 ` Stefan Monnier
2007-04-02 15:23   ` gento
2007-04-03  7:30     ` Pascal Bourguignon [this message]
2007-04-03 10:51       ` gento
2007-04-03  8:27     ` Tim X

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878xd9ud8b.fsf@voyager.informatimago.com \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.