Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emacs mode indentation is wrong when function return -> is on its own line #8

Closed
steveklabnik opened this issue Feb 2, 2015 · 5 comments · Fixed by #52
Closed

emacs mode indentation is wrong when function return -> is on its own line #8

steveklabnik opened this issue Feb 2, 2015 · 5 comments · Fixed by #52

Comments

@steveklabnik
Copy link
Member

Issue by nikomatsakis
Wednesday Apr 16, 2014 at 19:39 GMT

For earlier discussion, see rust-lang/rust#13566

This issue was labelled with: A-tools in the Rust repository


The following code indents as shown here, which is weird:

pub fn from_pointer_kind(base_mutbl: MutabilityCategory,
                         ptr: PointerKind)
                         -> MutabilityCategory {
                             match ptr {
                             }
                         }

I expect it to be:

pub fn from_pointer_kind(base_mutbl: MutabilityCategory,
                         ptr: PointerKind)
                         -> MutabilityCategory {
    match ptr {
    }
}
@strega-nil
Copy link

Okay, the problem is with (rust-rewind-to-beginning-of-current-level-expr).
When run in the first case:

pub fn test(...
           |...) -> Test {
           ^ Point is here
}

it moves to

pub fn test|(...
           ^ Point is here now
             ...) -> Test {
}

However, when run with the ->, goes from

pub fn test(...)
           |-> Test {
           ^ Point is here
}

to

pub fn test(...)
           |-> Test {
           ^ Point is here
}

As you can see, the point doesn't actually move at all. I'm working on some fixes.

The reason for this is that there is a check for

(while (> (rust-paren-level) current-level)

Which is obviously only true when you are within the parentheses of the argument list.

@nikomatsakis
Copy link
Contributor

🐎 If you fix this bug, you'll be my official rust-mode "Hero of the Day". :)

@strega-nil
Copy link

I have fixed this bug, but the pull request has not been accepted :P

On Thu, Apr 16, 2015 at 4:25 PM Niko Matsakis [email protected]
wrote:

[image: 🐎] If you fix this bug, you'll be my official rust-mode
"Hero of the Day". :)


Reply to this email directly or view it on GitHub
#8 (comment).

@strega-nil
Copy link

Check out #52

@strega-nil
Copy link

Oh, right. Making sure you read this, @nikomatsakis :P

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 a pull request may close this issue.

3 participants