From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.help Subject: Re: How to put mode Info into comment header of program? Date: Wed, 23 Apr 2008 00:59:33 +0200 Organization: Informatimago Message-ID: <87ve29v6lm.fsf@hubble.informatimago.com> References: <6b8bad34-151e-4d71-a928-14277555d573@26g2000hsk.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1208907661 27588 80.91.229.12 (22 Apr 2008 23:41:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Apr 2008 23:41:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 23 01:41:25 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JoS6u-0006u1-GX for geh-help-gnu-emacs@m.gmane.org; Wed, 23 Apr 2008 01:41:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JoS6E-0004BT-SE for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Apr 2008 19:40:34 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news.astraweb.com!newsrouter-eu.astraweb.com!proxad.net!cleanfeed1-b.proxad.net!nnrp17-2.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:bNBLSA0zv9qc15fBTJeaPXL56Wg= Original-Lines: 80 Original-NNTP-Posting-Date: 23 Apr 2008 00:55:12 MEST Original-NNTP-Posting-Host: 88.180.86.168 Original-X-Trace: 1208904912 news-1.free.fr 12986 88.180.86.168:43687 Original-X-Complaints-To: abuse@proxad.net Original-Xref: shelby.stanford.edu gnu.emacs.help:158122 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:53483 Archived-At: Wei 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.