unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: myrkraverk@users.sourceforge.net
Cc: help-gnu-emacs@gnu.org
Subject: How do I setup an extremely simple font-lock mode?
Date: Thu, 22 May 2003 21:11:30 +0000	[thread overview]
Message-ID: <16077.15618.129314.900191@jin.tekken> (raw)
In-Reply-To: <AA10E9D0-8C96-11D7-8FED-000393DC711A@mac.com>

Hi,

Matt Noel writes:
 > I want to setup a very simple mode for colorizing a log file.  All I 
 > need to do is highlight any lines with the string ERROR on them.  I've 
 > tried reading the documentation for font-lock but it's not clear how to 
 > do this.
 > 
 > Could someone point me to a simple example, or send one?

Here is an example, it doesn't though specify how you use the mode on
the log file.  Maybe you can edit it to suit your need.

;; This is basically a list of lists with a regular expression and
;; then the font name (or face name).  The numbers below refer to \\(
;; ... \\) constructs that mark what part of the re you want
;; highlighted 
(defconst masp-font-lock-keywords
 '(("^\\(\\(\\sw\\|\\s_\\)+\\)\\>:?[ \t]*\\(\\sw+\\(\\.[lLwWbBsS]\\)?\\)?"
    (1 font-lock-function-name-face) (3 font-lock-keyword-face nil t))
   ("^\\s +\\(\\(\\sw\\|\\s_\\)+\\(\\.[lLwWbBsS]\\)?\\)" 1 font-lock-keyword-face)
   ("^\\(\\s-+\\|\\sw+:\\s-+\\)\\(\\\\[a-zA-Z0-9]+\\)"
    (2 font-lock-constant-face))
   ("\\(\\\\\\sw+\\)"
    (1 font-lock-variable-name-face)))
 "Additional expressions to highlight in Assembler mode.")

(defun masp-mode ()
;;...
  (setq font-lock-defaults '(masp-font-lock-keywords))
;;...
)


Hope this helps,

Johann

-- 
This line is left blank intentionally

  reply	other threads:[~2003-05-22 21:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-22 20:47 How do I setup an extremely simple font-lock mode? Matt Noel
2003-05-22 21:11 ` myrkraverk [this message]
2003-05-23  0:48   ` Matt Noel
     [not found] <mailman.6601.1053636524.21513.help-gnu-emacs@gnu.org>
2003-05-22 23:58 ` Alex Schroeder
2003-05-23 13:50 ` Barman Brakjoller
2003-05-23 15:02 ` kgold
2003-05-23 15:24   ` Bryan W. Lepore
     [not found] <mailman.6614.1053651042.21513.help-gnu-emacs@gnu.org>
2003-05-23 15:03 ` Stefan Monnier
2003-05-23 15:05   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16077.15618.129314.900191@jin.tekken \
    --to=myrkraverk@users.sourceforge.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).