         ;; Immediately activate completion.
         company-idle-delay 0.5))
 
-(add-hook 'prog-mode-hook 'company-mode)
-
-(use-package prescient :straight t :defer t
-  :config (prescient-persist-mode +1))
-
-;; (ivy-prescient-mode +1)
-
-;; (straight-use-package 'company-prescient)
-(use-package company-prescient :straight t
-  :after company-mode
-  :defer t
-  :config (company-prescient-mode +1))
-
-(use-package protobuf-mode
-  :init
-  (add-to-list 'auto-mode-alist '("\\.proto$" . protobuf-mode)))
-
-;; (add-to-list 'auto-mode-alist '("\\.org$" . (polymode-minor-mode  org-mode)))
-
-;; (use-package selectrum-prescient)
-
-(use-package counsel :straight t :demand t
-  :bind (("M-x" . counsel-M-x)))
-
-;; (use-package systemd-mode :straight t)
-
-(use-package systemd :straight t)
-
-(use-package ivy :straight t :demand t :diminish ivy-mode
-  :init
-  (setq ivy-use-virtual-buffers t
-        ivy-initial-inputs-alist nil
-        ivy-re-builders-alist '((t . ivy--regex-fuzzy))
-        ivy-extra-directories nil)
-  :config
-  (define-key ivy-minibuffer-map (kbd "C-l") (kbd "DEL"))
-  (use-package flx :straight t :defer t)
-  (use-package ivy-prescient :straight t :defer t)
-  (ivy-mode)
-  (ivy-prescient-mode)
-  :bind (("C-c C-r" . ivy-resume)
-         ("<f6>"    . ivy-resume)
-         ("s-b"     . ivy-switch-buffer)
-         :map ivy-minibuffer-map
-         ("TAB"     . ivy-alt-done)
-         ("<escape>" . minibuffer-keyboard-quit)
-         ("C-j"      . ivy-next-line)
-         ("C-k"      . ivy-previous-line)))
-
-(use-package swiper :straight t)
-(global-set-key "\C-s" 'swiper)
-
-;; (straight-use-package 'magit)
 (use-package magit
   :straight t
-  :defer t
   :commands magit-status
   :hook ((magit-popup-mode-hook . no-trailing-whitespace)
 	 (git-commit-mode . goto-address-mode)))
-
-(use-package exec-path-from-shell :straight t :defer t)
-
-(when (daemonp)
-  (exec-path-from-shell-initialize))
-
-;; (straight-use-package 'magit-todos)
-(use-package magit-todos :straight t :defer t)
-
-(use-package magit-delta :straight t :defer t)
-
-(use-package elm-mode :straight t :defer t)
-
-(require 'subr-x)
-(use-package git :straight t)
-
-;; (straight-use-package '(org-plus-contrib :includes (org)))
-
-;; (use-package dhall-mode :straight t
-;;   :init (dhall-format-on-save-mode)
-;;   :commands (dhall-mode dhall-format))
-
-(use-package plantuml-mode :straight t
-  :config
-  (setq plantuml-jar-path "/usr/share/java/plantuml/plantuml.jar"
-        plantuml-default-exec-mode 'jar))
-
-(use-package flycheck-plantuml :straight t
-  :hook (plantuml . flycheck))
-
-(use-package rvm :straight t
-  :init
-  (rvm-use-default))
-
-(use-package org-marginalia
-  :hook (text . org-marginalia)
-  :straight (org-marginalia
-             :type git
-             :host github
-             :branch "main"
-             :repo "nobiot/org-marginalia"))
-
-;; (use-package org-plus-contrib :straight t
-;;   :mode (("\\.org$" . org-mode))
-;;   :init
-;;   (require 'ob-dot)
-;;   (require 'ob-plantuml)
-;;   (setq org-plantuml-jar-path "/usr/share/java/plantuml/plantuml.jar")
-;;   :config
-;;   (add-to-list 'org-src-lang-modes '("dot" . graphviz-dot))
-;;   (add-to-list 'org-src-lang-modes '("plantuml" . plantuml))
-;;   (org-babel-do-load-languages
-;;    'org-babel-load-languages
-;;    '((clojure . t)
-;;      (emacs-lisp . t)
-;;      (gnuplot . t)
-;;      (java . t)
-;;      (clojure . t)
-;;      (dot . t)
-;;      (C . t)
-;;      (lilypond . t)
-;;      (ruby . t)
-;;      ;; (rust . t)
-;;      ;; (rustic . t)
-;;      (python . t)
-;;      (dot . t)
-;;      (screen . t)
-;;      (fortran . t)
-;;      ;; (prolog . t)
-;;      ;; (kotlin . t)
-;;      ;; (http . t)
-;;      ;; (R . t)
-;;      (ditaa . t)
-;;      (js . t)
-;;      (ammonite . t)
-;;      (shell . t)
-;;      (sql . t)
-;;      (plantuml . t)
-;;      (ocaml . t)))
-;;   :bind (("C-c l" . org-store-link)
-;;          ("C-c a" . org-agenda)))
-
-(use-package php-mode :straight t)
-
-;; (setq org-file-apps-gnu
-;;       (append '((t . "setsid -w xdg-open %s")) org-file-apps-gnu))
-
-(use-package org-projectile
-  :straight t
-  :bind (("C-c n p" . org-projectile-project-todo-completing-read)
-         ("C-c c" . org-capture))
-  :config
-  (progn
-    (setq org-projectile-per-project-filepath ".notes/notes.org"
-          org-agenda-files (append agenda-files (org-projectile-todo-files)))
-    (push (org-projectile-project-todo-entry) org-capture-templates)))
-
-(use-package org-recoll
-  :straight (org-recoll
-             :type git
-             :host github
-             :branch "main"
-             :repo "alraban/org-recoll"))
-
-;; (use-package ob-ammonite :straight t)
-;; ;; (use-package org
-;; ;;   :straight org-plus-contrib
-;; ;;   :mode (("\\.org$" . org-mode))
-;; ;;   ("C-c l" . org-store-link)
-;; ;;   ("C-c a" . org-agenda))
-
-(use-package lsp-metals :straight t)
-(use-package lsp-java :straight t)
-
-(use-package nvm :straight t)
-(use-package lsp-ivy :straight t :commands lsp-ivy-workspace-symbol)
-(use-package dap-mode :straight t
-  :config
-  (setq dap-auto-configure-features '(sessions locals controls tooltip)))
-
-;; (use-package rustic :straight t
-;;   :config
-;;   (setq lsp-eldoc-hook nil
-;;        lsp-enable-symbol-highlighting nil
-;;        lsp-signature-auto-activate nil
-;;        rustic-format-on-save t))
-
-(use-package lsp-mode
-  :straight t
-  :custom
-  (lsp-rust-server 'rust-analyzer)
-  :config
-  (lsp-register-custom-settings
-   '(("rust-analyzer.procMacro.enable" t t)
-     ("rust-analyzer.cargo.loadOutDirsFromCheck" t t)
-     ("gopls.completeUnimported" t t)
-     ("gopls.staticcheck" t t)
-     ("gopls.experimentalDiagnosticsDelay" "250ms" t)
-     ("gopls.experimentalPackageCacheKey" t t)
-     ("gopls.experimentalWorkspaceModule" t t)))
-  :init
-  (setq lsp-rust-server 'rust-analyzer
-        read-process-output-max (* 4096 1024)
-        lsp-idle-delay 0.500
-        lsp-completion-provider :capf
-        lsp-lens-enable nil
-        lsp-ui-sideline-enable nil
-        lsp-ui-sideline-show-hover nil
-        lsp-enable-file-watchers nil
-        lsp-log-io nil
-        gc-cons-threshold 400000000)
-  :hook ((crystal-mode . lsp)
-         (tuareg-mode . lsp)
-         (kotlin-mode . lsp)
-         (prolog-mode . lsp)
-         (typescript-mode . lsp)
-         (js-mode . lsp)
-         (rust-mode . lsp)
-         (haskell-mode . lsp)
-         (go-mode . lsp)
-         (scala-mode . lsp)
-         (lsp-mode . lsp-enable-which-key-integration))
-  :commands lsp)
-
-(use-package lsp-treemacs :straight t :commands lsp-treemacs-errors-list)
-
-(use-package markdown-preview-mode :straight t
-  :init
-  (add-to-list 'markdown-preview-javascript '("http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" . async))
-  (setq markdown-preview-stylesheets (list "https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/4.0.0/github-markdown.min.css")))
-
-(use-package polymode
-  :hook
-  (org-mode . polymode-minor-mode)
-  (markdown-mode . polymode-minor-mode)
-  (rst-mode . polymode-minor-mode)
-  :straight (polymode
-	          :type git :host github
-             :branch "master"
-	          :repo "polymode/polymode"))
-
-;; (use-package poly-noweb
-;;   :straight (poly-noweb
-;; 	          :type git :host github
-;; 	          :repo "polymode/poly-noweb"))
-
-(use-package poly-rst
-  :hook (rst-mode . poly-rst)
-  :straight (poly-rst
-	          :type git :host github
-	          :repo "polymode/poly-rst"))
-
-
-(use-package poly-markdown
-  :hook (markdown-mode . poly-markdown-mode)
-  :straight (poly-markdown
-	          :type git :host github
-	          :repo "polymode/poly-markdown"))
-
-;; (use-package poly-org
-;;   :hook (org-mode . poly-org-mode)
-;;   :straight (poly-org
-;; 	          :type git :host github
-;; 	          :repo "polymode/poly-org"))
-
-(use-package org-ql :straight t :defer t)
-(use-package magit-org-todos :straight t :defer t :config (magit-org-todos-autoinsert))
-
-(add-hook 'org-shiftup-final-hook 'windmove-up)
-(add-hook 'org-shiftleft-final-hook 'windmove-left)
-(add-hook 'org-shiftdown-final-hook 'windmove-down)
-(add-hook 'org-shiftright-final-hook 'windmove-right)
-
-(use-package forge :straight t)
 
 (use-package projectile :straight t :diminish projectile-mode
   :init
   (setq projectile-enable-caching t
         projectile-require-project-root t
-	     projectile-cache-file (expand-file-name "projectile.cache" default-snapshot-dir)
-	     projectile-known-projects-file (expand-file-name "projectile-bookmarks.eld" default-snapshot-dir)
-	     projectile-completion-system 'ivy
+	projectile-cache-file (expand-file-name "projectile.cache" default-snapshot-dir)
+	projectile-known-projects-file (expand-file-name "projectile-bookmarks.eld" default-snapshot-dir)
+	projectile-completion-system 'ivy
         projectile-indexing-method 'alien
         projectile-project-root-files-functions '(projectile-root-local
                                                   projectile-root-top-down
                                                   projectile-root-top-down-recurring
                                                   projectile-root-bottom-up)
-	     projectile-switch-project-action #'projectile-find-dir)
+	projectile-switch-project-action #'projectile-find-dir)
   :config
   (projectile-mode)
-  (setq projectile-mode-line
-        '(:eval (format " Projectile[%s(%s)]" (projectile-project-name))))
   :bind (("C-c f" . projectile-find-file)
-	      ("C-c p" . projectile-switch-project)))
-
-(straight-register-package
- '(tsc :host github
-       :repo "ubolonton/emacs-tree-sitter"
-       :files ("core/*.el")))
-
-(use-package idris2-mode
-  :straight (idris2-mode :host github
-                         :repo "redfish64/idris2-mode"))
-
-(use-package agda2-mode
-  :straight (agda2-mode :host github
-                        :repo "agda/agda"
-                        :files ("src/data/emacs-mode/*.el"))
-  :init
-  (shell-command-to-string "agda-mode locate"))
-
-(use-package tree-sitter
-  :straight (tree-sitter :host github
-                         :repo "ubolonton/emacs-tree-sitter"
-                         :files ("lisp/*.el")))
-
-(use-package tree-sitter-langs
-  :straight (tree-sitter-langs :host github
-                               :repo "ubolonton/tree-sitter-langs"))
-
-(require 'tree-sitter)
-(require 'tree-sitter-hl)
-(require 'tree-sitter-langs)
-(add-to-list 'tree-sitter-major-mode-language-alist '(tuareg-mode . ocaml))
-
-(require 'tree-sitter-debug)
-(require 'tree-sitter-query)
-
-(add-hook 'tree-sitter-mode-hook #'tree-sitter-hl-mode)
-
-(global-tree-sitter-mode)
-
-(defun lsp-go-install-save-hooks ()
-  (add-hook 'before-save-hook #'lsp-format-buffer t t)
-  (add-hook 'before-save-hook #'lsp-organize-imports t t))
-
-(use-package go-mode :straight t
-  :config
-  (require 'dap-go)
-  (dap-go-setup))
-
-(add-hook 'go-mode-hook #'lsp-go-install-save-hooks)
-
-(use-package rust-mode :straight t
-  :config
-  (setq lsp-rust-server 'rust-analyzer))
-
-(use-package futhark-mode :straight t)
-
-(use-package haskell-mode :straight t)
-
-(use-package lsp-haskell :straight t)
-
-(use-package scala-mode :straight t)
-
-(use-package ammonite-term-repl :straight t
-  :hook (scala-mode . ammonite-term-repl-minor))
-
-(use-package tuareg :straight t)
-
-(use-package go-playground :straight t)
-
-(use-package flycheck-golangci-lint :straight t)
-
-(use-package terraform-mode :straight t)
-
-(use-package flycheck-mercury :straight t)
-
-;; (use-package verb :straight t
-;;   :mode "\\.verb\\'"
-;;   :hook (verb . org))
-
-(use-package restclient :straight t)
-;; (use-package restclient-jq :straight t)
-
-(use-package walkman :straight t)
-
-(use-package racket-mode :straight t
-  :config
-  (setq racket-user-command-line-arguments '("-I" "typed/racket")))
-
-;; (use-package ob-racket :straight t
-;;   :after org
-;;   :config
-;;   (append '((racket . t) (scribble . t)) org-babel-load-languages))
-
-(use-package crystal-mode :straight t)
-
-(use-package rmsbolt :straight t)
+	 ("C-c p" . projectile-switch-project)))
 
 (use-package treemacs :straight t
   :config

      kept-old-versions 2
      version-control t)

(setenv "LANG"   "en_US.UTF-8")
(setenv "LC_ALL" "en_US.UTF-8")
(prefer-coding-system 'utf-8)
(set-language-environment "UTF-8")
(setenv "GO111MODULE" "on")

(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'use-package)

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))

(when (memq window-system '(mac ns x))
  (exec-path-from-shell-initialize))

;; (add-to-list 'load-path (expand-file-name "scripts" "~/.emacs.d"))
;; (require 'resize-frame)

;; Automatically :ensure each use-package.
;; (setq use-package-always-pin "melpa")
(use-package poet-theme :straight t)
(use-package ayu-theme :straight t)
(use-package mood-one-theme :straight t)
(use-package github-theme :straight t)
(use-package melancholy-theme :straight t)
(use-package avk-emacs-themes :straight t)
(use-package color-theme-modern :straight t)

;; (load-theme 'github t)
;; (load-theme 'poet-dark-monochrome t)
;; (load-theme 'poet-dark t)
;; (load-theme 'poet t)
;; (load-theme 'ayu-light t)
;; (load-theme 'wombat t)
;; (load-theme 'leuven t)
;; (load-theme 'mood-one t)
;; (load-theme 'modus-vivendi t)
;; (load-theme 'adwaita t)
;; (load-theme 'leuven t)
;; (load-theme 'whateveryouwant t)
(load-theme 'avk-daylight t)

;; (straight-use-package 'deadgrep)
(use-package deadgrep :straight t :bind (("C-c C-s"  . deadgrep)))

(use-package annotate :straight t)

(use-package projectile-ripgrep :straight t)

(use-package consult :straight t)

(use-package consult-recoll
  :straight (consult-recoll
             :type git
             :branch "main"
             :repo "https://codeberg.org/jao/consult-recoll"))

;; (use-package package-utils-upgrade-all-and-recompile
;;  :commands (package-utils-upgrade-all-and-recompile)

;;  :straight
;;  (package-utils-upgrade-all-and-recompile
;;    :type git
;;    :host gitlab
;;    :repo "ideasman42/emacs-package-utils-upgrade-all-and-recompile"))

;; (straight-use-package 'company)
(use-package company
  :straight t
  :diminish
  :config
  (global-company-mode t)
  (setq ;; Only 2 letters required for completion to activate.
        company-minimum-prefix-length 2
        ;; Search other buffers for completion candidates
        company-dabbrev-other-buffers t
        company-dabbrev-code-other-buffers t

(setq package-enable-at-startup nil)

(defconst default-snapshot-dir (expand-file-name "snapshots" user-emacs-directory))

(progn
  (setenv "LANG"   "en_US.UTF-8")
  (setenv "LC_ALL" "en_US.UTF-8")
  (prefer-coding-system 'utf-8)
  (set-language-environment "UTF-8")
  (setenv "GO111MODULE" "on")
  (global-auto-revert-mode t)
  (menu-bar-mode -1)
  (tooltip-mode -1)
  (global-linum-mode t)
  (tool-bar-mode -1)
  (add-hook 'before-save-hook 'delete-trailing-whitespace)
  (set-face-attribute 'default nil :font "Source Code Pro" :height 120))

(setq auto-window-vscroll nil
      custom-file (expand-file-name "custom.el" user-emacs-directory)
      inhibit-startup-screen t
      initial-scratch-message nil
      initial-major-mode 'text-mode
      make-backup-files nil
