summaryrefslogtreecommitdiff
path: root/test/lisp/progmodes/c-ts-mode-resources
diff options
context:
space:
mode:
authorTheodor Thornhill <theo@thornhill.no>2023-02-17 20:46:19 +0100
committerTheodor Thornhill <theo@thornhill.no>2023-02-19 20:47:05 +0100
commitc544df4fa3f217d0039bb9cb38c809c830558c25 (patch)
tree42866178c7efae24f7bb88b1d564166ab61338c6 /test/lisp/progmodes/c-ts-mode-resources
parentd397f3d508464b1eab2d2b3b7e4c3b80aff9d536 (diff)
downloademacs-c544df4fa3f217d0039bb9cb38c809c830558c25.tar.gz
emacs-c544df4fa3f217d0039bb9cb38c809c830558c25.tar.bz2
emacs-c544df4fa3f217d0039bb9cb38c809c830558c25.zip
Cleanup preproc indent for c-ts-mode (bug#61558)
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Make sure we indent to great-grand-parent if inside an #ifdef...#endif block. If grand-parent is root node, then don't indent one step. (c-ts-mode--preproc-offset): New helper anchor function to calculate indent offset.
Diffstat (limited to 'test/lisp/progmodes/c-ts-mode-resources')
-rw-r--r--test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts b/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts
new file mode 100644
index 00000000000..5a4996f642e
--- /dev/null
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts
@@ -0,0 +1,45 @@
+Code:
+ (lambda ()
+ (c-ts-mode)
+ (newline)
+ (indent-for-tab-command))
+
+Point-Char: |
+
+Name: Indents inside #if preproc
+
+=-=
+static void
+free_glyph_pool (struct glyph_pool *pool)
+{
+ if (pool)
+ {
+#if defined GLYPH_DEBUG|
+#endif
+ }
+}
+=-=
+static void
+free_glyph_pool (struct glyph_pool *pool)
+{
+ if (pool)
+ {
+#if defined GLYPH_DEBUG
+ |
+#endif
+ }
+}
+=-=-=
+
+Name: Indents to 0 if #if preproc at root
+
+=-=
+#if 0|
+/* */
+static void
+=-=
+#if 0
+|
+/* */
+static void
+=-=-=