I'm using the new emacs 24.4 prettify-symbols-mode
, but it isn't behaving consistently.
I turn it on with:
(prettify-symbols-mode t)
(global-prettify-symbols-mode t)
And I'm trying to change the way python source code looks with the follownig setup:
(add-hook 'python-mode-hook
(lambda ()
(push '("**2" . ?²) prettify-symbols-alist)
(push '("_x" . ?ᵪ) prettify-symbols-alist)
(push '("sum" . ?∑) prettify-symbols-alist)))
This works, but not consistently. For example,
x**2 x_x and sum(x)
all look good.
The inconsistent part is that x**23 maintains the superscript 2, but
the 3 is regular. But if I say x**2+2
, or x**2,
then the **2
is not pretty (and it should be). I'd like the 2 to only be superscript when it is
followed by certain characters (space, plus, comma, etc.).
Alternatively, not superscript if followed by [0-9].
Meanwhile, sum behaves correctly. sum(
, sum**2
, sum+
, and others are
pretty (as they should be) and summer
is not (correctly).