help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sml-mode indentation for structures


From: Helmut Eller
Subject: Re: sml-mode indentation for structures
Date: Mon, 06 Oct 2014 15:34:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

On Mon, Oct 06 2014, Stefan Monnier wrote:

>> Can somebody tell me how sml-mode indentation rules can be configured?
>
> I guess the "right" way to do that, would be:
>
>    (defun my-sml-rules (orig kind token)
>      (pcase (cons kind token)
>        (`(:before . "d=")
>         (if (smie-rule-parent-p "structure" "signature" "functor") 2
>           (funcall orig kind token)))
>        (`(:after . "struct") 2)
>        (_ (funcall orig kind token))))
>
>    (add-hook 'sml-mode-hook
>              (lambda ()
>                (add-function :around smie-indent-rules #'my-sml-rules)))
>

Thanks!  That works very well.

> -- Stefan "guaranteed 100% untested"

I only had to replace smie-indent-rules with
(symbol-function 'sml-smie-rules).

Helmut


reply via email to

[Prev in Thread] Current Thread [Next in Thread]