about summary refs log tree commit diff
path: root/modules/emacs/doom
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2025-02-17 02:21:56 +0300
committerazahi <azat@bahawi.net>2025-02-17 02:21:56 +0300
commit59180328cda59817d71cd58c8f48ead047375064 (patch)
tree2cdd7d1bfa309839ef624c19daf283f510aacf69 /modules/emacs/doom
parent2025-02-05 (diff)
2025-02-17
Diffstat (limited to '')
-rw-r--r--modules/emacs/doom/config.el274
-rw-r--r--modules/emacs/doom/init.el2
-rw-r--r--modules/emacs/doom/packages.el15
3 files changed, 175 insertions, 116 deletions
diff --git a/modules/emacs/doom/config.el b/modules/emacs/doom/config.el
index be481d4..d7ab80e 100644
--- a/modules/emacs/doom/config.el
+++ b/modules/emacs/doom/config.el
@@ -52,8 +52,21 @@
 ;;; LSP
 ;;
 
-(setq! lsp-enable-suggest-server-download nil
-       lsp-modeline-code-actions-enable nil)
+(after! lsp-mode
+  (setq! lsp-enable-server-download nil
+         lsp-enable-suggest-server-download nil
+         lsp-modeline-code-action-fallback-icon "~"))
+
+;;
+;;; Tree-Sitter
+;;
+
+(use-package! treesit-auto
+  :disabled
+  :custom (treesit-auto-install 'prompt)
+  :config
+  (treesit-auto-add-to-auto-mode-alist 'all)
+  (global-treesit-auto-mode))
 
 ;;
 ;;; Nix
@@ -81,52 +94,60 @@
 ;;; Org
 ;;
 
-(setq! org-directory "~/doc/org/")
+(setq! org-directory "~/doc/org/"
+       org-roam-directory "~/doc/roam/"
+       org-roam-db-location (concat org-roam-directory ".db"))
 
-;; For some reason only using `after!' work here. `setq-hook!' and etc doesn't
-;; produce expected results.
 (after! org
-  (setq! org-todo-keywords '((sequence
-                              "TODO(t)"
-                              "LOOP(r)"
-                              "STRT(s@)"
-                              "WAIT(w@/!)"
-                              "HOLD(h@/!)"
-                              "IDEA(i)"
-                              "PROJ(p)"
-                              "|"
-                              "DONE(d@/!)"
-                              "KILL(k@/!)"))
-         org-todo-keyword-faces '(("STRT" . +org-todo-active)
-                                  ("WAIT" . +org-todo-onhold)
-                                  ("HOLD" . +org-todo-onhold)
-                                  ("PROJ" . +org-todo-project)
-                                  ("KILL" . +org-todo-cancel))
-         org-capture-templates '(("t" "Todo" entry
-                                  (file+headline +org-capture-todo-file "Inbox")
-                                  "* TODO %?\n%i\n%a" :prepend t)
-                                 ("n" "Note" entry
-                                  (file+headline +org-capture-notes-file "Inbox")
-                                  "* %u %?\n%i\n%a" :prepend t)
-                                 ("j" "Journal" entry
-                                  (file+olp+datetree +org-capture-journal-file)
-                                  "* %U %?\n%i\n%a" :prepend t))))
+  (setq! org-todo-keywords
+         '((sequence
+            "TODO(t)"
+            "LOOP(r)"
+            "STRT(s@)"
+            "WAIT(w@/!)"
+            "HOLD(h@/!)"
+            "IDEA(i)"
+            "PROJ(p)"
+            "|"
+            "DONE(d@/!)"
+            "KILL(k@/!)"))
+         org-todo-keyword-faces
+         '(("STRT" . +org-todo-active)
+           ("WAIT" . +org-todo-onhold)
+           ("HOLD" . +org-todo-onhold)
+           ("PROJ" . +org-todo-project)
+           ("KILL" . +org-todo-cancel))
+         org-capture-templates
+         '(("t" "Todo" entry
+            (file+headline +org-capture-todo-file "Inbox")
+            "* TODO %?\n%i\n%a" :prepend t)
+           ("n" "Note" entry
+            (file+headline +org-capture-notes-file "Inbox")
+            "* %u %?\n%i\n%a" :prepend t)
+           ("j" "Journal" entry
+            (file+olp+datetree +org-capture-journal-file)
+            "* %U %?\n%i\n%a" :prepend t))))
 
 (add-hook! 'org-mode-hook 'auto-fill-mode)
 
 (setq-hook! 'org-mode-hook fill-column 80)
 
-(setq! org-roam-directory "~/doc/roam/"
-       org-roam-db-location (concat org-roam-directory ".db"))
-
 (use-package! org-roam-ui
   :requires websocket
   :after org-roam
   :config
-  (setq org-roam-ui-sync-theme t
-        org-roam-ui-follow t
-        org-roam-ui-update-on-save t
-        org-roam-ui-open-on-start t))
+  (setq! org-roam-ui-sync-theme t
+         org-roam-ui-follow t
+         org-roam-ui-update-on-save t
+         org-roam-ui-open-on-start t))
+
+(use-package! org-roam-timestamps
+  :after org-roam
+  :custom (org-roam-timestamps-parent-file t))
+
+(custom-set-faces! '(org-headline-done :strike-through t))
+
+(add-hook 'org-capture-mode-hook 'evil-insert-state)
 
 ;;
 ;;; LaTeX
@@ -136,6 +157,29 @@
       :i "TAB" #'cdlatex-tab)
 
 ;;
+;;; Typst
+;;
+
+(use-package! typst-ts-mode
+  :custom (typst-ts-watch-options "--open")
+  :config
+  (add-to-list 'lsp-language-id-configuration '(typst-ts-mode . "typst"))
+  (lsp-register-client (make-lsp-client
+                        :new-connection (lsp-stdio-connection "tinymist")
+                        :server-id 'tinymist
+                        :major-modes '(typst-ts-mode)))
+  (add-hook 'typst-ts-mode-hook 'lsp-deferred)
+
+  (when (boundp 'treesit-auto-recipe-list)
+    (add-to-list 'treesit-auto-recipe-list
+                 (make-treesit-auto-recipe
+                  :lang 'typst
+                  :ts-mode 'typst-ts-mode
+                  :url "https://github.com/uben0/tree-sitter-typst"
+                  :revision "master"
+                  :source-dir "src"))))
+
+;;
 ;;; PlantUML
 ;;
 
@@ -165,9 +209,8 @@
     (add-to-list 'lsp-language-id-configuration '(nickel-mode . "nickel"))
     (lsp-register-client (make-lsp-client
                           :new-connection (lsp-stdio-connection "nls")
-                          :activation-fn (lsp-activate-on "nickel")
                           :server-id 'nls
-                          :major-modes 'nickel-mode))
+                          :major-modes '(nickel-mode)))
     (add-hook 'nickel-mode-hook 'lsp-deferred)))
 
 ;;
@@ -205,7 +248,11 @@
          send-mail-function #'smtpmail-send-it
          message-sendmail-f-is-evil t
          message-sendmail-extra-arguments '("--read-envelope-from")
-         message-send-mail-function #'message-send-mail-with-sendmail))
+         message-send-mail-function #'message-send-mail-with-sendmail
+         shr-use-colors nil))
+
+(use-package! mu4e-patch
+  :hook (mu4e-view-mode . mu4e-patch-highlight))
 
 (setq-hook! 'mu4e-main-mode-hook mu4e-update-interval 30)
 
@@ -281,80 +328,91 @@
                                    mistral:7b-instruct-fp16))))
 
 (use-package! ellama
-  :init
-  (setq! ellama-naming-scheme 'ellama-generate-name-by-time)
+  :custom (ellama-naming-scheme 'ellama-generate-name-by-time)
   :config
   (require 'llm-ollama)
-  (setq! ellama-provider (make-llm-ollama
-                          :scheme "http"
-                          :host "eonwe.shire.net"
-                          :port 11434
-                          :chat-model "llama3.2:3b-instruct-fp16"
-                          :embedding-model "nomic-embed-text:latest")
-         ellama-providers '(("llama" . (make-llm-ollama
-                                        :scheme "http"
-                                        :host "eonwe.shire.net"
-                                        :port 11434
-                                        :chat-model "llama3.2:3b-instruct-fp16"
-                                        :embedding-model "nomic-embed-text:latest"))
-                            ("qwen" . (make-llm-ollama
-                                       :scheme "http"
-                                       :host "eonwe.shire.net"
-                                       :port 11434
-                                       :chat-model "qwen2:7b-instruct-fp16"
-                                       :embedding-model "nomic-embed-text:latest"))
-                            ("qwen-coder" . (make-llm-ollama
-                                             :scheme "http"
-                                             :host "eonwe.shire.net"
-                                             :port 11434
-                                             :chat-model "qwen2.5-coder:14b-instruct-q8_0"
-                                             :embedding-model "nomic-embed-text:latest"))
-                            ("gemma" . (make-llm-ollama
-                                        :scheme "http"
-                                        :host "eonwe.shire.net"
-                                        :port 11434
-                                        :chat-model "gemma:7b-instruct-q8_0"
-                                        :embedding-model "nomic-embed-text:latest"))
-                            ("mistral" . (make-llm-ollama
-                                          :scheme "http"
-                                          :host "eonwe.shire.net"
-                                          :port 11434
-                                          :chat-model "mistral:7b-instruct-fp16"
-                                          :embedding-model "nomic-embed-text:latest"))
-                            ("opencoder" . (make-llm-ollama
-                                            :scheme "http"
-                                            :host "eonwe.shire.net"
-                                            :port 11434
-                                            :chat-model "opencoder:8b-instruct-fp16"
-                                            :embedding-model "nomic-embed-text:latest"))
-                            ("granite" . (make-llm-ollama
-                                          :scheme "http"
-                                          :host "eonwe.shire.net"
-                                          :port 11434
-                                          :chat-model "granite3.1-moe:3b-instruct-fp16"
-                                          :embedding-model "granite-embedding:278m-fp16")))
-         ellama-translation-provider (make-llm-ollama
-                                      :scheme "http"
-                                      :host "eonwe.shire.net"
-                                      :port 11434
-                                      :chat-model "mistral:7b-instruct-fp16"
-                                      :embedding-model "nomic-embed-text:latest")
-         ellama-summarization-provider (make-llm-ollama
-                                        :scheme "http"
-                                        :host "eonwe.shire.net"
-                                        :port 11434
-                                        :chat-model "mistral:7b-instruct-fp16"
-                                        :embedding-model "nomic-embed-text:latest")))
+  (setq! ellama-providers
+         '(("llama" .
+            (make-llm-ollama
+             :scheme "http"
+             :host "eonwe.shire.net"
+             :port 11434
+             :chat-model "llama3.2:3b-instruct-fp16"
+             :embedding-model "nomic-embed-text:latest"))
+           ("qwen" .
+            (make-llm-ollama
+             :scheme "http"
+             :host "eonwe.shire.net"
+             :port 11434
+             :chat-model "qwen2:7b-instruct-fp16"
+             :embedding-model "nomic-embed-text:latest"))
+           ("qwen-coder" .
+            (make-llm-ollama
+             :scheme "http"
+             :host "eonwe.shire.net"
+             :port 11434
+             :chat-model "qwen2.5-coder:14b-instruct-q8_0"
+             :embedding-model "nomic-embed-text:latest"))
+           ("gemma" .
+            (make-llm-ollama
+             :scheme "http"
+             :host "eonwe.shire.net"
+             :port 11434
+             :chat-model "gemma:7b-instruct-q8_0"
+             :embedding-model "nomic-embed-text:latest"))
+           ("mistral" .
+            (make-llm-ollama
+             :scheme "http"
+             :host "eonwe.shire.net"
+             :port 11434
+             :chat-model "mistral:7b-instruct-fp16"
+             :embedding-model "nomic-embed-text:latest"))
+           ("opencoder" .
+            (make-llm-ollama
+             :scheme "http"
+             :host "eonwe.shire.net"
+             :port 11434
+             :chat-model "opencoder:8b-instruct-fp16"
+             :embedding-model "nomic-embed-text:latest"))
+           ("granite" .
+            (make-llm-ollama
+             :scheme "http"
+             :host "eonwe.shire.net"
+             :port 11434
+             :chat-model "granite3.1-moe:3b-instruct-fp16"
+             :embedding-model "granite-embedding:278m-fp16")))
+         ellama-provider
+         (make-llm-ollama
+          :scheme "http"
+          :host "eonwe.shire.net"
+          :port 11434
+          :chat-model "llama3.2:3b-instruct-fp16"
+          :embedding-model "nomic-embed-text:latest")
+         ellama-translation-provider
+         (make-llm-ollama
+          :scheme "http"
+          :host "eonwe.shire.net"
+          :port 11434
+          :chat-model "mistral:7b-instruct-fp16"
+          :embedding-model "nomic-embed-text:latest")
+         ellama-summarization-provider
+         (make-llm-ollama
+          :scheme "http"
+          :host "eonwe.shire.net"
+          :port 11434
+          :chat-model "mistral:7b-instruct-fp16"
+          :embedding-model "nomic-embed-text:latest")))
 
 (use-package! magit-gptcommit
   :after magit
   :config
   (require 'llm-ollama)
-  (setq! magit-gptcommit-llm-provider (make-llm-ollama
-                                       :scheme "http"
-                                       :host "eonwe.shire.net"
-                                       :port 11434
-                                       :chat-model "qwen2.5-coder:32b-instruct-q3_K_M"
-                                       :embedding-model "nomic-embed-text:latest"))
+  (setq! magit-gptcommit-llm-provider
+         (make-llm-ollama
+          :scheme "http"
+          :host "eonwe.shire.net"
+          :port 11434
+          :chat-model "qwen2.5-coder:32b-instruct-q3_K_M"
+          :embedding-model "nomic-embed-text:latest"))
 
   (magit-gptcommit-status-buffer-setup))
diff --git a/modules/emacs/doom/init.el b/modules/emacs/doom/init.el
index 51d4291..eddaf28 100644
--- a/modules/emacs/doom/init.el
+++ b/modules/emacs/doom/init.el
@@ -87,7 +87,7 @@
        (org +pandoc +roam2)
        plantuml
        graphviz
-       (python +poetry +pyright +lsp +tree-sitter)
+       (python +lsp +tree-sitter +pyright)
        ;; (racket +lsp +tree-sitter +xp +hash-lang)
        rest
        (rust +lsp +tree-sitter)
diff --git a/modules/emacs/doom/packages.el b/modules/emacs/doom/packages.el
index a7085da..f818377 100644
--- a/modules/emacs/doom/packages.el
+++ b/modules/emacs/doom/packages.el
@@ -4,16 +4,12 @@
 
 (unpin! evil-collection)
 
+(package! treesit-auto)
+
 (package! xclip)
 
 (package! org-roam-ui)
-
-;; https://github.com/doomemacs/doomemacs/issues/8166
-;; https://github.com/org-roam/org-roam/issues/2485
-(unpin! emacsql)
-(package! emacsql
-  :recipe (:host github :repo "magit/emacsql")
-  :pin "491105a01f58bf0b346cbc0254766c6800b229a2")
+(package! org-roam-timestamps)
 
 (package! nickel-mode)
 
@@ -26,6 +22,11 @@
 (package! ellama)
 (package! magit-gptcommit)
 
+(unpin! (:tools tree-sitter))
+
+(package! typst-ts-mode
+  :recipe (:host codeberg :repo "meow_king/typst-ts-mode"))
+
 ;; (package! tvl
 ;;   :recipe (:host nil
 ;;            :repo "https://code.tvl.fyi/depot.git:/tools/emacs-pkgs/tvl.git"

Consider giving Nix/NixOS a try! <3