summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cursor-sensor.el
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2023-02-05 19:32:24 -0800
committerYuan Fu <casouri@gmail.com>2023-02-06 18:29:38 -0800
commit87d39a30b1264e111cfd2f9cbdc95dcd0870684b (patch)
tree6e36ae744441eecf51ae5c6e8d3099cd9705b1e7 /lisp/emacs-lisp/cursor-sensor.el
parent7cb92b5398771b088450942d9eaefd53b5f91cf6 (diff)
downloademacs-87d39a30b1264e111cfd2f9cbdc95dcd0870684b.tar.gz
emacs-87d39a30b1264e111cfd2f9cbdc95dcd0870684b.tar.bz2
emacs-87d39a30b1264e111cfd2f9cbdc95dcd0870684b.zip
Fix c-ts-mode indentation
Sign, ok, there's another edge case: else if statements. Because "else if" is usually implemented as just another if statement nested in the else branch, this creates additional levels that indentation needs to ignore. I converted c-ts-common-indent-block-type-regexp + c-ts-common-indent-bracketless-type-regexp into a new, more flexible variable, c-ts-common-indent-type-regexp-alist, to avoid adding yet more variables in order to recognize else and if statements. * lisp/progmodes/c-ts-common.el: (c-ts-common-indent-type-regexp-alist): New variable. (c-ts-common-indent-block-type-regexp) (c-ts-common-indent-bracketless-type-regexp): Remove variables. (c-ts-common--node-is): New function. (c-ts-common-statement-offset): Use the new variable, and add the "else if" special case. Also merge the code of c-ts-mode--fix-bracketless-indent, because now the code is much more succinct. (c-ts-mode--fix-bracketless-indent): Merge into c-ts-common-statement-offset. * lisp/progmodes/c-ts-mode.el: (c-ts-base-mode): Setup c-ts-common-indent-type-regexp-alist. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.
Diffstat (limited to 'lisp/emacs-lisp/cursor-sensor.el')
0 files changed, 0 insertions, 0 deletions