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: Stefan Monnier
Subject: Re: sml-mode indentation for structures
Date: Mon, 06 Oct 2014 14:11:28 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

>>>> (add-function :around smie-indent-rules #'my-sml-rules)))
>>> I only had to replace smie-indent-rules with
>>> (symbol-function 'sml-smie-rules).
>> Oh, sorry, it should have been `smie-rules-function'.
>> Using (symbol-function 'sml-smie-rules) instead, ends up being more like
>> the `defadvice' case: it modifies the behavior of sml-mode globally
>> rather than only in the buffer where we run the code.
> I see.  Actually I run the code with eval-after-load; but, yes, using
> sml-mode-hook feels cleaner.

BTW: (add-function <foo> (symbol-function <bar>) <toto>) is generally
better written as (advice-add <bar> <foo> <toto>).  The difference is
that advice-add will work even if <bar> is not yet defined (i.e. no
need for eval-after-load), and it will work if <bar> is autoloaded, and if
it's a macro, etc...


        Stefan




reply via email to

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