michaelklishin / cucumber.el

Emacs mode for editing Cucumber plain text stories
None!
253 stars 90 forks source link

Why does `feature-indent-initial-offset` default to 10? #57

Closed jimeh closed 10 years ago

jimeh commented 10 years ago

Using the following example from Cucumber's wiki:

Feature: Search courses
  Courses should be searchable by topic
  Search results should provide the course code

  Scenario: Search by topic
    Given there are 240 courses which do not have the topic "biology"
    And there are 2 courses, A001 and B205, that each have "biology" as one of the topics
    When I search for "biology"
    Then I should see the following courses:
      | Course code |
      | A001        |
      | B205        |

With the default settings, and calling indent-region against the whole file, it ends up looking like this:

          Feature: Search courses
  Courses should be searchable by topic
  Search results should provide the course code

            Scenario: Search by topic
    Given there are 240 courses which do not have the topic "biology"
    And there are 2 courses, A001 and B205, that each have "biology" as one of the topics
    When I search for "biology"
    Then I should see the following courses:
      | Course code |
      | A001        |
      | B205        |
michaelklishin commented 10 years ago

No particular reason. What value works well for you? (with examples, please — the one you have in the issue are very indicative!).

jimeh commented 10 years ago

Uhm, I think my question falls more under why is it not 0? And in what circumstance is that feature useful? I'm no Cucumber guru, nor do I interact with the community, so it could simply be that I'm highly uninformed and/or an idiot.

I simply don't understand what the use there is for adding 10 (or another number) extra spaces to the indentation.

michaelklishin commented 10 years ago

It was introduced in c6551af53a98647181185aad78c5506c6de91634 by @mar-kolya. Perhaps he can provide some reasoning behind this decision.

mar-kolya commented 10 years ago

Well, I do not think it was introduced by me originally.

If you look into that commit you may notice that all I did was to replace hardcoded '10' in the code with customizable variable. And IIRC I did it exactly for the reason that 10 seemed unreasonable to me and this gives me an ability to customize it in my setup.

Hope this helps :)

michaelklishin commented 10 years ago

@mar-kolya thanks for the clarification. @jimeh do you want to submit a PR that changes 10 to a value that works better in your opinion?

jimeh commented 10 years ago

@michaelklishin Sounds like a plan. I'll do a little bit of digging after work today to see if I figure out what the purpose actually is incase defaulting it to 0 is stupid. And if not I'll submit a PR :)

jimeh commented 10 years ago

Thanks, and apologies for not getting around to it myself as I promised.