summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/regexp-opt.el
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2023-02-26 18:05:13 -0800
committerYuan Fu <casouri@gmail.com>2023-02-26 21:38:22 -0800
commit0f15286c5396e3415e0f40c21b6f6d7554f46a5e (patch)
tree99bf3e05b6bf7762ffb0a681a95d9030e75de4de /lisp/emacs-lisp/regexp-opt.el
parent267fc6d00c4db6f20da3c2d63e48a71ab70505d3 (diff)
downloademacs-0f15286c5396e3415e0f40c21b6f6d7554f46a5e.tar.gz
emacs-0f15286c5396e3415e0f40c21b6f6d7554f46a5e.tar.bz2
emacs-0f15286c5396e3415e0f40c21b6f6d7554f46a5e.zip
New tree-sitter indent anchor standalone-parent used by c-ts-mode
When writing c-ts-mode Theo used parent-bol which works well except one case: 1 for (int i=0; 2 i < 5; 3 i++) { 4 func(i); 5 } In this case, when indenting "func(i)", parent-bol returns the start of "i++" on line 3, instead of the "correct" anchor, the start of "for" on line 1. parent-bol would have worked if the "for (...) {" part is in one line. To support this case I tried numerous things and added a bunch of stuff, culminating in c-ts-common-statement-offset. It's complicated, requires extra setup, and slow. Not anymore! I think the new anchor standalone-parent really captures the logic behind how people expect indentation to work. It's simple and fast, and requires no setup. * doc/lispref/modes.texi (Parser-based Indentation): Update manual. * lisp/progmodes/c-ts-mode.el: (c-ts-mode--standalone-grandparent): New anchor. (c-ts-mode--indent-styles): Replace c-ts-common-statement-offset with standalone-parent. (c-ts-base-mode): Add comment. * lisp/treesit.el: (treesit-simple-indent-presets): New anchor standalone-parent.
Diffstat (limited to 'lisp/emacs-lisp/regexp-opt.el')
0 files changed, 0 insertions, 0 deletions