[Top][All Lists]

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

Re: How to use `narrow'?

From: David Hansen
Subject: Re: How to use `narrow'?
Date: Tue, 18 Oct 2005 14:53:30 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

On Tue, 18 Oct 2005 02:09:51 +0000 (UTC) Ilya Zakharevich wrote:

> My idea how *I* would use `narrow' is like this:
>   Suppose I have a file which is "in multiple modes".  E.g., consider
>   some "literate programming" style text, or one which contains a
>   HERE-document with a program in a different language than the main
>   text of the document:
>     $var = <<EOV;              # E.g., this is Perl
>        // Here is some code in JavaScript
>        ...
>     EOV
>   So I would like to narrow to the region "inside the HERE-document",
>   and switch the mode to "other mode" (above, from CPerl mode to
>   JavaScript mode).
> However, I looked, and `font-lock' does `widen' before it starts up;
> so all the effect of narrowing is gone...  Is there any *use* of
> narrowing?

Is this working?

(add-hook 'java-scrip-mode-hook 
          (lambda ()
             (make-local-variable 'font-lock-dont-widen t))))

,----[ C-h v font-lock-dont-widen RET ]
| font-lock-dont-widen is a variable defined in `font-lock'.
| Its value is nil
| Documentation:
| If non-nil, font-lock will work on the non-widened buffer.
| Useful for things like RMAIL and Info where the whole buffer is not
| a very meaningful entity to highlight.


reply via email to

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