15

I found this link http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/, but there isn't a lot of description around it, aside that it's "simple".

Ideally, I'd like an extension to CcMode that can do it, or at least a mode that can handle auto-styling and has similar shortcuts to CcMode.

If there isn't one, any good elisp references to help me get started writing it myself would be greatly appreciated.

EDIT: David's response prompted me to take a closer look at glsl-mode.el, and it is in fact based on cc-mode, so it's exactly what I was looking for in the first place.

Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
Branan
  • 1,819
  • 15
  • 21

2 Answers2

15

Add the following code to your ~/.emacs file.

(autoload 'glsl-mode "glsl-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.vert\\'" . glsl-mode))
(add-to-list 'auto-mode-alist '("\\.frag\\'" . glsl-mode))

Put the file http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/glsl-mode.el somewhere on your emacs path. You can eval (print load-path) in your scratch buffer to get the list of possible locations. If you don't have write access to any of those, you can append another location to load-paths by adding

(setq load-path (cons "~/.emacs.d" load-path))

to your ~/.emacs file.

David Nehme
  • 21,379
  • 8
  • 78
  • 117
  • That's the one mentioned at the site a linked to, but I double-checked when you posted it (making the correct assumption that I didn't get all the info the first time). It's exactly what I'm looking for =) – Branan Sep 18 '08 at 19:16
3

Based on GLSL mode, I wrote a similar one for HLSL which is used in Direct3D effect. Here it is. http://sourceforge.net/projects/hlslmode/files/hlsl-mode.el

Buzz
  • 1,549
  • 3
  • 16
  • 31