Monday, May 09, 2005

Emacs support for Spyce

Committed spyce.el in svn contrib/. (For those of you not bound to it by 10+ years of habit, el stands for Emacs Lisp.) I didn't write a "spyce mode" per se; I just used the mmm-mode module to allow Emacs to recognize the python snippets inside html. mmm-mode is one of the most complex modules I've had to work with, and while it gets the job done, to me it seems like emacs is showing its age. Maybe one of the DrPython guys will write an Emacs keybinding package so I don't feel too lost.

This is about as simple as you get with mmm-mode. You can get a lot more complicated.

(require 'mmm-auto)
(require 'mmm-sample)
(setq mmm-global-mode 'maybe)
(setq auto-mode-alist (cons '("\\.spy$" . html-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.spi$" . html-mode) auto-mode-alist))

(mmm-add-classes
 '((spyce1
    :submode python-mode
    :front "<%"
    :back "%>")
   (spyce2
    :submode python-mode
    :front "\\[\\["
    :back "\\]\\]")
  )
)
(mmm-add-mode-ext-class nil "\\.spi$" 'spyce1)
(mmm-add-mode-ext-class nil "\\.spy$" 'spyce1)
(mmm-add-mode-ext-class nil "\\.spi$" 'spyce2)
(mmm-add-mode-ext-class nil "\\.spy$" 'spyce2)

1 comment:

Anonymous said...

10 years of motor memory stored in the hands.. Now if only any of those new fangled IDEs would let you work in character mode over a terminal connection, they might actually be useful.

S