]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix c-ts-mode indentation
authorYuan Fu <casouri@gmail.com>
Sun, 5 Mar 2023 23:22:36 +0000 (15:22 -0800)
committerYuan Fu <casouri@gmail.com>
Sun, 5 Mar 2023 23:22:36 +0000 (15:22 -0800)
Mentioned in bug#61893.

* lisp/progmodes/c-ts-mode.el (c-ts-mode--anchor-prev-sibling): Handle
"#elif" and "#else".
* test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts: Add an
"#elif" to the test.

lisp/progmodes/c-ts-mode.el
test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts

index 2c534aa785a19981e41c3d0209f0611df17331d2..0b775b2d5c8567465161211b2b780c36cc2458f5 100644 (file)
@@ -296,6 +296,9 @@ PARENT and BOL are like other anchor functions."
            (setq prev-sibling (treesit-node-child prev-sibling -2)))
           ((or "preproc_elif" "preproc_else")
            (setq prev-sibling (treesit-node-child prev-sibling -1)))
+          ((or "#elif" "#else")
+           (setq prev-sibling (treesit-node-prev-sibling
+                               (treesit-node-parent prev-sibling) t)))
           ;; If the start of the previous sibling isn't at the
           ;; beginning of a line, something's probably not quite
           ;; right, go a step further.
index a82596e0010e20547664eb3e07d59a596af7e977..ce753b5b3eac0ccc29bb890d2377176b37fa6794 100644 (file)
@@ -89,6 +89,9 @@ int main() {
 #else
   if (f->output_method == output_termcap)
     create_tty_output (f);
+#elif defined (HAVE_X_WINDOWS) /* X without toolkit.  */
+  if (FRAME_WINDOW_P (f))
+    {}
 #endif
   t->display_info.tty->top_frame = selected_frame;
   change_frame_size ();