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

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

Re: font-lock doesn't mark block comments as "multiline"


From: Chris Page
Subject: Re: font-lock doesn't mark block comments as "multiline"
Date: Fri, 04 May 2007 11:05:38 GMT
User-agent: MT-NewsWatcher/3.5.2 (PPC Mac OS X)

In article <usenet-B9FD76.05181002052007@newsclstr03.news.prodigy.net>,
 Chris Page <usenet@chris-page*NOSPAM*.org> wrote:

> Although font-lock automatically applies the comment face to block 
> comments when they're defined in the character syntax table, when I edit 
> text within a block comment, it loses the comment face and is fontified 
> as though it were not within a comment.

It turns out, after much debugging, that my font-lock fontify region 
function was erroneously narrowing the buffer to the start of the line 
that was edited (i.e., to the beginning character offset passed to the 
function). This prevented font-lock from being able to see the preceding 
code where the start of the comment is, when performing syntactic 
fontification. The fix is to narrow only to the start of the code.

Some background information: Dylan source files begin with a header with 
keyword/value pairs that have separate character and keyword syntaxes 
from Dylan code. The Dylan Mode region fontification function 
independently fontifies the header and the body of the file (which 
contains the Dylan code) by narrowing the buffer and applying different 
syntax tables and font-lock keywords to each. It must narrow to the 
boundary between the header and the body.

Here's the (fixed) dylan-mode.el if you're interested:

<http://www.opendylan.org/cgi-bin/viewcvs.cgi/trunk/gwydion/tools/elisp/d
ylan-mode.el?rev=11316&view=auto>

-- 
Chris Page - Dylan Programmer

 Open Source Dylan: <http://www.opendylan.org/>
    Dylan Blogging: <http://homepage.mac.com/chrispage/iblog/>
       Dylan Stuff: <http://cafepress.com/chrispage>


reply via email to

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