# AUCTeX and XEmacs

Ralf Angeli dev.null at iwi.uni-sb.de
Wed Sep 1 06:22:30 EDT 2004

* Stephen J. Turnbull (2004-09-01) writes:

>>>>>> "Ralf" == Ralf Angeli <dev.null at iwi.uni-sb.de> writes:
>
>     Ralf> Well, XEmacs (21.4 or 21.5) doesn't seem to provide
>     Ralf> functionality for lowering or raising characters, be it via
>     Ralf> faces or extents.
>
> Glyphs have a baseline property:

The current implementation in AUCTeX (which is just an adaption of the
code in CVS Emacs) does the whole lowering/raising stuff via
font-locking.  The match function will return a list of text
properties which looks like '(face foo-face display (raise 0.3)).  So
my (maybe naive) approach was to try your suggestion by just returning
something like '(end-glyph (make-glyph "X")) in the hope that this is
somehow translated by the text properties interface to the respective
extent property.  But AFAICS font-lock-apply-highlight' cannot handle
such lists (the same is true for Emacs 21.3 or earlier).

>     Ralf> For example the functionality related to extents or text
>     Ralf> properties respectively.  At least in XEmacs 21.4.15 I could
>     Ralf> not find a way to generate a glyph (to be used with the
>     Ralf> 'end-glyph property of an extent) which holds line breaks or
>     Ralf> multiple faces.
>
> Why do you need to do that?  (There may be alternative ways to
> accomplish the task.)  You may simply need to use the baseline or
> contrib-p flags, but I've never really tried it.

Sorry, I probably switched topics without indicating this clearly.
AUCTeX provides functionality to "fold" LaTeX macros and environments.
That means, if you have e.g. "\emph{foo}" in your LaTeX source you can
hide the macro part and the braces and only "foo" will be displayed
with the respective face provided by font-locking.  Another
possibility is to show a predefined string instead of the whole
macro.  That means you can display "[f]" instead of "\footnote{bar}".
The original content will only be revealed upon entering the display
string with the cursor.

There are cases where the content of the LaTeX macro spans several
lines in the buffer.  This is handled nicely by Emacs where the
display property of an overlay can hold linebreaks.  In XEmacs the
end-glyph property of an extent is used with a glyph made of the
contents of the LaTeX macro.  Unfortunately linebreaks will vanish if
the respective string is transformed to a glyph.

As an example, suppose you have this in your buffer:

text text text text text text text text text text \emph{foo foo foo
foo foo foo} text text text text

In Emacs you'll get

text text text text text text text text text text foo foo foo
foo foo foo text text text text

In XEmacs you'll get

text text text text text text text text text text foo foo foofoo foo foo text text text text

>     Ralf> Another disadvantage for XEmacs/AUCTeX users is that help
>     Ralf> strings are not available in menus.
>
> It wouldn't occur to me to implement such a thing, and I would turn it
> off as soon as it appeared.  But I can very easily live with a
> menu-help-sucks' flag, even defaulted to nil'.
>
`