bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21492: 25.0.50: Make untabify work nicely with write-file-functions


From: Kaushal Modi
Subject: bug#21492: 25.0.50: Make untabify work nicely with write-file-functions
Date: Wed, 16 Sep 2015 09:13:01 -0400

On another thought, please let me work on an alternative patch that educates user about untabify. Will update in few hours.

On Sep 16, 2015 8:55 AM, "Kaushal Modi" <kaushal.modi@gmail.com> wrote:

> which not consulting the return value indicates

I reviewed the code of untabify and it is not designed to return any value, so setting the return value to nil does not hurt.

> Eg hope you like silently breaking every makefile you ever edit

I agree. The user needs to use their due diligence when they add untabify to write-file-functions. They need to know how and when the hooks work and the exact outcomes of the functions they add to the hooks. So I do NOT add untabify to this hook globally.

> and irritating any other users of a shared VCS with whitespace changes.

- I am using Verilog code almost 95% of the time. For that, tabs don't serve any special intent as in the Makefiles (also, in my career, I have come across Makefile as the only "language" that needs tabs).
- The version control system we use does not care about white space diffs.
- Other team mates would unknowingly use tabs instead of spaces (they wouldn't have cared if they used tabs or spaces or knew what difference that makes). But that caused a lot of visual indentation annoyances and trouble using stuff like multiple cursors. If you have a column of contiguous white space stretching multiple lines, with some lines having spaces and some having tabs, you won't be able to get a straight column of multiple cursors through that.

So in the end, adding untabify locally only for verilog-mode-hook was a transparent action.. No one realized that untabification was happening and I also got to improve my coding experience.

That said, if making untabify returning nil does not break its functionality when using alone or in correspondence with other functions, is there any opposition to this commit.

As for the "issue" of vcs white space pollution, the user simply should not add this function to the hook if they care about the whitespace pollution.

--
Kaushal Modi

On Sep 16, 2015 4:24 AM, "Glenn Morris" <rgm@gnu.org> wrote:
Kaushal Modi wrote:

> I personally have dealt with the issue where I cannot add untabify directly
> to write-file-functions hook, because untabify does not return nil.
>
> I need some sort of custom wrapper that runs untabify and then returns nil.

I'm pretty sure this has come up before.
IMO it's a feature. :)
Simply adding untabify to write-file-functions without thinking about it
(which not consulting the return value indicates) is a recipe for trouble.
Eg hope you like silently breaking every makefile you ever edit,
and irritating any other users of a shared VCS with whitespace changes.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]