(defun my-c-ts-indent-style () `(((and (node-is "{") (parent-is "enum_specifier")) parent-bol 0) ((and (node-is "}") (parent-is "enum_specifier")) parent-bol 0) ((parent-is "enumerator_list") parent-bol c-ts-mode-indent-offset) ,@(alist-get 'bsd (c-ts-mode--indent-styles 'cpp)))) (defun my-c-ts-allman-4 () (setq-local indent-tabs-mode nil) (when (boundp 'c-ts-mode-indent-offset) (setq-local c-ts-mode-indent-offset 4)) (when (boundp 'c-ts-indent-offset) (setq-local c-ts-indent-offset 4)) (setq-local c-ts-mode-indent-style #'my-c-ts-indent-style) ;; (setq-local comment-start "// ") ;; (setq-local comment-end "") ) (add-hook 'c-ts-mode-hook #'my-c-ts-allman-4) (add-hook 'c++-ts-mode-hook #'my-c-ts-allman-4) (add-to-list 'auto-mode-alist '("\\.h\\'" . c++-ts-mode)) (provide 'my-cpp)