Fix c-ts-mode indentation

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.
This commit is contained in:
Yuan Fu 2023-03-05 15:22:36 -08:00
parent d724d7d678
commit 1c67e4f895
No known key found for this signature in database
GPG key ID: 56E19BC57664A442
2 changed files with 6 additions and 0 deletions

View file

@ -296,6 +296,9 @@ PARENT and BOL are like other anchor functions."
(setq prev-sibling (treesit-node-child prev-sibling -2))) (setq prev-sibling (treesit-node-child prev-sibling -2)))
((or "preproc_elif" "preproc_else") ((or "preproc_elif" "preproc_else")
(setq prev-sibling (treesit-node-child prev-sibling -1))) (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 ;; If the start of the previous sibling isn't at the
;; beginning of a line, something's probably not quite ;; beginning of a line, something's probably not quite
;; right, go a step further. ;; right, go a step further.

View file

@ -89,6 +89,9 @@ int main() {
#else #else
if (f->output_method == output_termcap) if (f->output_method == output_termcap)
create_tty_output (f); create_tty_output (f);
#elif defined (HAVE_X_WINDOWS) /* X without toolkit. */
if (FRAME_WINDOW_P (f))
{}
#endif #endif
t->display_info.tty->top_frame = selected_frame; t->display_info.tty->top_frame = selected_frame;
change_frame_size (); change_frame_size ();