Changes between Initial Version and Version 1 of Editor Utils/Emacs Highlight


Ignore:
Timestamp:
Mar 27, 2007, 10:02:13 PM (17 years ago)
Author:
Nicolas Pouillon
Comment:

Add in soclib highlight elisp script

Legend:

Unmodified
Added
Removed
Modified
  • Editor Utils/Emacs Highlight

    v1 v1  
     1= Introduction =
     2
     3In [wiki:WritingRules/Caba#Namingconventions caba writing rules] are some
     4naming conventions for signals, ports and registers. If you follow those rules,
     5you may want to have those datatypes highlighted automagically by your favorite editor.
     6Here is an emacs file for such a purpose.
     7
     8= Usage =
     9
     10Put this file in `soclib.el`, then edit your `~/.emacs` and add a line:
     11{{{
     12(load "/path/to/soclib.el")
     13}}}
     14
     15= soclib.el =
     16
     17{{{
     18(defun soclib-make-face (face colour &optional bold)
     19  "Create a face from a colour and optionally make it bold"
     20  (make-face face)
     21  (copy-face 'default face)
     22  (set-face-foreground face colour)
     23  (if bold (make-face-bold face))
     24  )
     25
     26(soclib-make-face 'soclib-font-method "DarkSalmon" t)
     27(soclib-make-face 'soclib-font-member "DarkSeaGreen" t)
     28(soclib-make-face 'soclib-font-register "MediumSpringGreen" t)
     29(soclib-make-face 'soclib-font-port "DarkTurquoise" t)
     30(soclib-make-face 'soclib-font-namespace "DarkOrange")
     31
     32(setq c++-font-lock-extra-types
     33          (append (list
     34           "[A-Z][A-Za-z0-9]+" "sc_[a-z_]+")
     35           c++-font-lock-extra-types))
     36
     37(font-lock-add-keywords
     38 'c++-mode
     39 '(("\\<\\([a-z_]+[A-Z][A-Za-z0-9_]*\\)\\>" . 'soclib-font-method)
     40   ("\\<\\(m_[a-z_]+\\)\\>" . 'soclib-font-member)
     41   ("\\<\\(r_[a-z_]+\\)\\>" . 'soclib-font-register)
     42   ("\\<\\(p_[a-z_]+\\)\\>" . 'soclib-font-port)
     43   ("\\<\\([a-z_]+\\)::" . 'soclib-font-namespace)
     44;   ("\\([a-z_][A-Z][A-Za-z0-9_]*\\)" . 'soclib-font-method)
     45   ("std::\\([a-z]+\\)\\>" . font-lock-type-face)
     46   ))
     47}}}