Skip to content

Wrong indentation after a one line fn #311

@pmontrasio

Description

@pmontrasio

The first snippet is indented correctly with the fn in the Enum.reduce split on three lines.
The line after the Enum.reduce in the second snippet is not indented.

indentation

This is the code to copy and paste to test it

    # indented OK
    Enum.map(addresses, fn({mac_address, dbms}) ->
      sum = Enum.reduce(dbms, fn(x, sum) ->
        x + sum
      end)
      average_dbm = sum / length(addresses)
    end)

    # Not OK
    Enum.map(addresses, fn({mac_address, dbms}) ->
      sum = Enum.reduce(dbms, fn(x, sum) -> x + sum end)
    average_dbm = sum / length(addresses) # this is not indented
    end)

Just in case anybody notices and thinks there is something wrong, I'm using a proportional font and a space happens to be about half the width of a character. Everything works well though.

GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2) of 2014-02-22 on king, modified by Debian

 $ lsb_release -a
LSB Version:    core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:   precise

;;; elixir-mode.el --- Major mode for editing Elixir files

;; Copyright 2011-2015 secondplanet
;;           2013-2015 Samuel Tonini, Matt DeBoard, Andreas Fuchs
;; Authors: Humza Yaqoob,
;;          Andreas Fuchs <[email protected]>,
;;          Matt DeBoard
;;          Samuel Tonini <[email protected]>

;; URL: https://github.com/elixir-lang/emacs-elixir
;; Created: Mon Nov 7 2011
;; Keywords: languages elixir
;; Version: 2.2.8
;; Package-Requires: ((emacs "24") (pkg-info "0.4"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions