formatting - sml-mode for emacs does extremely strange things. Is there an alternative, or an easy elisp fix? -
i'm having lot of trouble getting sml-mode
in emacs sanely indent code. example, here block behaving particularly strangely:
datatype type_node = param of typaram.t | longid of longid.t | offset of field * field list option | list of type_t list | fun of type_t list * t list | | vproc | cont of tyarg.t list option | addr of type_t , dataconsdef_node = consdef of bomid.t * type_t option , field_node = immutable of int * type_t | mutable of int * type_t , fundef_node = def of attrs.t option * bomid.t * typaram.t list option * param.t list option * param.t list option * type_t * exp_t , varpat_node = wild | var of bomid.t * type_t option , caserule_node = longrule of longid.t * varpat_t list * exp_t | literalrule literal.t * exp_t | defaultrule of varpat_t * exp_t , tycaserule_node = tyrule of type_t * exp_t | default of exp_t , simpleexp_node = primop of 'var prim.prim * simpleexp_t list | allocid of longid.t * simpleexp_t list | alloctype of type.t * simpleexp_t list | atindex of int * simpleexp_t * simpleexp_t option | typecast of type.t * simpleexp_t | hostvproc | vpload of int * simpleexp_t | vpaddr of int * simpleexp_t | vpstore of int * simpleexp_t * t | id of longid.t | lit of literal.t | mlstring of string , exp_node = let of varpat.t list * rhs * t | of simpleexp.t * t | fun of fundef.t list * t | cont of bomid.t * param.t list option * t * t | if of simpleexp.t * t * t | case of simpleexp.t * caserule.t list | typecase of typaram.t * tycaserule.t list | apply of longid.t * simpleexp.t list option * simpleexp.t list option | throw of longid.t * simpleexp.t list option | return of simpleexp.t list option , foo_node = bar
apologies huge code dump, content doesn't matter -- extremely inconsistent indentation. attempting define signatures inside of structure foo : sig ... end = struct ... end
block worse:
structure attrs : sig type t datatype node = attributes of string list include wrapped sharing type node' = node sharing type obj = t end
or:
functor dowrap(type node) : sig type t = node wrap.t include wrapped sharing type node' = node sharing type obj = t end = struct open wrap type t = node wrap.t type node' = node type obj = t end
i'm diehard emacs fan , hate have avoid on project, since it's 1 i'll working on the next few months. however, can't turn code in supervisor. above behavior when select block of text , indent-region
.
i've looked @ this answer, solution doesn't apply, since behavior m-c-\
gives me, , huge pain work on code without being able auto-indent whole file.
is there easy fix this? there alternative sml-mode
implementations?
presuming using latest version of sml mode gnu elpa, looks have hit corner-case in built-in smie grammar of sml mode breaks down. had similar issues tuareg mode ocaml.
you need downgrade version of sml mode version 4.0 or lower, can obtain http://www.iro.umontreal.ca/~monnier/elisp/. these versions not yet use smie indentation, ad-hoc indentation code. @ least ocaml , tuareg, found old-fashioned approach yield better , more reliable indentation.
you may want report issue maintainer of sml mode, though, mail address can find in header of sml mode, or in footer of aforementioned website.
Comments
Post a Comment