all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to put mode Info into comment header of program?
@ 2008-04-22 21:58 Wei
  2008-04-22 22:59 ` Pascal Bourguignon
  2008-04-23 14:44 ` Joel J. Adamson
  0 siblings, 2 replies; 4+ messages in thread
From: Wei @ 2008-04-22 21:58 UTC (permalink / raw)
  To: help-gnu-emacs

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?

Thanks!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to put mode Info into comment header of program?
  2008-04-22 21:58 How to put mode Info into comment header of program? Wei
@ 2008-04-22 22:59 ` Pascal Bourguignon
  2008-04-23 14:52   ` Johan Bockgård
  2008-04-23 14:44 ` Joel J. Adamson
  1 sibling, 1 reply; 4+ messages in thread
From: Pascal Bourguignon @ 2008-04-22 22:59 UTC (permalink / raw)
  To: help-gnu-emacs

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to put mode Info into comment header of program?
  2008-04-22 21:58 How to put mode Info into comment header of program? Wei
  2008-04-22 22:59 ` Pascal Bourguignon
@ 2008-04-23 14:44 ` Joel J. Adamson
  1 sibling, 0 replies; 4+ messages in thread
From: Joel J. Adamson @ 2008-04-23 14:44 UTC (permalink / raw)
  To: Wei; +Cc: help-gnu-emacs

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.

You may want auto-insert-mode; its associated variables perform
auto-insertion of headers for source code in various languages.  You can
also customize it on a per-directory basis for specific projects.

Joel

-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109
Public key: http://pgp.mit.edu
http://www.unc.edu/~adamsonj

The information transmitted in this electronic communication is intended only
for the person or entity to whom it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received this
information in error, please contact the Compliance HelpLine at 800-856-1983 and
properly dispose of this information.







^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to put mode Info into comment header of program?
  2008-04-22 22:59 ` Pascal Bourguignon
@ 2008-04-23 14:52   ` Johan Bockgård
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Bockgård @ 2008-04-23 14:52 UTC (permalink / raw)
  To: help-gnu-emacs

Pascal Bourguignon <pjb@informatimago.com> writes:

> In GNU emacs, you'd just write:
>
> ;;;; -*- mode:common-lisp -*-
>
> or just:
>
> ;;;; -*- mode:lisp -*-

or just

;;; -*- lisp -*-

-- 
Johan Bockgård


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-23 14:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-22 21:58 How to put mode Info into comment header of program? Wei
2008-04-22 22:59 ` Pascal Bourguignon
2008-04-23 14:52   ` Johan Bockgård
2008-04-23 14:44 ` Joel J. Adamson

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.