]> git.eshelyaron.com Git - emacs.git/commit
Make c-ts-mode indent tests side-effect-free
authorYuan Fu <casouri@gmail.com>
Fri, 3 Feb 2023 02:23:21 +0000 (18:23 -0800)
committerYuan Fu <casouri@gmail.com>
Fri, 3 Feb 2023 02:32:08 +0000 (18:32 -0800)
commitd963a8f1355a6d829af3f98182e66705c941e774
tree23768d527db2dc85e9332c0443b2c6c53588782f
parent8a6bdf88b4b665916cf74dee3a30e9136a9b6df8
Make c-ts-mode indent tests side-effect-free

Running indent tests changes the global value of
c-ts-mode-indent-style.  That's not good.  This change fixes that.

I also refactored the indent style functions a bit.

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--prompt-for-style): New function.
(c-ts-mode-set-local-style): New function.
(c-ts-mode-set-style): Use c-ts-mode--prompt-for-style.  Use
derived-mode-p when testing for major mode.  Remove check of current
buffer's major mode since it doesn't matter.

* test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts:
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: Use
c-ts-mode-set-local-style to set the indent style locally.
lisp/progmodes/c-ts-mode.el
test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts
test/lisp/progmodes/c-ts-mode-resources/indent.erts