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

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

Re: allout and font-locking


From: Marc Croteau
Subject: Re: allout and font-locking
Date: Wed, 07 Mar 2012 15:52:07 -0500
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/23.3 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Hi Stephen,
As you suggested, the color highlights came through.
My mistake was that in tracking down the code suggestions various people
had made, I put your code in but did not add the very necessary code:
(defun srb-allout-font-lock-mode ()
>   (font-lock-add-keywords nil srb-allout-font-lock-keywords))

> (add-hook 'allout-mode-hook 'srb-allout-font-lock-mode)
to my .init file.
Once again,
Thanks a bunch and sorry to have wasted your time.
Regards,
Marc

> On Tue, 06 Mar 2012 12:27:54 -0500 Marc Croteau <mdcroteau@gmail.com> wrote:
>> I'm having problems getting the font-locking features to work. I hope
>> someone can help me.
>> I have allout (version 2.3) working just fine but the color highlighting is 
>> NOT
>> working.
>> 
>> I'm running emacs 23.3 on a ubuntu box running 11.10.
>> I've tried the suggestions made in (1) the emacswiki with respect to
>> (defvar rf-allout-font-lock-keywords...
>> and (2) suggestions in this mailing list by Stephen Berman and also
>> Tassilo Horn and don't seem to get the color highlighting I'm
>> expecting.

> The code I posted here five years ago still works for me on openSUSE's
> Emacs 23.3 (as well as with the current trunk).  I tested by saving your
> test file, starting emacs with -Q and evaluating the following:

> --8<---------------cut here---------------start------------->8---
> (require 'allout)
> (require 'allout-widgets)
> (allout-init t)

> (defvar srb-allout-font-lock-keywords
>     '((eval . (list (concat "^\\(" allout-regexp "\\).+")
>                   0 '(cond ((= (allout-depth) 1)
>                             font-lock-function-name-face)
>                            ((= (allout-depth) 2)
>                             font-lock-variable-name-face)
>                            ((= (allout-depth) 3)
>                             font-lock-keyword-face)
>                            ((= (allout-depth) 4)
>                             font-lock-builtin-face)
>                            ((= (allout-depth) 5)
>                             font-lock-comment-face)
>                            ((= (allout-depth) 6)
>                             font-lock-constant-face)
>                            ((= (allout-depth) 7)
>                             font-lock-type-face)
>                            ((= (allout-depth) 8)
>                             font-lock-string-face)
>                            (t font-lock-warning-face))
>                   t nil)))
>   "Additional expressions to highlight in Allout mode.")

> (defun srb-allout-font-lock-mode ()
>   (font-lock-add-keywords nil srb-allout-font-lock-keywords))

> (add-hook 'allout-mode-hook 'srb-allout-font-lock-mode)
> --8<---------------cut here---------------end--------------->8---

> Then I visited the test file and each instance of "test" had a different
> color.  Can you try the same test?

> Steve Berman





reply via email to

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