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

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

Font-Locking for Allout Mode


From: Tassilo Horn
Subject: Font-Locking for Allout Mode
Date: Wed, 07 Mar 2007 21:07:24 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux)

Hello,

I'm a new user of allout-mode and I really like it. The only thing that
has to be improved is the readability of the headings. I would like to
use font locking to adjust the faces like the AUCTeX sectioning faces.

On EmacsWiki [1] I found some snippets for doing that, although the
first one seems to be outline-mode specific. So I adapted it for allout
mode and came up with this:

,----[ ~/.emacs ]
| (defvar th-allout-font-lock-keywords
|   '(;; Highlight headings according to the level.
|     (eval . (list (concat "^\\(" allout-regexp "\\).+")
|                 0 '(or (cdr (assq (allout-depth)
|                                   '((1 . font-lock-function-name-face)
|                                     (2 . font-lock-variable-name-face)
|                                     (3 . font-lock-keyword-face)
|                                     (4 . font-lock-builtin-face)
|                                     (5 . font-lock-comment-face)
|                                     (6 . font-lock-constant-face)
|                                     (7 . font-lock-type-face)
|                                     (8 . font-lock-string-face))))
|                        font-lock-warning-face)
|                 nil t)))
|   "Additional expressions to highlight in Allout mode.")
| 
| (defun th-font-lock-allout ()
|   (interactive)
|   (font-lock-add-keywords nil th-allout-font-lock-keywords))
| 
| (add-hook 'allout-mode-hook
|           'th-font-lock-allout)
`----

But it seems to have no effect. The regexp from above is

"^\\(\\(;;;_[   
]*[\\.,\\*\\+--=>()\\[{}&!\\?#%\"X@\\$~_\\\\:;\\^;;;_]\\)\\|\\(;;;_\\|;;;_\\)+ 
?[^;;;_]\\|\\).+"

It is for allout mode in a emacs lisp buffer. If I enter it in
`re-builder' it matches the allout topic headings just fine.

Can anyone see what's wrong with the code?

Thanks in advance,
Tassilo

Footnotes: 
[1] http://www.emacswiki.org/cgi-bin/wiki/AllOut
-- 
The glass is neither half-full nor half-empty: it's twice as big as it
needs to be.


reply via email to

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