[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SMIE examples or guides
From: |
Stefan Monnier |
Subject: |
Re: SMIE examples or guides |
Date: |
Thu, 30 Jun 2016 14:49:55 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
> HELLO three one
> four ten BYE
> eleven HELLO
> twelve
> BYE
This goes a bit against SMIE's default indentation principles, so it's
going to take more efforts (IOW adding support for this kind of
indentation is still on the todo list).
Maybe something along the following lines would work:
(defun my-indent-foo ()
(unless (looking-at "BYE\\_>")
(save-excursion
(let ((x nil))
(while (progn (setq x (smie-backward-sexp))
(null (car-safe x))))
(when (equal "HELLO" (nth 2 x))
(goto-char (nth 1 x))
(+ 4 (smie-indent-virtual)))))))
and add
(add-hook 'smie-indent-functions #'my-indent-foo nil t)
in your major mode function.
Stefan
- Re: SMIE examples or guides, (continued)
- Re: SMIE examples or guides, Stefan Monnier, 2016/06/27
- Re: SMIE examples or guides, Björn Lindqvist, 2016/06/27
- Re: SMIE examples or guides, Stefan Monnier, 2016/06/27
- Re: SMIE examples or guides, Björn Lindqvist, 2016/06/28
- Re: SMIE examples or guides, Stefan Monnier, 2016/06/28
- Re: SMIE examples or guides, Björn Lindqvist, 2016/06/28
- Re: SMIE examples or guides, Stefan Monnier, 2016/06/29
- Re: SMIE examples or guides, Björn Lindqvist, 2016/06/29
- Re: SMIE examples or guides, Stefan Monnier, 2016/06/30
- Re: SMIE examples or guides, Björn Lindqvist, 2016/06/30
- Re: SMIE examples or guides,
Stefan Monnier <=
- Re: SMIE examples or guides, Björn Lindqvist, 2016/06/30