help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help with minor mode for word highlighting


From: kgold
Subject: Re: help with minor mode for word highlighting
Date: 4 Jan 2006 16:35:43 -0600

"perldev@monkeybytes.org" <perldev@monkeybytes.org> writes:
> I'm  
> trying to write a very simple minor-mode for highlighting some words  
> under text-mode. Here are the specifics of what would be great to see  
> example code of:
> 
> -- minor-mode skeleton to run alongside text-mode/paragraph-indent- 
> minor-mode
> -- an example of creating a custom font-lock face for this mode
> -- an example of coloring a list of words using the custom face
> -- an example of coloring based on a regex
> 
> That's it, really. No functions or specified indentation. I just want  
> some special coloring on top of text-mode running paragraph-indent- 
> minor-mode.

This isn't a minor mode, but here's what I did for log4j files:

(defface font-lock-fatal-face
  '((((type tty) (class color)) (:foreground "red" ))
    (t ))
  "Font Lock mode face used to highlight fatal errors."
  :group 'font-lock-highlighting-faces)

(define-generic-mode 'log4j-mode
  '("#")
  '("DEBUG")
  '(
    ("INFO" . 'font-lock-constant-face)
    ("DEBUG" . 'font-lock-keyword-face)
    ("WARN" . 'font-lock-type-face)
    ("ERROR" . 'paren-face-mismatch)
    ("FATAL" . 'font-lock-fatal-face)
)
  '(".log4j\\'")
  nil
  "Major mode for editing log4j logs")


-- 
Ken Goldman   kgold@watson.ibm.com   914-784-7646


reply via email to

[Prev in Thread] Current Thread [Next in Thread]