From f7c8b844da1b4ad08e663bf7f96315b79c40c912 Mon Sep 17 00:00:00 2001 From: John Doty Date: Wed, 30 Aug 2023 14:58:12 -0700 Subject: [PATCH 1/3] [emacs] Global company mode, properly --- .emacs.d/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 4dbec1d..1c7be7e 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -323,10 +323,12 @@ ;; ================================================================= (use-package company :ensure t :commands company-mode + :init + ;; 2023-08-26: Enable comapny mode globally. + (global-company-mode t) :config ;; 2023-08-26: Enable comapny mode globally. (setq company-idle-delay 0.3) - (global-company-mode t) ) ;; ================================================================= From 321599dc60b36ce64f4326d616fa9d69cc65478d Mon Sep 17 00:00:00 2001 From: John Doty Date: Wed, 30 Aug 2023 14:58:44 -0700 Subject: [PATCH 2/3] [emacs] Tree-sitter and whatnot --- .emacs.d/init.el | 60 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 1c7be7e..c1654ca 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -306,6 +306,40 @@ (add-hook 'ispell-minor-mode-hook 'my--fix-aspell) (add-hook 'flyspell-mode-hook 'my--fix-aspell) + +;; ================================================================= +;; Tree Sitter +;; ================================================================= +;; https://www.masteringemacs.org/article/how-to-get-started-tree-sitter +;; +;; 2023-08-26 Wow, like what am I even doing? This goes at the top of the +;; various things because we're going to be playing with modes and whatnot. + +(when (functionp 'tree-sitter-mode) + (setq treesit-language-source-alist + '((bash "https://github.com/tree-sitter/tree-sitter-bash") + (cmake "https://github.com/uyha/tree-sitter-cmake") + (css "https://github.com/tree-sitter/tree-sitter-css") + (elisp "https://github.com/Wilfred/tree-sitter-elisp") + (go "https://github.com/tree-sitter/tree-sitter-go") + (html "https://github.com/tree-sitter/tree-sitter-html") + (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src") + (json "https://github.com/tree-sitter/tree-sitter-json") + (make "https://github.com/alemuller/tree-sitter-make") + (markdown "https://github.com/ikatyang/tree-sitter-markdown") + (python "https://github.com/tree-sitter/tree-sitter-python") + (rust "https://github.com/tree-sitter/tree-sitter-rust") + (toml "https://github.com/tree-sitter/tree-sitter-toml") + (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src") + (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src") + (yaml "https://github.com/ikatyang/tree-sitter-yaml"))) + + ;; (add-to-list 'major-mode-remap-alist '(rust-mode . rust-ts-mode)) + ) + +;; Install them all: +;; (mapc #'treesit-install-language-grammar (mapcar #'car treesit-language-source-alist)) + ;; ================================================================= ;; Text mode configuration. ;; ================================================================= @@ -367,12 +401,13 @@ (use-package eglot :ensure :commands (eglot-ensure eglot) :hook - (python-mode . eglot-ensure) - (rust-mode . eglot-ensure) - (c++-mode . eglot-ensure) - (c-mode . eglot-ensure) - (go-mode . eglot-ensure) ;; 2022-07-29 Add eglot for go - (before-save . eglot-format) ;; 2023-05-25 Format buffers on save + (python-mode . eglot-ensure) + (rust-mode . eglot-ensure) + (rust-ts-mode . eglot-ensure) ;; 2023-08-26 Add eglot for tree-sitter rust? + (c++-mode . eglot-ensure) + (c-mode . eglot-ensure) + (go-mode . eglot-ensure) ;; 2022-07-29 Add eglot for go + (before-save . eglot-format) ;; 2023-05-25 Format buffers on save :bind ("C-c r" . eglot-rename) ;; 2022-08-23 Make rename more accessible ("C-c \\" . eglot-code-actions) ;; 2022-07-29 I want to make code actions easier. @@ -773,14 +808,14 @@ Or, uh, Objective C, I guess." ;; JavaScript Support ;; ================================================================= ;; (require 'rjsx-mode) -(require 'flycheck-flow) -(require 'flow-minor-mode) +;; (require 'flycheck-flow) +;; (require 'flow-minor-mode) ;; disable jshint since we prefer eslint checking -(setq-default flycheck-disabled-checkers - (append flycheck-disabled-checkers - '(javascript-jshint))) -(flycheck-add-next-checker 'javascript-eslint 'javascript-flow) +;; (setq-default flycheck-disabled-checkers +;; (append flycheck-disabled-checkers +;; '(javascript-jshint))) +;; (flycheck-add-next-checker 'javascript-eslint 'javascript-flow) ;; (add-to-list 'auto-mode-alist '("\\.js$" . rjsx-mode)) ;; (add-to-list 'auto-mode-alist '("\\.jsx$" . rjsx-mode)) @@ -1224,5 +1259,4 @@ Or, uh, Objective C, I guess." (use-package earthfile-mode :ensure :mode ("\\.earth\\'" "Earthfile\\'")) - ;;; init.el ends here From 0de79998679ebb2468d3a1ecb41afe4f5baa9e55 Mon Sep 17 00:00:00 2001 From: John Doty Date: Wed, 30 Aug 2023 22:00:22 +0000 Subject: [PATCH 3/3] [emacs] Line numbers on all prog modes Let's try it. --- .emacs.d/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index c1654ca..f39779d 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -340,6 +340,10 @@ ;; Install them all: ;; (mapc #'treesit-install-language-grammar (mapcar #'car treesit-language-source-alist)) +;; 2023-08-28 Maybe I like line numbers everywhere? Who can say? +(add-hook 'prog-mode-hook 'display-line-numbers-mode) + + ;; ================================================================= ;; Text mode configuration. ;; =================================================================