WordPress.org

Make WordPress Core

Opened 15 years ago

Closed 13 years ago

Last modified 5 years ago

#986 closed enhancement (fixed)

Code Cleanup: Tabs instead of Four Spaces

Reported by: MaThIbUs Owned by: skippy
Milestone: 2.1 Priority: low
Severity: minor Version: 2.1
Component: General Keywords: bg|dev-feedback bg|has-patch
Focuses: Cc:

Description

WordPress can be made even more lightweight by replacing every instance of four repetitive spaces by a tab. I did this for the whole wp-includes/ directory. [Patch included.] Its size went from 406,374 bytes to 383,963 bytes. Spaces are all over the place.

Attachments (6)

986-import.diff (23.2 KB) - added by Nazgul 14 years ago.
986-admin.diff (172.1 KB) - added by Nazgul 14 years ago.
986-plugins.diff (5.3 KB) - added by Nazgul 14 years ago.
986-themes.diff (19.8 KB) - added by Nazgul 14 years ago.
986-root.diff (69.2 KB) - added by Nazgul 14 years ago.
986-includes.diff (210.5 KB) - added by Nazgul 14 years ago.

Download all attachments as: .zip

Change History (15)

#1 @MaThIbUs
15 years ago

  • Patch set to No

#2 @ryan
15 years ago

If we do this, let's wait for a major release. I personally loathe tabs, but the official WP coding guidelines require them. So, doing a big tabify commit at the start of our next major release development cycle could happen. I'd rather not churn the files in the 1.5 dot releases.

edited on: 02-26-05 21:02

#3 @skippy
15 years ago

  • Keywords bg|dev-feedback added
  • Owner changed from anonymous to skippy
  • Priority changed from normal to low
  • Status changed from new to assigned
  • Version changed from 1.5.1 to 1.6

I agree this is a good idea; and 1.6 makes a good target for this.

#4 @markjaquith
15 years ago

  • Milestone set to 1.6

Agreed. 1.6 milestone.

This should be checked over though, and not a blind search/replace. I've seen 5 spaces be used sometimes, not just 4... so if you just replaced 4 spaces, you'd be left with tab + single space.

I don't know if we should be doing this as we patch other issues or on a pure cleanup patch run... or a little of each. I find it hard to resist doing code cleanup as I go, and MaThIbUs is the same way. The only problem with that is that it clutters up the changeset... makes it harder to see what actual functional code was changed.

#5 @MathiasBynens
15 years ago

This should be checked over though, and not a blind search/replace. I've seen 5 spaces be used sometimes, not just 4... so if you just replaced 4 spaces, you'd be left with tab + single space.

Indeed. I actually spent an entire morning creating the patch that has now been deleted, just because of the many repetitive spaces used in functions (i.e. that have their use) and the 5 vs. 4 spaces thing. So... yeahhh.

The excellent UltraEdit-32 Text-Editor features some 1337 functions for this stuff ("Leading Spaces to Tabs", just one click on a button!).

#6 @matt
14 years ago

  • Milestone changed from 1.6 to 2.1

#7 @markjaquith
14 years ago

I'm going to be working through the files in batches, fixing this and many more problems. Going to wait until some of my pending fixes go in before spending time on this... this is the kind of patch you want to go in immediately, before any other code is changed.

@Nazgul
14 years ago

@Nazgul
14 years ago

@Nazgul
14 years ago

@Nazgul
14 years ago

@Nazgul
14 years ago

@Nazgul
14 years ago

#8 @Nazgul
14 years ago

  • Keywords bg|has-patch added
  • Type changed from defect to enhancement
  • Version changed from 1.6 to 2.1

I've made some patches that remove trailing spaces and converts starting spaces to tabs. It's not perfect, but it gets us in that direction.

#9 @ryan
13 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [4495]) Remove trailing spaces and convert spaces to tabs. Props Nazgul. fixes #986

Note: See TracTickets for help on using tickets.