Re: [Fabrice Popineau] Re: Need some bug/version info

Ralf Angeli <[email protected]>
Newsgroups gmane.emacs.auc-tex
Message-ID <[email protected]>
* David Kastrup (2005-02-05) writes:

> Ralf Angeli <[email protected]> writes:
>
>> After that the syntactic pass should pick up the syntax properties
>> and fontify the indicated regions.  This is done by the function
>> `font-lock-fontify-syntactically-region'.  But this function does
>> not seem to find the syntax properties.  It uses
>> `parse-partial-sexp' and all sorts of checking on the resulting
>> states which I don't understand.
>
> It appears obvious that it has been a mistake of mine not to mention
> in the release notes for AUCTeX that it generally appears to be a bad
> idea to use XEmacs with AUCTeX if you can avoid it.

I hope this is not a conclusion based on my current disability to
debug XEmacs code.  If the bug had been in Emacs instead of XEmacs I
would have gotten stuck at the same place in the code.


By the way, I just made a big leap forward with respect to the
fontification problem.  It seems that this could actually work in
XEmacs.  After several hours of poking around I found the following
causes why it hasn't been working until now:

  1) `font-lock-syntactic-keywords' doesn't get set in XEmacs.  We
     currently set the variable through `font-lock-defaults' which is
     working fine in Emacs.  While we setq `font-lock-defaults'
     directly, XEmacs font-lock.el proposes to put the respective
     value onto the major mode symbol.  I tried that and it is not
     working either.  I have to investigate further how to do this
     correctly.

  2) The syntax of the matcher for syntactic keywords differs between
     XEmacs and Emacs.  In Emacs it is something like `(1 "\"")' and
     in XEmacs the same has to be written as `(1 (7 . nil))'.

  3) Syntax properties are taken into account during sexp parsing only
     if `parse-sexp-lookup-properties' is t.  In XEmacs 21.4 the
     default value for it is nil.

While finding out all these things the following testcase evolved. You
can test it by pasting it into the *scratch* buffer and typing `C-x
C-e' at the last parenthesis.

(progn
  (require 'font-lock)
  (setq font-lock-cache-position
	(save-excursion (goto-char (point-min)) (point-marker)))
  (insert "\n\nasdf zasdfz asdf \"asdf\"")
  (add-to-list 'font-lock-syntactic-keywords
	       '("\\(z\\)[^z]+\\(z\\)" (1 (7 . ?z)) (2 (7 . ?z))))
  (setq parse-sexp-lookup-properties t)
  (font-lock-fontify-region (point-at-bol) (point-at-eol)))

The string between the "z" characters as well as the one between the
quotation marks should be highlighted.  The latter is a positive test
for checking if fontification is actually happening.

By implementing some brute force changes in my local font-latex.el I
already managed to make XEmacs fontify verbatim environments.
Verbatim commands are not working yet.

I just wonder why the interfaces of Emacs' and XEmacs' font-lock.el
have to differ so much ...

-- 
Ralf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.