Is there a way to prettify symbols without running into alignment issues? E.g. replacing not with ¬is visually pleasing, but screws up code alignment, b/c not is 3 chars while ¬ is one char.

Since prettifying symbols only changes the way text is displayed, not how it's actually stored, it doesn't make sense for operations like text alignment to use the prettified instead of underlying representations.

  • 2
    Agreed; I consider the feature unusable on account of this issue. – phils May 2 '17 at 23:32
  • 2
    endlessparentheses.com/… is about padding the 'pretty' symbol so that it's actually the same width as the text it's replacing, which works around the alignment issue (at the cost of not being quite as pretty). I can see that being acceptable for very short text, but not for something like the word "lambda", so YMMV. – phils May 2 '17 at 23:37
  • 1
    lambda is OK b/c you don't align with the end of the word, but with the second character, so it works out. That's not the case with not, etc. – Tianxiang Xiong May 3 '17 at 0:34
  • Good point; it would be an abnormal formatting of a lambda form for it to trigger an issue (e.g. a "one liner" where the body actually ended up being split over a second line). Not a typical scenario at all. – phils May 3 '17 at 1:04
  • (push '("not" . (?\s (Bc . Bl) ?¬ (Br . Bc) ?\s (Bl . Br) ?\s)) prettify-symbols-alist) is one way to make not align. You can fiddle around with the spaces etc. as in endlessparentheses.com/… to make it the way you want it. Although, I'd consider it a much nicer solution to have a wider symbol, but I don't think you can do that within prettify-symbols, you'll probably have to mess with set-fontset-font for that. – unhammer Jul 5 '17 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.