;;; Source file: modes.jl
;;; Compiled by <unknown username>@<unknown system name> on Wed Aug 07 00:39:57 1996
;;; Jade 3.2

(defvar mode-alist (quote (("\\.(c|h|cpp)$|^c(|-mode)$" . c-mode) ("\\.jl$|^lisp(|-mode)$" . lisp-mode) ("\\.(text|doc|txt|article|letter)$" . text-mode) ("^(text(|-mode)|(.*/|)draft)$" . text-mode) ("^indented-text(|-mode)$" . indented-text-mode) ("\\.[s]$|^asm(|-mode)$" . asm-mode) ("\\.[S]$|^asm-cpp(|-mode)$" . asm-cpp-mode) ("\\.texi(|nfo)|^texinfo(|-mode)$" . texinfo-mode))) "List of all major modes which can be enabled by loading a file into
a buffer. List is made of `(REGEXP . MODE)' cells; the REGEXP is matched
against the mode specification (i.e. the filename), if it matches the
function MODE is called to install the mode.")

(defvar major-mode nil "The function which was used to initialise the buffer's major mode.")

(make-variable-buffer-local (quote major-mode))

(defvar major-mode-kill nil "The function which should be called to remove the buffer's major mode.")

(make-variable-buffer-local (quote major-mode-kill))

(defvar comment-column 41 "Buffer-local variable containing the canonical column number which
comments should begin at. If the line extends past this column the next
tab stop after the end of the line is used instead.")

(make-variable-buffer-local (quote comment-column))

(make-variable-buffer-local (quote mode-comment-fun))

(defvar mode-indent-line nil "A function called to indent a specified line in the current buffer.")

(make-variable-buffer-local (quote mode-indent-line))

(defvar mode-forward-exp nil "Function like `lisp-forward-sexp'.")

(make-variable-buffer-local (quote mode-forward-exp))

(defvar mode-backward-exp nil "Function like `lisp-backward-sexp'.")

(make-variable-buffer-local (quote mode-backward-exp))

(defun get-mode (name) "Scan the alist `mode-alist' for a mode whose regexp matches NAME,
returning the initialisation function of that mode (a symbol) or nil." (jade-byte-code "D1I2LF\" !LJ M~HMF!H E" [mode-alist list elt regexp-match name] 4))

(defun init-mode (buf &optional name) "Initialise an edit-mode for buffer BUF, either calls the function named
in the buffer-local variable `major-mode' or finds a mode in `mode-alist'
using one of the following to match against:
  1. NAME
  2. The word specified on the first line of the buffer surrounded by
     `-*-...-*-' (ie, -*-texinfo-*-)
  3. The value of the variable `mode-name'
  4. The name of the file being edited in the buffer" (jade-byte-code " I + \" \" \"	F\"H		F!H 6

GH" [buf major-mode name regexp-expand-line "-\\*- *([^ ]+) *-\\*-" "\\1" buffer-start mode-name buffer-file-name get-mode funcall] 5))

(defun kill-mode (&optional buf) "Destroy the mode being used to edit buffer BUF with." (jade-byte-code " IF H 
GH" [buf major-mode-kill funcall] 4))

(defvar minor-mode-list nil "List of all minor-modes enabled in this buffer.")

(make-variable-buffer-local (quote minor-mode-list))

(defvar minor-mode-keymap nil "Buffer-local keymap to be used by minor-modes. This is only created
the first time a minor mode calls `add-minor-mode' in the buffer.")

(make-variable-buffer-local (quote minor-mode-keymap))

(defun add-minor-mode (mode name &optional no-keymap) "For use by minor-modes. MODE is the mode's function symbol. This sets up the
current buffer. All minor-modes should call this before doing anything drastic.
NAME is the string to be displayed in the status-line to show that the mode
is enabled." (jade-byte-code " 

HK!KF%H  ,&	KF&	HJ" [mode minor-mode-list error "Minor mode already installed" name minor-mode-names minor-mode-keymap no-keymap make-keylist keymap-path] 3))

(defun remove-minor-mode (mode name) "For use by minor-modes. MODE is the mode's function symbol. Removes MODE
from the current buffer." (jade-byte-code "!F#HJ" [mode minor-mode-list name minor-mode-names] 2))

(defun insert-comment nil "Insert comment delimeters on the current line, place the cursor where the
comment should be written. This may or not be defined by each major mode." (interactive) (jade-byte-code "x  	 	" [mode-comment-fun funcall error "No defined method for inserting comments in this buffer"] 2))

(defun find-comment-pos nil (jade-byte-code "DiI
	1He 	 i	E" [glyph-to-char-pos pos comment-column goto-line-end line-end insert "	" indent-to] 4))

(defun indent-area (start end) "Use the `mode-indent-line' function to indent each line between START and
END." (interactive "-m
M") (jade-byte-code "	!	F\"H 	Hf (
H
H " [line-start start end mode-indent-line error "No method for indenting lines in this buffer" funcall next-line 1] 3))

(defvar newline-and-indent nil "(newline-and-indent)
Insert a newline then either call this buffer's `mode-indent-line' function
or insert a tab." (interactive) (if (null mode-indent-line) (insert "
	") (insert "
") (funcall mode-indent-line)))

(defun indent-line nil "Indent the current line." (interactive) (jade-byte-code " /D	2	 	f 	H	d +	E 4
	" [mode-indent-line funcall pos posp char-to-glyph-pos cursor-pos goto-glyph glyph-to-char-pos line-end goto-line-end error "No method for indentation in this buffer."] 2))

(defun forward-exp (&optional number) "Move forward NUMBER expressions." (interactive "p") (jade-byte-code " 
	" [goto-char funcall mode-forward-exp forward-word number] 4))

(defun backward-exp (&optional number) "Move backwards NUMBER expressions." (interactive "p") (jade-byte-code " 
	" [goto-char funcall mode-backward-exp backward-word number] 4))

(defun kill-exp (&optional number) "Kill the next NUMBER expressions." (interactive "p") (jade-byte-code " 	

" [kill-area cursor-pos funcall mode-forward-exp forward-word number] 5))

(defun backward-kill-exp (&optional number) "Kills from the start of this NUMBER'th previous expression to the cursor." (interactive "p") (jade-byte-code " 

" [kill-area funcall mode-backward-exp backward-word number cursor-pos] 4))

(defun transpose-exps (count) "Move the expression before the cursor COUNT expressions forwards." (interactive "p") (jade-byte-code "  " [transpose-items mode-forward-exp forward-word mode-backward-exp backward-word count] 4))
