1 |
;;; scheme.el --- Scheme (and DSSSL) editing mode |
;;; scheme.el --- Scheme (and DSSSL) editing mode |
2 |
|
|
3 |
;; Copyright (C) 1986, 87, 88, 97, 1998 Free Software Foundation, Inc. |
;; Copyright (C) 1986, 1987, 1988, 1997, 1998, 2005 |
4 |
|
;; Free Software Foundation, Inc. |
5 |
|
|
6 |
;; Author: Bill Rozas <jinx@martigny.ai.mit.edu> |
;; Author: Bill Rozas <jinx@martigny.ai.mit.edu> |
7 |
;; Adapted-by: Dave Love <d.love@dl.ac.uk> |
;; Adapted-by: Dave Love <d.love@dl.ac.uk> |
145 |
(setq outline-regexp ";;; \\|(....") |
(setq outline-regexp ";;; \\|(....") |
146 |
(make-local-variable 'comment-start) |
(make-local-variable 'comment-start) |
147 |
(setq comment-start ";") |
(setq comment-start ";") |
148 |
|
(set (make-local-variable 'comment-add) 1) |
149 |
(make-local-variable 'comment-start-skip) |
(make-local-variable 'comment-start-skip) |
150 |
;; Look within the line for a ; following an even number of backslashes |
;; Look within the line for a ; following an even number of backslashes |
151 |
;; after either a non-backslash or the line beginning. |
;; after either a non-backslash or the line beginning. |
173 |
|
|
174 |
(defvar scheme-mode-line-process "") |
(defvar scheme-mode-line-process "") |
175 |
|
|
176 |
(defvar scheme-mode-map nil |
(defvar scheme-mode-map |
177 |
"Keymap for Scheme mode. |
(let ((smap (make-sparse-keymap)) |
178 |
All commands in `lisp-mode-shared-map' are inherited by this map.") |
(map (make-sparse-keymap "Scheme"))) |
179 |
|
(set-keymap-parent smap lisp-mode-shared-map) |
180 |
(unless scheme-mode-map |
(define-key smap [menu-bar scheme] (cons "Scheme" map)) |
|
(let ((map (make-sparse-keymap "Scheme"))) |
|
|
(setq scheme-mode-map (make-sparse-keymap)) |
|
|
(set-keymap-parent scheme-mode-map lisp-mode-shared-map) |
|
|
(define-key scheme-mode-map [menu-bar] (make-sparse-keymap)) |
|
|
(define-key scheme-mode-map [menu-bar scheme] |
|
|
(cons "Scheme" map)) |
|
181 |
(define-key map [run-scheme] '("Run Inferior Scheme" . run-scheme)) |
(define-key map [run-scheme] '("Run Inferior Scheme" . run-scheme)) |
182 |
(define-key map [uncomment-region] |
(define-key map [uncomment-region] |
183 |
'("Uncomment Out Region" . (lambda (beg end) |
'("Uncomment Out Region" . (lambda (beg end) |
188 |
(define-key map [indent-line] '("Indent Line" . lisp-indent-line)) |
(define-key map [indent-line] '("Indent Line" . lisp-indent-line)) |
189 |
(put 'comment-region 'menu-enable 'mark-active) |
(put 'comment-region 'menu-enable 'mark-active) |
190 |
(put 'uncomment-region 'menu-enable 'mark-active) |
(put 'uncomment-region 'menu-enable 'mark-active) |
191 |
(put 'indent-region 'menu-enable 'mark-active))) |
(put 'indent-region 'menu-enable 'mark-active) |
192 |
|
smap) |
193 |
|
"Keymap for Scheme mode. |
194 |
|
All commands in `lisp-mode-shared-map' are inherited by this map.") |
195 |
|
|
196 |
;; Used by cmuscheme |
;; Used by cmuscheme |
197 |
(defun scheme-mode-commands (map) |
(defun scheme-mode-commands (map) |
221 |
if that value is non-nil." |
if that value is non-nil." |
222 |
(interactive) |
(interactive) |
223 |
(kill-all-local-variables) |
(kill-all-local-variables) |
|
(scheme-mode-initialize) |
|
|
(scheme-mode-variables) |
|
|
(run-hooks 'scheme-mode-hook)) |
|
|
|
|
|
(defun scheme-mode-initialize () |
|
224 |
(use-local-map scheme-mode-map) |
(use-local-map scheme-mode-map) |
225 |
(setq major-mode 'scheme-mode) |
(setq major-mode 'scheme-mode) |
226 |
(setq mode-name "Scheme")) |
(setq mode-name "Scheme") |
227 |
|
(scheme-mode-variables) |
228 |
|
(run-mode-hooks 'scheme-mode-hook)) |
229 |
|
|
230 |
(defgroup scheme nil |
(defgroup scheme nil |
231 |
"Editing Scheme code" |
"Editing Scheme code" |
342 |
"Default expressions to highlight in Scheme modes.") |
"Default expressions to highlight in Scheme modes.") |
343 |
|
|
344 |
;;;###autoload |
;;;###autoload |
345 |
(defun dsssl-mode () |
(define-derived-mode dsssl-mode scheme-mode "DSSSL" |
346 |
"Major mode for editing DSSSL code. |
"Major mode for editing DSSSL code. |
347 |
Editing commands are similar to those of `lisp-mode'. |
Editing commands are similar to those of `lisp-mode'. |
348 |
|
|
353 |
Entering this mode runs the hooks `scheme-mode-hook' and then |
Entering this mode runs the hooks `scheme-mode-hook' and then |
354 |
`dsssl-mode-hook' and inserts the value of `dsssl-sgml-declaration' if |
`dsssl-mode-hook' and inserts the value of `dsssl-sgml-declaration' if |
355 |
that variable's value is a string." |
that variable's value is a string." |
|
(interactive) |
|
|
(kill-all-local-variables) |
|
|
(use-local-map scheme-mode-map) |
|
|
(scheme-mode-initialize) |
|
356 |
(make-local-variable 'page-delimiter) |
(make-local-variable 'page-delimiter) |
357 |
(setq page-delimiter "^;;;" ; ^L not valid SGML char |
(setq page-delimiter "^;;;" ; ^L not valid SGML char |
358 |
major-mode 'dsssl-mode |
major-mode 'dsssl-mode |
359 |
mode-name "DSSSL") |
mode-name "DSSSL") |
360 |
;; Insert a suitable SGML declaration into an empty buffer. |
;; Insert a suitable SGML declaration into an empty buffer. |
361 |
|
;; FIXME: This should use `auto-insert-alist' instead. |
362 |
(and (zerop (buffer-size)) |
(and (zerop (buffer-size)) |
363 |
(stringp dsssl-sgml-declaration) |
(stringp dsssl-sgml-declaration) |
364 |
(not buffer-read-only) |
(not buffer-read-only) |
365 |
(insert dsssl-sgml-declaration)) |
(insert dsssl-sgml-declaration)) |
|
(scheme-mode-variables) |
|
366 |
(setq font-lock-defaults '(dsssl-font-lock-keywords |
(setq font-lock-defaults '(dsssl-font-lock-keywords |
367 |
nil t (("+-*/.<>=?$%_&~^:" . "w")) |
nil t (("+-*/.<>=?$%_&~^:" . "w")) |
368 |
beginning-of-defun |
beginning-of-defun |
370 |
(set (make-local-variable 'imenu-case-fold-search) nil) |
(set (make-local-variable 'imenu-case-fold-search) nil) |
371 |
(setq imenu-generic-expression dsssl-imenu-generic-expression) |
(setq imenu-generic-expression dsssl-imenu-generic-expression) |
372 |
(set (make-local-variable 'imenu-syntax-alist) |
(set (make-local-variable 'imenu-syntax-alist) |
373 |
'(("+-*/.<>=?$%_&~^:" . "w"))) |
'(("+-*/.<>=?$%_&~^:" . "w")))) |
|
(run-hooks 'scheme-mode-hook) |
|
|
(run-hooks 'dsssl-mode-hook)) |
|
374 |
|
|
375 |
;; Extra syntax for DSSSL. This isn't separated from Scheme, but |
;; Extra syntax for DSSSL. This isn't separated from Scheme, but |
376 |
;; shouldn't cause much trouble in scheme-mode. |
;; shouldn't cause much trouble in scheme-mode. |
548 |
|
|
549 |
(provide 'scheme) |
(provide 'scheme) |
550 |
|
|
551 |
;;; arch-tag: a8f06bc1-ad11-42d2-9e36-ce651df37a90 |
;; arch-tag: a8f06bc1-ad11-42d2-9e36-ce651df37a90 |
552 |
;;; scheme.el ends here |
;;; scheme.el ends here |