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

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

Re: How to add syntax highlighting inside comments for an existing major


From: Michaël Cadilhac
Subject: Re: How to add syntax highlighting inside comments for an existing major mode
Date: Thu, 11 Oct 2007 12:16:22 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux)

Julien Barnier <jbarnier@ens-lsh.fr> writes:

> In this mode, comments are lines that begins with one or several
> «#». What I would like to display differently those which begin with
> «#####» than those which begin with «####», etc.

The simplest way to achieve that is the following, IMO :

(add-hook 'your-mode-hook
          (lambda ()
            (highlight-regexp "^# .*" 'hi-blue)
            (highlight-regexp "^## .*" 'hi-red-b)))

-- 
 |   Michaël `Micha' Cadilhac       |  In a World without Walls and Fences,  |
 |   http://michael.cadilhac.name   |     who needs Windows and Gates?       |
 |   JID/MSN:                       |          -- Dino Esposito              |
 `----  michael.cadilhac@gmail.com  |                                   -  --'

Attachment: pgpDPkrGJOk4g.pgp
Description: PGP signature


reply via email to

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