Function
editor
defmode name setup-function syntax-table key-bindings no-redefine vars cleanup-function major-p transparent-p precedence => nil
A string containing the name of the mode being defined.
Name of function which sets up a buffer in this mode.
A quoted list of key-binding directions.
If t, the mode cannot be re-defined. The default value isnil.
A quoted list of Editor variable definitions.
A quoted list of synonyms for name.
Called upon exit from a buffer in this mode.
Ift, the mode is defined as major, otherwise minor. The default value isnil.
defmode returnsnil.t to the major-p argument. defmode is essentially for the purposes of mode specification -- not all of the essential definitions required to establish a new Editor mode are made in adefmode call. In the example, below, other required calls are shown. Foo.Foo has a set-up function, calledsetup-foo-mode. All files with suffix.foo invokeFoo-mode. First, thedefmode call itself: (defmode "Foo" :setup-function 'setup-foo-mode)
.foo files invokeFoo-mode:
(define-file-type-hook ("foo") (buffer type)
(declare (ignore type))
(setf (buffer-minor-mode buffer "Foo") t))
(defun setup-foo-mode (buffer)
setf (buffer-major-mode buffer) "Lisp")
let ((pathname (buffer-pathname buffer)))
unless (and pathname
(probe-file pathname))
(insert-string
(buffer-point buffer)
#.(format nil ";;; -*- mode :foo -*-~@
(in-package foo)~2%")))))
.foo invoke theFoo minor mode. bind-key