[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatic Mode Lines



This will do what you want done, but you have to bind it to a key.  I
don't know of any "newly-generated-file-buffer-hook", but if you find
one, please tell me and hang something like this on it.  Go ahead and
create a multi-line header and insert it with (INSERT BP ...).

;;; -*- Mode: LISP; Syntax: Common-lisp; Package: ZWEI; Base: 10 -*-


(defvar *default-attribute-list*
	";;; -*- Mode: LISP; Syntax: Common-lisp; Package: USER; Base: 10 -*-"
  "Used by COM-INSERT-DEFAULT-MODELINE.  Set this in your LISPM-INIT.")

(defcom com-add-default-attribute-list "If the current buffer has no modeline, insert *DEFAULT-MODELINE*
          at the beginning of the buffer, and parse it." ()
  (let ((bp (interval-first-bp *interval*)))
    (unless (string-search "-*-" (bp-line bp))	; Don't override an existing modeline
      (insert bp *default-modeline*)))
  (reparse-attribute-list-internal *interval* (open-interval-stream *interval* nil t))
  (set-attribute-state-from-buffer *interval*)
  (invalidate-buffer-sectionization *interval*)
  dis-all)

(set-comtab *STANDARD-COMTAB* '(#\h-m com-insert-default-modeline))