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

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

Re: Font-Locking for Allout Mode


From: Stephen Berman
Subject: Re: Font-Locking for Allout Mode
Date: Thu, 08 Mar 2007 23:45:04 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (gnu/linux)

On Thu, 08 Mar 2007 17:42:18 +0100 Tassilo Horn <address@hidden> wrote:

> Stephen Berman <address@hidden> writes:
>
>> You cannot see the fontified allout headings in emacs lisp mode
>> because the emacs lisp comment fontification overrides it.
>
> No, I don't think so. I fontify TODO and FIXME, too, even though they're
> fontified with camment-face by default.

I forgot about this possibility.  I guess I really have no idea then;
hopefully someone who understands font-locking well will chime in.

>> If you use allout with a text-mode file, then you'll see the
>> fontification.
>
> Nope, I changed the first line of my .emacs to 
>
>   ;;; -*- mode: text -*-  -*-coding: utf-8 -*-
>
> but when I opened it no fontification was done, although allout was
> activated automatically.

I meant you should add the file local variable `mode: allout' to a
file you are visiting in the major mode Text Mode.  However, if the
file you are visiting in Text Mode is ~/.emacs, presumably your allout
headings beginning with `;;;_' and if so, they won't match
allout-regexp for Text Mode, so won't get fontified.  Try saving the
following as `allout-test.txt'; I would be surprised, and mystified,
if you still don't see the fontification.

* test
.. test
   test
. , test
    test
.  . test
.   , test
.    . test
       test
.     , test
.      . test
.       , test

* file local variables list
Local variables:
allout-layout: (+ :)
mode: allout
End:

>> I use the same code you do (I had also found it on emacswiki and
>> modified it as you did).  What I meant is that I don't know why it's
>> necessary to add the file local variable for allout-mode (or
>> alternatively, invoke font-lock-fontify-buffer) to see the
>> fontification using that code, so maybe the code isn't quite right.
>
> Hm, maybe. But I think the "mode: allout" can be omitted nowadays. I
> guess I use a newer allout-version than you and it switches on if it
> finds the local variable "allout-layout".
>
> ,----
> | allout-version is a variable defined in `allout.el'.
> | Its value is "2.2.1"
> `----
>
> ,----[ C-h f allout-init RET ]
> | allout-init is an interactive compiled Lisp function in `allout.el'.
> | (allout-init &optional MODE)
> | 
> | Prime `allout-mode' to enable/disable auto-activation, wrt
> | `allout-layout'.
> | ^^^^^^^^^^^^^^^
> `----

I also get "2.2.1" for allout-version.  But I did not mean that I need
to use "mode: allout" to get hiding, navigation, etc. in allout-mode
to work, but only that I need it to get fontification upon visiting a
suitable file using the code adapted from the Emacs Wiki.  That's why
I speculated that that code may be buggy, since indeed, you don't
normally need to have the file local variable "mode: allout".

>> BTW, when I add ";;mode: allout" to an the Local Variables section of
>> an Emacs lisp file with an allout-layout specification, I still get
>> the expected hiding, so it puzzles me that you don't.  Did you eval
>> (allout-init t) before visiting the file?
>
> That's in my .emacs. I think that's omitted in the new allout version
> with respect to allout-layout.

In my allout.el (2.2.1) the docstring of allout-init ends:

"To prime your Emacs session for full auto-outline operation, include
the following two lines in your Emacs init file:

(require 'allout)
(allout-init t)"

Since you have it in yours, I'm at a loss to explain the different
behaviors you and I are observing.

Steve Berman





reply via email to

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