Update .emacs.d/config.org

Update .emacs.d/init.el
This commit is contained in:
Anthony Rodriguez 2024-07-03 16:01:51 +02:00
parent 8aa2354663
commit 9e701b8025
2 changed files with 93 additions and 91 deletions

View file

@ -12,13 +12,20 @@ Here, we're initializing MELPA, as well as package.el and use-package.
(unless package-archive-contents
(package-refresh-contents))
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(require 'use-package)
(setq use-package-always-ensure t)
#+end_src
*** vc-use-package
vc-use-package integrated package-vc-install, which allows installing packages from git repositories, into use-package. It won't be needed from Emacs 30, as it integrates natively (hence the condition).
#+begin_src emacs-lisp
(if (< emacs-major-version 30)
(unless (package-installed-p 'vc-use-package)
(package-vc-install "https://github.com/slotThe/vc-use-package"))
(require 'vc-use-package))
#+end_src
** General config
*** no-littering
no-littering is a useful package that allows to put all of the autosave files and temporary files in one directory (the files ending with ~ for instance).
@ -54,7 +61,6 @@ We disable a lot of interface elements, to make the editor more minimal looking.
(setq exec-path (split-string path-from-shell path-separator))))
(set-exec-path-from-shell-PATH)
#+end_src
*** Bell
@ -168,15 +174,11 @@ I use vertico as my completion framework. It's minimal, fast and tells me all I
;; useful beyond Vertico.
(setq read-extended-command-predicate #'command-completion-default-include-p))
;; Optionally use the `orderless' completion style.
(use-package orderless
:init
;; Configure a custom style dispatcher (see the Consult wiki)
;; (setq orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch)
;; orderless-component-separator #'orderless-escapable-split-on-space)
(setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion)))))
:ensure t
:custom
(completion-styles '(orderless basic))
(completion-category-overrides '((file (styles basic partial-completion)))))
#+end_src
*** which-key
@ -187,25 +189,6 @@ which-key is a nice little package that allows to have a minibuffer showing whic
(which-key-mode))
#+end_src
*** quelpa
quelpa is a package that allows to build packages from source.
#+begin_src emacs-lisp
(unless (package-installed-p 'quelpa)
(with-temp-buffer
(url-insert-file-contents "https://raw.githubusercontent.com/quelpa/quelpa/master/quelpa.el")
(eval-buffer)
(quelpa-self-upgrade)))
#+end_src
use-package integration with quelpa.
#+begin_src emacs-lisp
(quelpa
'(quelpa-use-package
:fetcher git
:url "https://github.com/quelpa/quelpa-use-package.git"))
(require 'quelpa-use-package)
#+end_src
*** Reload org config config on save
This allows to tangle automatically when saving the config. This is mostly for convenience.
#+begin_src emacs-lisp
@ -234,24 +217,24 @@ I use org-superstar-mode, as it makes headlines and bullets look really nice.
#+end_src
** Programming
*** LSP
*** Eglot
#+begin_src emacs-lisp
(defun my-lsp-mode-setup ()
"Enable lsp-mode except in org-mode and emacs-lisp-mode."
(unless (or (derived-mode-p 'org-mode)
(derived-mode-p 'emacs-lisp-mode))
(lsp)))
(use-package eglot
:bind (:map eglot-mode-map
("C-c C-d" . eldoc)
("C-c C-e" . eglot-rename)
("C-c C-o" . python-sort-imports)
("C-c C-f" . eglot-format-buffer))
:hook ((tsx-ts-mode . eglot-ensure)
(typescript-ts-mode . eglot-ensure)))
(use-package lsp-mode
:hook (prog-mode . my-lsp-mode-setup)
(lsp-mode . lsp-enable-which-key-integration)
:init
(setq lsp-keymap-prefix "C-c l")
(setq read-process-output-max (* 1024 1024))
(setq gc-cons-threshold 100000000))
(use-package lsp-ui)
;; makes eglot faster using a rust wrapper, needs to be in PATH
(use-package eglot-booster
:vc (:fetcher github :repo jdtsmith/eglot-booster)
:after eglot
:config
(eglot-booster-mode))
#+end_src
*** Projectile
#+begin_src emacs-lisp
(use-package projectile
@ -264,9 +247,13 @@ I use org-superstar-mode, as it makes headlines and bullets look really nice.
*** Autocompletion
#+begin_src emacs-lisp
(use-package company
:config
(setq company-idle-delay 0))
(use-package corfu
:custom
(corfu-auto t)
:init
(global-corfu-mode)
(setq corfu-popupinfo-delay 0.2)
(corfu-popupinfo-mode))
#+end_src
*** Snippets
@ -311,7 +298,7 @@ Magit is a git client in Emacs.
(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")))
(setq treesit-font-lock-level 4)
(add-to-list 'auto-mode-alist '("\\.ts\\'" . tsx-ts-mode))
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode))
#+end_src
@ -338,3 +325,16 @@ Magit is a git client in Emacs.
(use-package expand-region
:bind ("C-=" . er/expand-region))
#+end_src
** Mail
#+begin_src emacs-lisp
(autoload 'notmuch "notmuch" "notmuch mail" t)
(use-package notmuch)
#+end_src
*** SMTP
#+begin_src emacs-lisp
(setq send-mail-function 'sendmail-query-once)
#+end_src

View file

@ -8,8 +8,10 @@
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
'(rust-mode which-key org-superstar org-superstar-mode vertico doom-modeline catppuccin-theme)))
'(package-selected-packages '(eglot-booster))
'(package-vc-selected-packages
'((eglot-booster :vc-backend Git :url "https://github.com/jdtsmith/eglot-booster")
(vc-use-package :vc-backend Git :url "https://github.com/slotThe/vc-use-package"))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.