TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:5699] Emacs question (syntax recognition)

> But, when I write a JavaServer Page, with a .jsp ending, it doesn't know
> what it is.  How can I tell emacs to treat .jsp as a java source file.

This is controlled by the variable: AUTO-MODE-ALIST

For instance, insert in your .emacs file

(setq auto-mode-alist
      '(	("\\.jsp$" . java-mode)

;;; blah blah blah and whatever else you want. In my case:
	("\\.el$" . emacs-lisp-mode)
	("\\.scm$" . scheme-mode) 
	("\\.c$" . c-mode)
	("\\.tex$" . TeX-mode)))
From on-line help 
Alist of filename patterns vs. corresponding major mode functions.
Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL).
(NON-NIL stands for anything that is not nil; the value does not matter.)
Visiting a file whose name matches REGEXP specifies FUNCTION as the
mode function to use.  FUNCTION will be called, unless it is nil.

If the element has the form (REGEXP FUNCTION NON-NIL), then after
calling FUNCTION (if it's not nil), we delete the suffix that matched
REGEXP and search the list again for another match.


Hope this helps.

Javier Thayer