Mode-Changing Demo

1
;; If there is Scheme code in here, the editor will be in Scheme mode.
2
;; If you put in JS instead, it'll switch to JS mode.
3
 
4
(define (double x)
5
  (* x x))
6
 
 

On changes to the content of the above editor, a (crude) script tries to auto-detect the language used, and switches the editor to either JavaScript or Scheme mode based on that.