Various updates, fix cpp treesit for emacs v29.4

This commit is contained in:
Andrew Scott 2024-07-09 08:56:24 -04:00
parent 68aeea33eb
commit 411d6caf06
Signed by: a
GPG key ID: 7CD5A5977E4931C1

View file

@ -78,7 +78,7 @@
(add-hook 'after-init-hook #'elpaca-process-queues) (add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order)) (elpaca `(,@elpaca-order))
;; Unload seq before elpaca build - also see `use-package' declaration for seq below ;; Unload `seq' before build
;; https://github.com/progfolio/elpaca/issues/216#issuecomment-1868444883 ;; https://github.com/progfolio/elpaca/issues/216#issuecomment-1868444883
(defun +elpaca-unload-seq (e) (defun +elpaca-unload-seq (e)
(and (featurep 'seq) (unload-feature 'seq t)) (and (featurep 'seq) (unload-feature 'seq t))
@ -198,7 +198,7 @@
)) ))
:hook ((astro-mode :hook ((astro-mode
c-ts-mode c-ts-mode
c++-mode c++-ts-mode
zig-mode) . eglot-ensure)) zig-mode) . eglot-ensure))
(use-package elec-pair (use-package elec-pair
@ -278,14 +278,28 @@
(save-place-mode)) (save-place-mode))
(use-package seq (use-package seq
;; Unload `seq' before elpaca starts building ;; Unload `seq' before `elpaca' starts building
:ensure `(seq :build ,(+elpaca-seq-build-steps))) :ensure `(seq :build ,(+elpaca-seq-build-steps)))
(use-package simple (use-package simple
:ensure nil
:config (setq-default indent-tabs-mode nil)
:hook ((conf-mode prog-mode) . column-number-mode))
(use-package text-mode
:ensure nil
:config (setq-local fill-column 120
whitespace-style '(face
whitespace-missing-newline-at-eof
space-after-tab
space-before-tab
trailing)))
(use-package treesit
:ensure nil :ensure nil
:config :config
(setq-default indent-tabs-mode nil) (push '(c++-mode . c++-ts-mode) major-mode-remap-alist)
(column-number-mode)) (setq treesit-font-lock-level 4))
(use-package whitespace (use-package whitespace
:ensure nil :ensure nil
@ -311,11 +325,18 @@
:custom (esup-depth 0)) :custom (esup-depth 0))
;; Theme ;; Theme
(use-package catppuccin-theme
:config
(setq custom-safe-themes t
catppuccin-flavor 'macchiato)
(catppuccin-reload)
(load-theme 'catppuccin t))
(use-package everforest (use-package everforest
:ensure (everforest :host sourcehut :repo "theorytoe/everforest-theme") :ensure (everforest :host sourcehut :repo "theorytoe/everforest-theme")
:config :config
(setq custom-safe-themes t) ;; (setq custom-safe-themes t)
(load-theme 'everforest-hard-dark t) ;; (load-theme 'everforest-hard-dark t)
(let ((moody_line (face-attribute 'mode-line :foreground)) (let ((moody_line (face-attribute 'mode-line :foreground))
(moody_inactive (face-attribute 'mode-line-inactive :background))) (moody_inactive (face-attribute 'mode-line-inactive :background)))
(set-face-attribute 'mode-line nil :overline moody_line) (set-face-attribute 'mode-line nil :overline moody_line)
@ -378,6 +399,9 @@
;; Better undo/redo ;; Better undo/redo
(use-package undo-tree (use-package undo-tree
:defer 3 :defer 3
:bind (:map undo-tree-map
("C-z" . undo-tree-undo)
("C-M-z" . undo-tree-redo))
:config (global-undo-tree-mode) :config (global-undo-tree-mode)
:custom :custom
(undo-tree-auto-save-history t) (undo-tree-auto-save-history t)
@ -604,7 +628,7 @@
("C-c y s" . yas-insert-snippet) ("C-c y s" . yas-insert-snippet)
("C-c y v" . yas-visit-snippet-file) ("C-c y v" . yas-visit-snippet-file)
:config (yas-reload-all) :config (yas-reload-all)
:hook (lsp-mode . yas-minor-mode)) :hook (prog-mode . yas-minor-mode))
(use-package yasnippet-snippets (use-package yasnippet-snippets
:after (yasnippet)) :after (yasnippet))
@ -614,12 +638,23 @@
;; Visualize color names ;; Visualize color names
(use-package rainbow-mode (use-package rainbow-mode
:hook ((conf-mode lsp-mode) . rainbow-mode)) :hook ((conf-mode
prog-mode
toml-ts-mode) . rainbow-mode))
;; Syntax parsing/highlighting ;; Syntax parsing/highlighting
(use-package treesit-auto (use-package treesit-auto
:defer 1 :defer 1
:config :config
(setq my-cpp-tsauto-config
(make-treesit-auto-recipe
:lang 'cpp
:ts-mode 'c++-ts-mode
:remap 'c++-mode
:url "https://github.com/tree-sitter/tree-sitter-cpp"
:revision "v0.21.0"
:ext "\\.cpp\\'"))
(add-to-list 'treesit-auto-recipe-list my-cpp-tsauto-config)
(treesit-auto-add-to-auto-mode-alist 'all) (treesit-auto-add-to-auto-mode-alist 'all)
(global-treesit-auto-mode) (global-treesit-auto-mode)
:custom :custom
@ -645,12 +680,9 @@
(use-package lsp-mode (use-package lsp-mode
:hook :hook
((;; c-ts-mode ((csharp-ts-mode
;; c++-ts-mode
csharp-ts-mode
go-ts-mode go-ts-mode
python-ts-mode) . lsp) python-ts-mode) . lsp)
;; zig-mode) . lsp)
(lsp-mode . lsp-enable-which-key-integration) (lsp-mode . lsp-enable-which-key-integration)
:custom :custom
(lsp-use-plists t) (lsp-use-plists t)
@ -739,7 +771,7 @@
;; C++ ;; C++
(use-package modern-cpp-font-lock (use-package modern-cpp-font-lock
:hook (c++-mode . modern-c++-font-lock-mode)) :hook (c++-ts-mode . modern-c++-font-lock-mode))
;; Go ;; Go
(use-package go-mode (use-package go-mode