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

correct indentation after one line definition with if keyword #214

Merged
merged 2 commits into from
Jun 1, 2015

Conversation

tonini
Copy link
Contributor

@tonini tonini commented May 31, 2015

fixes #212

Before:

defmodule ControlFlow do
  defmacro my_if(expr, do: if_block), do: if(expr, do: if_block, else: nil)
                                          defmacro my_if(expr, do: if_block, else: else_block) do
                                            quote do
                                              case unquote(expr) do
                                                result when result in [false, nil] -> unquote(else_block)
                                                _ -> unquote(if_block)
                                              end
                                            end
                                            end
end

After:

defmodule ControlFlow do
  defmacro my_if(expr, do: if_block), do: if(expr, do: if_block, else: nil)
  defmacro my_if(expr, do: if_block, else: else_block) do
    quote do
      case unquote(expr) do
        result when result in [false, nil] -> unquote(else_block)
        _ -> unquote(if_block)
      end
    end
  end
end

@tonini
Copy link
Contributor Author

tonini commented May 31, 2015

@mattdeboard review please.

@ianrumford Would be great if you could test this one.

@@ -364,9 +368,13 @@
(t (smie-rule-parent elixir-smie-indent-basic))))))
(`(:before . ";")
(cond
((and (smie-rule-parent-p "if")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These rules are getting quite extensive. We need to start adding comments explaining what these are for.

tonini added a commit that referenced this pull request Jun 1, 2015
correct indentation after one line definition with if keyword
@tonini tonini merged commit ea42d33 into master Jun 1, 2015
@tonini tonini deleted the issue-212 branch June 1, 2015 04:37
@ianrumford
Copy link

Apologies guys, just seen the notification.

I've tested and it works great now.

Thanks to all for time and effort.

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.

Indentation error on consecutive defmacro calls
3 participants