unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Adaptive filling in comments / highlighting outside them
@ 2003-02-25 13:45 Andrew Ferrier
  2003-02-26  2:09 ` Unknown
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Ferrier @ 2003-02-25 13:45 UTC (permalink / raw)


I have two comment-related problems:

1. I'm trying to figure out how to do adaptive filling within comments
(an example being Emacs lisp ;; style comments). Does anyone know of a
language-independent way of doing this? I can think that possibly I
could play with the adaptive-fill-function, but I can't think how this
could detect comments in a language-independent way (i.e. portable
between different major modes), without re-writing it significantly for
each major mode.

2. I have some special highlighting for C-style languages (C, Perl,
Java), which highlights items like this:

if (x)
{
       	return blah;
}

in red, as I don't like the space between the if and the open
parenthesis. I implement this by adding a regex via
font-lock-add-keywords. Unfortunately, this also matches in comments. Is
there (and I suspect the solution might be related to problem 1) a way
of detecting comments and ignoring these patterns within them? I don't
know that much about the syntax parsing Emacs does for most major modes.
I have researched the above topics and not come up with much. If anyone
could help propose a partial solution, or point me to docs. that might
help, I'd greatly appreciate it.

Regards,
Andrew.

--
Andrew Ferrier
andrew.ferrier@uk.ibm.com

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

* Re: Adaptive filling in comments / highlighting outside them
  2003-02-25 13:45 Adaptive filling in comments / highlighting outside them Andrew Ferrier
@ 2003-02-26  2:09 ` Unknown
  2003-02-26 14:25   ` Andrew Ferrier
  0 siblings, 1 reply; 3+ messages in thread
From: Unknown @ 2003-02-26  2:09 UTC (permalink / raw)


Andrew Ferrier wrote:

> I have two comment-related problems:
> 
> 1. I'm trying to figure out how to do adaptive filling within comments
> (an example being Emacs lisp ;; style comments). Does anyone know of a
> language-independent way of doing this? I can think that possibly I
> could play with the adaptive-fill-function, but I can't think how this
> could detect comments in a language-independent way (i.e. portable
> between different major modes), without re-writing it significantly for
> each major mode.

What do you mean by adaptive filling?

--
Le

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

* Re: Adaptive filling in comments / highlighting outside them
  2003-02-26  2:09 ` Unknown
@ 2003-02-26 14:25   ` Andrew Ferrier
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Ferrier @ 2003-02-26 14:25 UTC (permalink / raw)


In article <ulV6a.61238$b8v1.13566@news04.bloor.is.net.cable.rogers.com>, Le Wang wrote:
>> 
>> 1. I'm trying to figure out how to do adaptive filling within comments
>> (an example being Emacs lisp ;; style comments). Does anyone know of a
>> language-independent way of doing this? I can think that possibly I
>> could play with the adaptive-fill-function, but I can't think how this
>> could detect comments in a language-independent way (i.e. portable
>> between different major modes), without re-writing it significantly for
>> each major mode.
> 
> What do you mean by adaptive filling?

Using adaptive-fill-mode (built into GNU Emacs 21 and possibly others)

-- 
Andrew Ferrier,
WebSphere MQ Install & Packaging Team,
MP 211, IBM UK Labs, Hursley Park, Winchester, SO21 2JN, UK.

andrew.ferrier@uk.ibm.com
tel/fax: 7-246554 or +44 (0) 1962 816554
http://w3.hursley.ibm.com/~ferriera/

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

end of thread, other threads:[~2003-02-26 14:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-25 13:45 Adaptive filling in comments / highlighting outside them Andrew Ferrier
2003-02-26  2:09 ` Unknown
2003-02-26 14:25   ` Andrew Ferrier

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