/[emacs]/emacs/lisp/progmodes/scheme.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/scheme.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.47 by uid65615, Thu Jan 15 14:17:07 2004 UTC revision 1.48 by monnier, Fri Jan 28 18:57:45 2005 UTC
# Line 1  Line 1 
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>
# Line 144  Line 145 
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.
# Line 171  Line 173 
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)
# Line 192  All commands in `lisp-mode-shared-map' a Line 188  All commands in `lisp-mode-shared-map' a
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)
# Line 222  Entry to this mode calls the value of `s Line 221  Entry to this mode calls the value of `s
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"
# Line 346  See `run-hooks'." Line 342  See `run-hooks'."
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    
# Line 357  Blank lines separate paragraphs.  Semico Line 353  Blank lines separate paragraphs.  Semico
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
# Line 378  that variable's value is a string." Line 370  that variable's value is a string."
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.
# Line 558  that variable's value is a string." Line 548  that variable's value is a string."
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

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26