emacs-devel
[Top][All Lists]
Advanced

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

Re: HELP, PLEASE! Syntax problem!


From: Alan Mackenzie
Subject: Re: HELP, PLEASE! Syntax problem!
Date: Fri, 27 Nov 2009 10:44:19 +0000
User-agent: Mutt/1.5.9i

Morning, David,

On Fri, Nov 27, 2009 at 10:56:34AM +0100, David Kastrup wrote:
> Alan Mackenzie <address@hidden> writes:

> > On Fri, Nov 27, 2009 at 12:48:33AM +0900, Stephen J. Turnbull wrote:
> >> Alan Mackenzie writes:

> >>  > Just as a matter of interest (ha!) Stephen, does XEmacs have an
> >>  > equivalent to the 'category text property?

> >> No.

> > That's a shame.

> >> Eventually I guess we'll have to match the Emacs API, but we don't have
> >> it now.

> > It's more than an API: it's a fundamental feature.  Without it, the
> > only way to change a text property on ALL characters of some class is
> > to scan through the buffer, which would be unacceptably slow for what
> > I need to do.

> > So, yes, please feel free to get it implemented in XEmacs!

> You are underestimating XEmacs.  It has a function iterating over all
> extents (their equivalent of both overlays and text properties) in a
> half-/open/closed range that have a particular set or state of
> properties.  So you can say something like "give me all extents for
> which the property 'category happens to be 'text".

> Something like
> (map-extents (lambda (extent) ...) some-flag (point-min)
>              (point-max) another-flag and-yet-another 'category 'text)

Yes, I've underestimated XEmacs.  But that map-extents is still
hopelessly slow by 2(?) orders of magnitude.  I need to "switch off
macros" each time I call `c-parse-state'.  In Emacs, I comment them out
with exactly this form:

   (put 'c-cpp-delimiter 'syntax-table '(14)) ; 14 is "generic comment".

The rogue file I'm making this change for has 4131 #defines in it.
map-extents would be hopeless for this out-commenting.

> You'll be brooding two hours over the documentation of this function,
> experiment another half an hour, and you are there.

No.  Not for this application.  Typically, `c-parse-state' is called 5
times on a `scroll-down' invocation when the text it's scrolling into
isn't yet fontified.  5 x 4131 = 20656.  You can double that, since these
map-extent change need to be undone at the end of each parse-state.

I'm not even going to bother implementing this for profiling.  I might as
well just check each paren/brace/bracket individually for being inside a
macro, and ignore it when it is.

> XEmacs calls something "API" comparable to a mathematician calling a
> proof "trivial".  Mostly synonymous with "possible".

> Just because XEmacs has a single concept and a single work function for
> something does not mean that it can't be made to do a hundred things.
> You'll be muttering bad things through your teeth whenever you are
> reduced to reverting to map-extents.

> But it is there.  And it does almost any job.

But this one it would do too slowly.

> -- 
> David Kastrup

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

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