diff --git a/init.el b/init.el index 323da33..eb9cb14 100644 --- a/init.el +++ b/init.el @@ -1480,7 +1480,11 @@ With PROJECT, give diagnostics for all buffers in the current project." "--clang-tidy" "--completion-style=detailed" "--header-insertion=never" "--pch-storage=memory" "--function-arg-placeholders" - "--compile-commands-dir=build")))) + "--compile-commands-dir=build"))) + ;; this should come after the above + (add-to-list 'eglot-server-programs + (cons '(arduino-ts-mode) + '("arduino-language-server")))) (use-package eglot-inactive-regions :custom (eglot-inactive-regions-style 'darken-foreground) @@ -1951,7 +1955,18 @@ If inside a comment and in multi-line comment mode, act as "gO" #'my/find-other-file-other-window) (evil-define-key 'normal 'objc-mode-map "go" #'my/find-other-file - "gO" #'my/find-other-file-other-window)) + "gO" #'my/find-other-file-other-window) + (defun -arduino-ts-mode-set-modeline (oldfun) + "Override the modeline set by c++-ts-mode. +This is :around advice, so OLDFUN is the real function +`c-ts-mode-set-modeline'." + (if (not (eq major-mode 'arduino-ts-mode)) + (funcall oldfun) + (setq mode-name (concat "Arduino C++" (string-trim-right comment-start))) + (force-mode-line-update))) + (advice-add 'c-ts-mode-set-modeline :around #'-arduino-ts-mode-set-modeline)) +(define-derived-mode arduino-ts-mode c++-ts-mode "Arduino C") +(add-to-list 'auto-mode-alist '("\\.ino\\'" . arduino-ts-mode)) ;; GLSL (use-package glsl-mode)