HELP, PLEASE! Syntax problem!
kehoea at parhasard.net
Fri Nov 27 13:48:06 EST 2009
Ar an seachtú lá is fiche de mí na Samhain, scríobh Alan Mackenzie:
> On Fri, Nov 27, 2009 at 10:56:34AM +0100, David Kastrup wrote:
> > 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.
I’m not sure exactly what you’re doing in XEmacs, but is there anything
stopping you keeping the list representing the syntax table for
c-cpp-delimiters around (using it on creation of each such extent) and
modifying and reverting its car every time you want to do this? The
‘inherit’ value (13, as it happens) should be sufficient to have it take its
syntax table from the surrounding text, if that’s what you want. So,
(defvar c-cpp-delimiter-syntax-table '(13))
(put-text-property START END 'category 'text)
(put-text-property START END 'syntax-table c-cpp-delimiter-syntax-table)
(setcar c-cpp-delimiter-syntax-table 14) ;; on entry to c-parse-state
(setcar c-cpp-delimiter-syntax-table 13) ;; on exit from c-parse-state
Now, it’s probably foolhardy of me to suggest this without having tested it
(maybe the syntax-table property is broken ...) but in my defence, I can’t
find your code online.
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
More information about the XEmacs-Beta