3

whitespace-mode will show the whitespace all the time in entire buffer, Is there the way to show whitespaces only when the region is selected. which is pretty cool to have, does there mode exist for such feat or an configuration.

There is exists the similar functionality in sublime editor, as show in screenshot.

enter image description here

4
  • 1
    To clarify, in addition to "show whitespace only when the region is selected" did you also mean you only want whitespace to show in the selected region? Dec 11, 2019 at 3:33
  • yes, within the selected region only, similar to what sublime text does.
    – rho
    Dec 11, 2019 at 5:01
  • 1
    Show a screenshot of "what sublime text does" (few readers will have used it), and point out any particularly aspects which are most important (as I'm doubtful that whitespace-mode can be adapted easily, but maybe something else can be done which would suffice).
    – phils
    Dec 11, 2019 at 20:45
  • 2
    This is theoretically possible by recreating the features of whitespace mode using overlays or other tools, but as is, you can't configure whitespace mode to do this, whitespace mode uses display tables. It is not possible to have a display table apply to part of a buffer, it must be applied to the whole thing. Is there a specific feature of whitespace mode that is most important? Such as just displaying space or tab characters as a different character? Dec 12, 2019 at 14:50

1 Answer 1

4

This maybe what your are looking for:

https://github.com/twlz0ne/whitespace4r.el

enter image description here

1
  • finally, what I wanted, after so long time.. but buggy but workable.
    – rho
    Mar 12, 2022 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.