Commit graph

11 commits

Author SHA1 Message Date
Stefan Monnier
83156c183f * lisp/emacs-lisp/smie.el (smie-indent-offset-rule): Rename from
smie-indent-offset-after.  Add :prev case.  Make a bit more generic.
(smie-indent-virtual): Remove `virtual' arg.  Update callers.
(smie-indent-keyword): Add handling of open-paren keywords.
(smie-indent-comment-continue): Don't assume comment-continue.
2010-06-07 15:37:50 -04:00
Stefan Monnier
c2ea581076 Make (after keyword) indent-rules more flexible.
* lisp/emacs-lisp/smie.el (smie-indent-offset-after)
(smie-indent-forward-token, smie-indent-backward-token): New functions.
(smie-indent-after-keyword): Use them.
(smie-indent-fixindent): Only applies to the indentation of the BOL.
(smie-indent-keyword): Tweak the black magic.
(smie-indent-comment-continue): Strip comment-continue before use.
(smie-indent-functions): Indent comments before keywords.
2010-06-06 22:10:19 -04:00
Juanma Barranquero
e2d2a205a5 * emacs-lisp/smie.el (comment-continue): Declare for byte-compiler. 2010-06-03 18:59:29 +02:00
Stefan Monnier
dd2c3c9241 Split smie-indent-calculate into more manageable chunks.
* lisp/emacs-lisp/smie.el (smie-indent-virtual, smie-indent-fixindent)
(smie-indent-comment, smie-indent-after-keyword, smie-indent-keyword)
(smie-indent-close, smie-indent-comment-continue, smie-indent-bob)
(smie-indent-exps): Extract from smie-indent-calculate.
(smie-indent-functions): New var.
(smie-indent-functions): Use them.
2010-06-02 21:48:10 -04:00
Stefan Monnier
927c346bd6 * lisp/emacs-lisp/smie.el (smie-indent-calculate): Simplify and cleanup.
(smie-indent-hanging-p): Use smie-bolp.
* test/indent: New dir.
2010-06-02 16:13:11 -04:00
Stefan Monnier
11e4d8c0d3 Provide hooks to use a different tokenizer in SMIE.
* lisp/emacs-lisp/smie.el (smie-forward-token-function)
(smie-backward-token-function): New vars.
(smie-backward-sexp, smie-forward-sexp)
(smie-indent-hanging-p, smie-indent-calculate): Use them.
(smie-default-backward-token): Rename from smie-backward-token and
skip comments.
(smie-default-forward-token): Rename from smie-forward-token and
skip comments.
(smie-next-sexp): Handle nil results from next-token.
(smie-indent-calculate): Add a new case for special `fixindent' comments.
2010-05-27 00:41:36 -04:00
Stefan Monnier
f5228f8490 * emacs-lisp/smie.el (smie-set-prec2tab): Check override before use.
(smie-merge-prec2s): Pass the tables as separate args.
(smie-bnf-precedence-table): Adjust call accordingly.
(smie-prec2-levels): Set levels at the end.
2010-05-24 22:32:40 -04:00
Stefan Monnier
224b70cbc5 * emacs-lisp/smie.el (smie-next-sexp): Break inf-loop at BOB.
(smie-backward-sexp, smie-forward-sexp): Remove boundary condition now
handled in smie-next-sexp.
(smie-indent-calculate): Provide a starting indentation (so the
recursion is well-founded ;-).
2010-05-18 15:24:24 -04:00
Stefan Monnier
472e7ec1e1 Fix handling of non-associative equal levels.
* emacs-lisp/smie.el (smie-prec2-levels): Choose distinct levels even
when it's not needed.
(smie-op-left, smie-op-right): New functions.
(smie-next-sexp): New function, extracted from smie-backward-sexp.
Better handle equal levels to distinguish the associative case from
the "multi-keyword construct" case.
(smie-backward-sexp, smie-forward-sexp): Use it.
2010-05-18 12:03:51 -04:00
Juanma Barranquero
35e53abd43 * emacs-lisp/smie.el: Fix typos in docstrings. 2010-05-18 09:44:07 +02:00
Stefan Monnier
5ad4bef575 Provide a simple generic indentation engine and use it for Prolog.
* emacs-lisp/smie.el: New file.
* progmodes/prolog.el (prolog-smie-op-levels)
(prolog-smie-indent-rules): New var.
(prolog-mode-variables): Use them to configure SMIE.
(prolog-indent-line, prolog-indent-level): Remove.
2010-05-17 15:27:26 -04:00