Skip to content

automagic indentation behaves strangely #30

Description

@recursive-madman

I'm noticing various situations in which the automatic indentation in haml-mode does not what I expect it to do.

First issue:

Situation:
(using <> to denote my cursor position)

.element-a
  some text
.element-b<>

When I press RET now, I would expect the following result:

.element-a
  some text
.element-b
  <>

What happens instead is this:

.element-a
  some text
  .element-b
    <>

In words: the line I just wrote has become nested under the deepest context above it.

(my workaround for this is currently to press C-j TAB. It is strange that this even works, since C-j is bound to electric-newline-and-maybe-indent, which is the function I would expect to have the bahavior that haml-mode apparently attaches to newline)

Second issue:

Situation:

:javascript
  function someFunction() {<>

When I now press RET, the situation becomes:

:javascript
  function someFunction() {
  <>

Pressing TAB now only allows me to step out of the :javascript block (to the left), not indent within it.

I would expect:

:javascript
  function someFunction() {
    <>

So far so good. But it becomes weirder.

Third issue:

:javascript
  function someFunction() {
    someCode();<>

(i.e. I manually indented the line with spaces and wrote a line)

Now when I press RET, the situation again becomes:

:javascript
  function someFunction() {
  someCode();
  <>

In general what all those have in common is that haml-mode is altering the indentation of the line I am leaving, when it should at most change the indentation of the new line I am creating by pressing RET.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions