Commit graph

22 commits

Author SHA1 Message Date
Stefan Monnier
4ddea91b84 * lisp/emacs-lisp/smie.el (smie-debug--describe-cycle): Fix typo.
(smie-indent-comment): Be more careful with comment-start-skip.
(smie-indent-comment-close, smie-indent-comment-inside): New funs.
(smie-indent-functions): Use them.
2010-09-21 23:18:08 +02:00
Juanma Barranquero
596880ea94 * emacs-lisp/smie.el (smie-indent--hanging-p): Use `smie-indent--bolp'. 2010-09-20 02:26:22 +02:00
Stefan Monnier
2bc0110432 * lisp/emacs-lisp/smie.el (smie-bnf-precedence-table): Improve error message.
(smie-debug--prec2-cycle, smie-debug--describe-cycle): New functions.
(smie-prec2-levels): Use them to better diagnose precedence cycles.
(smie-blink-matching-check): Don't signal a mismatch if car is t.
(smie-blink-matching-open): Rewrite to remove assumptions, so that
something like "." can also be a closer.
(smie--associative-p, smie-indent--hanging-p, smie-indent--bolp)
(smie-indent--offset, smie-indent--offset-rule, smie-indent--column):
Rename internal functions to use "--".  Update callers.
2010-09-19 16:52:37 +02:00
Stefan Monnier
a49e651ea9 Provide blink-matching support to SMIE.
* lisp/emacs-lisp/smie.el (smie-bnf-closer-alist): New function.
(smie-blink-matching-triggers, smie-blink-matching-inners): New vars.
(smie-blink-matching-check, smie-blink-matching-open): New functions.
2010-09-03 13:18:45 +02:00
Stefan Monnier
c8977b2e62 * lisp/emacs-lisp/smie.el (smie-down-list): New command. 2010-08-31 14:22:40 +02:00
Stefan Monnier
ee992a8ced * lisp/emacs-lisp/smie.el (smie-indent-offset-rule): Let :parent take
a list of parents.
(smie-indent-column): Allow indirection through variables.
2010-08-30 17:21:14 +02:00
Stefan Monnier
710a7f464c Reindent smie.el 2010-08-18 14:10:30 +02:00
Stefan Monnier
b3a8fe90e7 * smie.el (smie-forward-sexp-command): Fix typo. 2010-08-18 14:03:57 +02:00
Stefan Monnier
8723cfa464 Try and remove some of SMIE's black magic by generalizing some rules.
* lisp/emacs-lisp/smie.el (smie-default-backward-token)
(smie-default-forward-token): Strip properties.
(smie-next-sexp): Be more careful with associative operators.
(smie-forward-sexp-command): Generalize.
(smie-backward-sexp-command): Simplify.
(smie-closer-alist): New var.
(smie-close-block): New command.
(smie-indent-debug-log): New var.
(smie-indent-offset-rule): Add a few more cases.
(smie-indent-column): New function.
(smie-indent-after-keyword): Use it.
(smie-indent-keyword): Use it.
Fix up the opener code's point position.
(smie-indent-comment): Only applies at BOL.
(smie-indent-debug): New command.
2010-08-18 12:57:48 +02:00
Juanma Barranquero
ee8359ba5a * emacs-lisp/smie.el (comment-string-strip): Declare function.
(smie-precs-precedence-table): Fix typo in docstring.
2010-06-09 13:40:50 +02:00
Stefan Monnier
e7d67e73b2 * lisp/emacs-lisp/smie.el (smie-indent-keyword): Remove special case that
can be handled with a ((:before "fn") (:prev "=>" parent)) rule.
2010-06-08 22:58:26 -04:00
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