Help with GNU Emacs syntax.el and XEmacs buffer-syntactic-context et al?
Andreas Röhler
andreas.roehler at online.de
Sat Jun 4 14:19:18 EDT 2011
Am 04.06.2011 00:47, schrieb Mats Lidell:
> Hi,
>
> Been looking again at the task of getting the mode for go work with
> XEmacs and need some help.
>
Hi Mats,
sorry not responding earlier. Did see your previous question, however,
fiddling with some other stuff...
So in short my views at the matter:
The core function of all is `parse-partial-sexp', an extraordinary
powerful reporting tool.
> It uses functions from syntax.el[1] which in GNU Emacs contains
> "helper functions to find syntactic context". Oddly(!?) this file
> contains at the bottom commented out XEmacs(!) compatibility functions
> for "buffer-syntactic-contex" and "buffer-syntactic-context-dept"
> which are found in font-lock.c. This could indicate that we have
> overlapping functionality which in its turn might be better handled by
> just using our APIs instead!?
Below `buffer-syntactic-contex' is `find-context', heading in the same
direction.
Don't oversee it really, would assume it less powerful than
`parse-partial-sexp', probably predating it historically.
As `parse-partial-sexp' is already implemented in XEmacs, looks like
same features as in GNU, suggest to use both, resp. let's see, which
choice programmers make.
I would stick with `parse-partial-sexp'...
>
> I ask myself what is the proper thing to do here:
> 1. Ignore that we have these overlap
IMHO that has been provided to run XEmacs stuff inside GNU, not really
an overlap, just providing some symbols.
and just get the functions in
> syntax.el into XEmacs as is.
> 2. Flip the coin and produce compatibility functions for the
> functions in syntax.el.
> 2. Just change the mode that triggered this, go-mode, to use the
> functions we have in XEmacs.[2]
>
> Yours
>
> Footnotes:
> [1] This is a problem of its own since we have syntax.el already but
> with different functions. I have posted about it earlier but with no
> response. (Adding this footnote in the hope of getting some attention
> to that problem! ;-)
>
> [2] The actual offending function used by go-mode is this:
> (syntax-ppss (&optional pos)
> "Parse-Partial-Sexp State at POS, defaulting to point.
> The returned value is the same as `parse-partial-sexp' except that
> the 2nd and 6th values of the returned state cannot be relied upon.
> Point is at POS when this function returns."
>
> What would be the XEmacs way to implement that?
My suggestion: take the stuff from GNU syntax.el and put it at once into
XEmacs syntax.el - at the beg or end. Unless something conflicts...
`syntax-ppss' it's slightly easier to use in comparision with
`parse-partial-sexp' but does fairly the same AFAIU. It's used widely in
GNU stuff, so let's have it.
Here is a file which displays nicely the results of `syntax-ppss' resp.
`parse-partial-sexp':
http://bazaar.launchpad.net/~python-mode-devs/python-mode/python-mode/view/head:/pars-part-output.el
Cheers,
Andreas
--
https://code.launchpad.net/~a-roehler/python-mode/components-python-mode
https://code.launchpad.net/s-x-emacs-werkstatt/
>
> Yours
More information about the XEmacs-Beta
mailing list