Turn off whitespace handling when mode is turned off #5

Merged
merged 1 commit into from Feb 21, 2012

Conversation

Projects
None yet
2 participants
Contributor

edmccard commented Feb 21, 2012

When ethan-wspace mode is turned off with M-x ethan-wspace-mode (or otherwise), any highlighting it has done should be deactivated.

@glasserc glasserc pushed a commit that referenced this pull request Feb 21, 2012

Ethan Glasser-Camp Merge pull request #5 from edmccard/clean-exit
Turn off whitespace handling when mode is turned off
f62930e

@glasserc glasserc merged commit f62930e into glasserc:master Feb 21, 2012

Owner

glasserc commented Feb 21, 2012

Thanks! Although I'm not sure why you'd ever want to turn off ethan-wspace-mode ;)

Contributor

edmccard commented Feb 21, 2012

I never really want to turn it off (by the way, thanks for such a great mode!), but for read-only buffers I wanted to avoid turning it on (not saving == not caring about whitespace).

Unfortunately, you can't just test buffer-read-only inside ethan-wspace-is-buffer-appropriate, because C-x C-r calls the function to turn on the minor mode before it sets the buffer as read-only. So you have to turn it off right after it gets turned on.

Would you be interested in a pull request that allows users to prevent ethan-wspace from applying to read-only buffers?

Owner

glasserc commented Feb 21, 2012

On 02/21/2012 01:08 PM, edmccard wrote:

for read-only buffers I wanted to avoid turning it on (not saving == not caring about whitespace)...
Would you be interested in a pull request that allows users to prevent ethan-wspace from applying to read-only buffers?

Hmm, that's an interesting point. There's certainly no point in having
whitespace cleanup hooks for read-only files, but if, for example, it's
a patch, I want to see any whitespace errors it will introduce if
applied. But then maybe patch files are a special case. I've never been
bothered by whitespace notations in files that I wasn't changing myself
(it's a part of "code smell" for me) but maybe you can give me another
viewpoint?

Ethan

Contributor

edmccard commented Feb 21, 2012

It's more of a personal quirk than a viewpoint--I have to work with some codebases where (a) I can't or shouldn't be making changes (some odd people frown on whitespace-only diffs) but (b) the temptation to get rid of all the (many) highlighted whitespace errors becomes a distraction when I'm just browsing a file to see what it's doing.

Now that the highlighting goes away when ethan-wspace is turned off, putting a defadvice on toggle-read-only in my .emacs does everything I need, so there's no real need to have that functionality built-in to your mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment