unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Marc Croteau <mdcroteau@gmail.com>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: help-gnu-emacs@gnu.org
Subject: Re: allout and font-locking
Date: Wed, 07 Mar 2012 15:52:07 -0500	[thread overview]
Message-ID: <87ipigcex4.wl%mdcroteau@gmail.com> (raw)
In-Reply-To: <8762eg5fvv.fsf@escher.home>

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	other threads:[~2012-03-07 20:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-06 17:27 allout and font-locking Marc Croteau
2012-03-07 20:13 ` Stephen Berman
2012-03-07 20:52   ` Marc Croteau [this message]

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=87ipigcex4.wl%mdcroteau@gmail.com \
    --to=mdcroteau@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=stephen.berman@gmx.net \
    /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).