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 put mode Info into comment header of program?
Date: Wed, 23 Apr 2008 00:59:33 +0200	[thread overview]
Message-ID: <87ve29v6lm.fsf@hubble.informatimago.com> (raw)
In-Reply-To: 6b8bad34-151e-4d71-a928-14277555d573@26g2000hsk.googlegroups.com

Wei <william.wtang@gmail.com> writes:

> Hi,
>
> I am not sure if this is a trivial question. But it definitely seems
> non-trivial to me.
>
> Recently I browse some common lisp code written for Artificial
> Intelligence, which can be found at http://aima.cs.berkeley.edu/lisp/doc/overview.html.
>
> I think the author uses Emacs for his common lisp programming, The
> interesting part is on the top of each of his lisp program, he has a
> line like ";;; -*- Mode: Lisp; Syntax: Common-Lisp; -*- File:
> utilities.lisp". I think this is automatic inserted through some
> mechanism and could be used for other programming language mode also,
> such as cc-mode.
>
> However, I searched over goolge for quite a while and couldn't find
> what kind of setting can enable this.
>
> Can I get any hints from any of you experts?

Have a look at: (info "(emacs)File Variables")

(You can type M-x info RET m emacs RET m File Variables RET or put the
cursor after the (info "(emacs)File Variables") sexp and type C-x
C-e).


Note that there are several "emacsen", and the set of file variables
take into account may vary depending on the emacs used, and the
various modes and libraries loaded.

;;; -*- Mode: Lisp; Syntax: Common-Lisp; -*-

In GNU emacs, there's a single lisp-mode (there's an alias named
common-lisp-mode), and AFAIK, it doesn't vary its behavior on a
'syntax' variable.

In GNU emacs, you'd just write:

;;;; -*- mode:common-lisp -*-

or just:

;;;; -*- mode:lisp -*-


Another file variable that might be useful, in GNU emacs, is coding,
which allows you to explicitely specify the encoding of the file for
emacs:

;;;; -*- mode:lisp;coding:utf-8 -*-

You can actually set any variable you want with file variables, as
long as you have some emacs lisp code that will take it into account
when you edit this file.


This mode  line is not automatically inserted, but you can have it
automatically inserted or updated with a before-save-hook, or with a
skeleton (see the function skeleton-insert, C-h f skeleton-insert RET).


The mode is usually automatically selected depending on the file name
(or path). See the variable auto-mode-alist.  
(Type C-h v auto-mode-alist RET).

So  you don't really need the mode line.  However, it's handy when you
have an occasional file with a different extension. Eg. in some data
file containing lisp sexp, you could put ;; -*- mode:lisp -*- to get
the editing facilities brought with that mode.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

PLEASE NOTE: Some quantum physics theories suggest that when the
consumer is not directly observing this product, it may cease to
exist or will exist only in a vague and undetermined state.


  reply	other threads:[~2008-04-22 22:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-22 21:58 How to put mode Info into comment header of program? Wei
2008-04-22 22:59 ` Pascal Bourguignon [this message]
2008-04-23 14:52   ` Johan Bockgård
2008-04-23 14:44 ` Joel J. Adamson

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=87ve29v6lm.fsf@hubble.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.