From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.help Subject: Re: sml-mode indentation for structures Date: Mon, 06 Oct 2014 15:34:21 +0200 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1412602525 5525 80.91.229.3 (6 Oct 2014 13:35:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 6 Oct 2014 13:35:25 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 06 15:35:19 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xb8Ra-0003u4-Jb for geh-help-gnu-emacs@m.gmane.org; Mon, 06 Oct 2014 15:35:18 +0200 Original-Received: from localhost ([::1]:51961 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xb8Ra-0004GN-8r for geh-help-gnu-emacs@m.gmane.org; Mon, 06 Oct 2014 09:35:18 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.kpnqwest.it!news.kpnqwest.it.POSTED!not-for-mail Original-NNTP-Posting-Date: Mon, 06 Oct 2014 08:34:20 -0500 Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) Cancel-Lock: sha1:SX2FX6f1ToK3SUXVTnJ1mrgBhJU= Original-Lines: 27 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 212.46.173.194 Original-X-Trace: sv3-ROWSDqvKWl9ILaCp+n5sM4TUk49rk5b9LYupwWAJZyuwDq+0VfeymlsL4GWIo6sIo/7Exq7yIBpzelm!xCTKpwR6JHRji/TDJwO1MCHO4XBPwKwcSPNaJV3M3cKqESu91NyvQ8IlB8hsZvI= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1808 Original-Xref: usenet.stanford.edu gnu.emacs.help:208031 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:100307 Archived-At: 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