emacs-devel
[Top][All Lists]
Advanced

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

Re: prettify-symbols-mode to handle "\alpha-\beta" ...


From: Óscar Fuentes
Subject: Re: prettify-symbols-mode to handle "\alpha-\beta" ...
Date: Thu, 04 Feb 2021 04:39:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

pietru@caramail.com writes:

>> The docstring of prettify-symbols-alist says:
>> 
>>   Each element looks like (SYMBOL . CHARACTER), where the symbol
>>   matching SYMBOL (a string, not a regexp) will be shown as CHARACTER
>>   instead.
>> 
>> so no, SYMBOL *must* *not* be a regexp.
>> 
>> I can't reproduce the problem you are describing. After starting Emacs:
>> 
>> emacs -Q
>> 
>> if I evaluate this in *scratch*:
>> 
>>   (push '("\\alpha" . ?α) prettify-symbols-alist)
>> 
>> then open a .tex file, write \alpha_i, M-x prettify-symbols-alist, the
>> string is transformed to α_i.
>> 
>> Please note that the definition of SYMBOL depends on the major mode of
>> the buffer, so make sure that your current major mode is tex-mode.
>> 
>
> No, the major mode is texinfo-mode.  Texinfo allows mathematics to be
> displayed using the usual tex expressions.  Could this functionality
> be put for use in texinfo-mode?

I missed the texinfo bit on your original message, sorry.

Supporting what you want would require either changing what texinfo
considers a symbol or changing prettify-symbols-mode to work on
something else instead of symbols.

Probably the easiest route for you is to derive a mode from texinfo-mode
that modifies the syntax table defined in texinfo.el to suit your needs
(see "Syntax Tables" in the Elisp manual).

If you insist on changing texinfo-mode itself, put those modifications
on the mode's syntax table and submit the change to the Emacs
maintainers, but my guess is that you will need to give pretty solid
reasons for the change to be accepted, and then wait a long time until
Emacs 28 is released and becomes widespread enough among your target
users.




reply via email to

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