Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

mode line

5 views
Skip to first unread message

Vladimir Zolotykh

unread,
Nov 13, 2001, 8:07:58 AM11/13/01
to
What is the history/meaning/rules/spread/conformance etc
of line like:

;; -*- mode: common-lisp; package: foo -*-

--
Vladimir Zolotykh gsm...@eurocom.od.ua

Kent M Pitman

unread,
Nov 13, 2001, 9:28:34 AM11/13/01
to
Vladimir Zolotykh <gsm...@eurocom.od.ua> writes:

> What is the history/meaning/rules/spread/conformance etc
> of line like:
>
> ;; -*- mode: common-lisp; package: foo -*-

The following is my approximate understanding of some of it.

Early Emacs used
-*- Fortran -*-
or whatever to denote the major mode that the file was to be edited in.
You put it on a comment line for whatever languag file you were editing.
At least in part, this was because the original file system that Emacs
acrose in did not reliably have "file types"; it had to make the choice
between types or versions, and usually chose versions. That is, filenames
were to six-letter pairs and tended to be either "FOO LISP" (no version)
or "FOO 37" (not type). Usually one preferred "FOO 37" so emacs had no
cue about the major mode. [This is the MIT ITS file system. Some complained
of this as a weakness, but it had many other strengths, causing,
when we saw the kind of junk operating systems that followed, the rallying
call "six-letter filenames were never this bad".]

Because comment characters and conventions varied (as to what prefixes
and suffixes were required, the -*- on either end was chosen to be recognized
apart from other junk that might precede or follow. Some people would
literally write
;; Hey, Emacs, this is a -*- Lisp -*- file!
And sometimes it was necessary to do:
/*-*- PL1 -*-*/

The Lisp Machine generalized this because it needed more information.
-*- ind1: val1; ind2: val2; ... -*-
trailing semicolon is optional spaces after the colons are optional.
Symbolics Genera usually had 5 or more co-resident dialects of Lisp.
-*- Mode: LISP; Syntax: Zetalisp; ... -*-
selected not only the editing mode (originally) but also the langauge
semantics to be supplied. These created local bindings for the file.
Other possible values included Base, since the input radix for Lisp code
started out in base 8 for Zetalisp and MACLISP and probably some other
early Lisp dialects. There was a cultural war to get it set to 10.
It was possible to edit in Syntax: Zetalisp; Base: 10 or in
Syntax: Common-Lisp; Base: 8 using this mechanism. Font-map information
and a few other things could also be managed here by Zmacs.

For package, it originally started as just Package: FOO which had the
approximage effect of (in-package "FOO"), but remember that it worked
for non-Lisp files. It was often useful in a text file or even
another programming language file to have the Lisp package set a
certain way on a Lisp Machine, where some tools were
package-sensitive. You could also say Package:(FOO) to get FOO
created on demand if it didn't exist, and this was extended to permit
Package:(FOO :SHADOW BAR), etc., because demand creation wasn't worth
much if you couldn't put in the little package ops.

As a related aside, in Genera, I did the mods to make syntaxes a
first-class linguistic notion rather than an just ad-hoc editor
feature so that there was stuff like sys:find-package-for-syntax, etc.
because we eventually ran into cases where two syntaxes needed the
same package name for different purposes, not just in the editor.
Syntax: Common-Lisp; Package: USER got you what Zetalisp called the
CL-USER package but what Common Lisp (CLTL1) called the USER package,
since Zetalisp had a USER nickname for its ZL-USER package. Then
Common Lisp added a USER package but for compatibility we wanted to
leave Zetalisp's USER package pointing to the CLTL1 USER package, so
we made the ill-named [not my choice] FUTURE-COMMON-LISP package and
FCL-USER to address ANSI CL. Even after it was standardized, it
stayed named that. :-( But going into ANSI-Common-Lisp syntax selected
the ANSI CL dialect instead of the CLTL1 dialect. Doing Syntax:
ANSI-Common-Lisp; Package: CL-USER got you the CL-USER package that
ANSI describes (what Zetalisp calls FCL-USER) whereas Syntax:
Common-Lisp; Package: USER; would get you the USER package that CLTL1
described (what Zetalisp calls FCL-USER). All this was done in one
address space, nearly invisibly to everyone, by associating a syntax
to a readtable. Almost no one ever rebinds *READTABLE* and when they
do, they rebindi it usually to another readtable created by a function
available in the same syntax, so *READTABLE* secretly controlled what
syntaxx was active which in turn controlled the package universe, the
default base from which *print-base* initially got its foothold, etc.
Remember that all these implementations were in the same address
space, calling each other's functions back and forth all the time. :-)
I also made the triple-colon syntax to let people talk about
ZL:::USER:FOO vs CL:::USER:CAR when you really needed to refer to an
out-of-syntax symbol; CL specifically reserves many-colon sequences
for apparently such a use, so I figured "why not?"

Back to the main topic, though, the notation -*- mode: common-lisp -*-
arises out of abuse of and/or lack of coordination with the people who
originally created the plist-style file attribute list. (It's not
intended to be called a mode line, btw. The mode line is a visual
indicator in the bottom of your emacs, just above the echo area. this
line with mode: in it is called the file attribute list.) The Mode:
indicator in a file attribute list was intended to convey the generaly
notion of a file editor mode like lisp-mode, but no the specific
language qualities, which were to be subtyped under Syntax. But at
this point, it seems to be something done by the emacs crowd, without
coordinating with the zmacs [lisp machine editor crowd] and I've no
longer kept up with its subtleties because I don't rely on Emacs to
edit my Lisp code. I think I've seen some sort of file-local variables
facility that works here, too. Again, see the emacs doc.

Vladimir Zolotykh

unread,
Nov 13, 2001, 11:40:44 AM11/13/01
to
Thank you Kent.
Just like encyclopedia article.

--
Vladimir Zolotykh gsm...@eurocom.od.ua

0 new messages