w3m icon indicating copy to clipboard operation
w3m copied to clipboard

Add .editorconfig to make indents align correctly. Also add .gitattributes

Open cizra opened this issue 1 year ago • 3 comments

cizra avatar May 16 '24 11:05 cizra

On Thu, May 16, 2024 at 04:10:21AM -0700, Elmo Todurov wrote:

  • Add .editorconfig and .gitattributes, following the existing style

AFAIU this editorconfig does not insert tabs for every second level of indentation. While the current style might be a bad style, I think it's better to be consistent than to mix two styles.

I'm against merging this.

rkta avatar May 17 '24 06:05 rkta

Would you be kind enough to point to a resource that outlines the code style used for this repository? Thank you.

ndsizeif avatar May 26 '24 12:05 ndsizeif

On Sun, May 26, 2024 at 05:50:44AM -0700, ndsizeif wrote:

Would you be kind enough to point to a resource that outlines the code style used for this repository? Thank you.

I don't know of any resource.

You indent with 4 spaces, but every second level of indentation uses a tab. So if the number of spaces you use for indentation is a multiple of 8, use a tab.

A vim modeline for this style should look like this: /* vi: set sw=4 ts=8 ai noet : */

You find a comment in table.c which looks like this: /* Local Variables: / / c-basic-offset: 4 / / tab-width: 8 / / End: */

I think this is for the original 'lint' tool - from which the words 'linter' and 'linting' come from.

And while this is not my preferred style, with a correctly configured modern editor like vim, it's quite painless to stick to it.

When working with ed it's quite tedious though. ;)

Also, as usual with such old code bases, you will find some place, that use a different style.

If you configure your editor to show tabstops, which you should anyways, it's pretty obvious.

For all other things, look around the place you are editing, and do as you see.

In general w3m uses some pretty standard C style formatting.

Hope this helps.

rkta avatar May 26 '24 16:05 rkta