glasserc/ethan-wspace

An escaped space (\ ) shouldn't be treated as whitespace.

Malabarba opened this issue · 5 comments

In one of my lisp files I had a line like (defcustom name ?\, which basically sets the space char as the initial value of the variable.
After turning on ethan-wspace-mode (and editing + saving the file a few times), the space after \ was removed which means the actual code was changed.

Yikes. Sorry about that. It seems to me that this is hard to do right -- while in Lisp, the "?\ " string means "a literal space" and the space should be preserved, in Bash or JavaScript, a terminal \ is supposed to indicate a line continuation and presumably the space should be removed. ethan-wspace is about making it obvious when there's something invisible going on, so I think the existing behavior is preferable. I'd suggest you write your space as ?\s, or put something after it (a comment to highlight the fact that it's a literal space?).

Yeah, that's what I did to fix it. I just thought you'd like to know this
happens. ;)

@glasserc Instead of matching the character \, you could try matching the syntax class. That would be \\s\\.

@dgutov I don't understand -- how does that solve the problem? Don't you still need to resolve the ambiguity of whether or not the space after the backslash is significant?

@Bruce-Connor Turns out ethan-wspace itself includes the "?\ " character, which now I want to change to "?\s".

Don't you still need to resolve the ambiguity of whether or not the space after the backslash is significant?

Hmm, yes, that's still a problem. Sorry for the noise.