unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19145: 24.4; prettify-symbols-mode inconsistent behavior
@ 2014-11-21 17:40 Ken Mankoff
  2014-11-21 18:15 ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Ken Mankoff @ 2014-11-21 17:40 UTC (permalink / raw)
  To: 19145


I'm having issues with the new prettify-symbols-mode. I'm not sure if
this is a bug, or just a fact that the implementation is limited, in
which case this is a feature request for a more complete implementation.

Some symbols are sometimes not being treated correctly depending on what
characters follow. For example, I have the following setup for coding
Python:

    (prettify-symbols-mode t)
    (global-prettify-symbols-mode t)
    (add-hook 'python-mode-hook
              (lambda ()
                (push '("**2" . ?²) prettify-symbols-alist)
                (push '("_x" . ?ᵪ) prettify-symbols-alist)
                (push '("delta" . ?δ) prettify-symbols-alist)))


The issue may be somewhat subjective. For example, should foo_xx appear
with a subscript x and then a normal x? Or should it appear as I assume
you are reading it with no prettification? I would argue for the latter.
What about foo_x+2? Regardless, I've created a matrix of
prettifications, what I'd expect, and what happens.

| Characters | Expected               | Actual                        | Good? |
|------------+------------------------+-------------------------------+-------|
| foo_x      | subscript x            | subscript x                   | Y     |
| foo**2     | superscript 2          | superscript 2                 | Y     |
| delta      | delta symbol           | delta symbol                  | Y     |
| foo_x+     | subscript x            | No subscript                  | N     |
| foo_xi     | no subscript           | subscript                     | N     |
| foo_x[42]  | subscript              | subscript                     | Y     |
| foo_x**2   | subscript, superscript | no subscript, yes superscript | N     |
| foo**200   | no superscript         | superscript 2                 | N     |
| delta(42)  | delta symbol(42)       | symbol                        | Y     |
| delta+42   | symbol                 | symbol                        | Y     |
| delta**2   | symbol, superscript    | symbol, superscritp           | Y     |
| delta_x    | symbol, subscript      | no symbol                     | N     |

There are some inconsistencies, like why _x+ loses prettification, but
delta+ retains it, or why foo_x_x_x works, but delta_x does not.

Thanks,

  -k.






^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-11-26  2:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-21 17:40 bug#19145: 24.4; prettify-symbols-mode inconsistent behavior Ken Mankoff
2014-11-21 18:15 ` Stefan Monnier
2014-11-21 19:22   ` Ken Mankoff
2014-11-22 16:23     ` Stefan Monnier
2014-11-22 23:57       ` Ken Mankoff
2014-11-24 14:53         ` Stefan Monnier
2014-11-25  9:49           ` Ted Zlatanov
2014-11-25 14:51             ` Stefan Monnier
2014-11-25 15:17               ` Ted Zlatanov
2014-11-25 17:36                 ` Stefan Monnier
2014-11-25 18:53                   ` Ted Zlatanov
2014-11-26  2:23                     ` Stefan Monnier
2014-11-25 14:53             ` Ken Mankoff

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).