Skip to content

Conversation

@etu
Copy link
Contributor

@etu etu commented Jun 28, 2014

This patch does three things:

  • Displays trailing whitespaces
  • Deletes trailing whitespaces on save -- This includes empty lines at end of file.
  • Adds trailing newline at end of file if there is none.

Also noticed in a comment somewhere that require-final-newline could cause trouble. This is not entirely true.

If you end your file with ?>\n it wont be a problem, but if you end it with ?>\n\n it will be.

But delete-trailing-whitespace will also clear empty lines at the end of the file if they are empty. So it won't cause any trouble as far as I can see.

PSR-2 also states that you shouldn't have any whitespaces at ends of lines, and the PHP CodeSniffer utility that people use requires you to have one newline at end of files.

The first patch was indent, this is whitespaces and newlines. PSR-2 got more rules about it, but that's alot more work to fix... Some day maybe.

@ejmr
Copy link
Collaborator

ejmr commented Jun 28, 2014

Merged as 60224e2. Thank you for the continued work, as you're integrating the PSR-2 style very cleanly with the rest of the CC Mode styles.

@ejmr ejmr closed this Jun 28, 2014
@etu
Copy link
Contributor Author

etu commented Jun 28, 2014

Just started learning elisp as part of my labhours at work, so I'm using them to make improvements for my work-utilities ;)

Also, the part of displaying trailing whitespaces. I don't think that should be part of the indent-mode, since that should be able to configure by the user? Maybe. Displaying and taking actions on trailing spaces are two very different things.

As mentioned in #149 as well.

I added it to PSR-2 since PSR-2 enforces to not have trailing spaces, but I'm not sure I like it. But drupal had it already.

@ejmr
Copy link
Collaborator

ejmr commented Jun 28, 2014

What job do you have where you get to write Elisp? Because I want that, heh.

Since PSR-2 demands no trailing spaces I think we should display trailing whitespace for now. And as you say, the Drupal style already does it. Maybe we should leave it as-is for now until we get any complaints or related bug reports.

@etu
Copy link
Contributor Author

etu commented Jun 28, 2014

Heh, webdev. We write our stuff in PHP. But on friday afterlunch we have "labdays", where we can do projects "more or less" connected to work. So I put learning elisp and working with elisp there to improve my editor for work and use PSR-2 "surpise surprise" ;)

Well, I would say that 149 mentioned above maybe would count as such report. But well, that's up to you ;)

@ejmr
Copy link
Collaborator

ejmr commented Jun 28, 2014

Heh, I did professional web development for some years, which ended up being the reason I started maintaining PHP Mode.

As for #149, I wouldn't mind re-opening it except the original poster never said what style he was using and I didn't want to start changing them all to guess.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants