all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* font-lock doesn't mark block comments as "multiline"
@ 2007-05-02 12:18 Chris Page
  2007-05-02 13:06 ` David Hansen
  2007-05-04 11:05 ` Chris Page
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Page @ 2007-05-02 12:18 UTC (permalink / raw)
  To: help-gnu-emacs

I'm the maintainer of Dylan mode for emacs (see my .sig). Like C++, 
Dylan has both "end of line" comments beginning with "//" and block 
comments surrounded by "/* ... */".

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.

There are several ways I can imagine fixing this, but I'm wondering why 
font-lock doesn't automatically apply the font-lock-multiline property 
to block comments when it's applying the face to them.

Is there some other, recommended solution?

-- 
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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: font-lock doesn't mark block comments as "multiline"
  2007-05-02 12:18 Chris Page
@ 2007-05-02 13:06 ` David Hansen
  2007-05-04 11:05 ` Chris Page
  1 sibling, 0 replies; 4+ messages in thread
From: David Hansen @ 2007-05-02 13:06 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 02 May 2007 05:18:11 -0700 Chris Page wrote:

> Is there some other, recommended solution?

It should work w/o any problems if modify the syntax table.  AFAIK this
(C++ style comments) is an example in the elisp manual.

Can you post the relevant code?

David

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: font-lock doesn't mark block comments as "multiline"
@ 2007-05-03  6:58 martin rudalics
  0 siblings, 0 replies; 4+ messages in thread
From: martin rudalics @ 2007-05-03  6:58 UTC (permalink / raw)
  To: help-gnu-emacs

> There are several ways I can imagine fixing this, but I'm wondering why
> font-lock doesn't automatically apply the font-lock-multiline property
> to block comments when it's applying the face to them.

Comments are handled by syntactic fontification.  "font-lock-multiline
properties" are applied by keywords fontification only.

Please give a precise example where your code fails.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: font-lock doesn't mark block comments as "multiline"
  2007-05-02 12:18 Chris Page
  2007-05-02 13:06 ` David Hansen
@ 2007-05-04 11:05 ` Chris Page
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Page @ 2007-05-04 11:05 UTC (permalink / raw)
  To: help-gnu-emacs

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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-05-04 11:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-03  6:58 font-lock doesn't mark block comments as "multiline" martin rudalics
  -- strict thread matches above, loose matches on Subject: below --
2007-05-02 12:18 Chris Page
2007-05-02 13:06 ` David Hansen
2007-05-04 11:05 ` Chris Page

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.