nix-mode: weird indentation

Created on 3 Sep 2016  路  3Comments  路  Source: NixOS/nix

Usually I like to not worry about manually indenting stuff and let Emacs sort it out after the fact. For as long as I've been using nix though I've been seeing some strange behaviour relating to this.

For example, in emacs25/default.nix there are some lines like:

src = fetchgit {
  url = "git://git.savannah.gnu.org/emacs.git";
  rev = "1b5630eb47d3f4bade09708c958ab006b83b3fc0";
  sha256 = "0n3qbri84akmy7ad1pbv89j4jn4x9pnkz0p4nbhh6m1c37cbz58l";
};

If I select the region and run M-C-\ (indent-region), it looks like this:

  src = fetchgit {
    url = "git://git.savannah.gnu.org/emacs.git";
      rev = "1b5630eb47d3f4bade09708c958ab006b83b3fc0";
        sha256 = "0n3qbri84akmy7ad1pbv89j4jn4x9pnkz0p4nbhh6m1c37cbz58l";
        };

I can reproduce this reliably by starting from emacs -q and installing nix-mode from Melpa.

I thought this might be related to #828, but I'm not using Spacemacs.

Could it just be that this was never a thing?

Most helpful comment

This is definitely a diplicate of #828. I think the only difference is you don't have an auto indent package turned on.

I've been experimenting with a custom nix-mode.el available at https://github.com/matthewbauer/nix-mode. It has somewhat better indent support although it needs improvement.

All 3 comments

This is definitely a diplicate of #828. I think the only difference is you don't have an auto indent package turned on.

I've been experimenting with a custom nix-mode.el available at https://github.com/matthewbauer/nix-mode. It has somewhat better indent support although it needs improvement.

@matthewbauer It works way better for me. At least, I think you better to pull request it now.

@matthewbauer yes, please consider opening a pull request!

Was this page helpful?
0 / 5 - 0 ratings