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 (unless package-archive-contents
(package-refresh-contents)) (package-refresh-contents))
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(require 'use-package) (require 'use-package)
(setq use-package-always-ensure t) (setq use-package-always-ensure t)
#+end_src #+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 ** General config
*** no-littering *** 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). 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)))) (setq exec-path (split-string path-from-shell path-separator))))
(set-exec-path-from-shell-PATH) (set-exec-path-from-shell-PATH)
#+end_src #+end_src
*** Bell *** Bell
@ -120,63 +126,59 @@ I use doom-modeline as my modeline, as I find it really clean and minimal.
*** Completion *** Completion
I use vertico as my completion framework. It's minimal, fast and tells me all I need to know and even sorts by history. I use vertico as my completion framework. It's minimal, fast and tells me all I need to know and even sorts by history.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package vertico (use-package vertico
:init :init
(vertico-mode) (vertico-mode)
;; Different scroll margin ;; Different scroll margin
;; (setq vertico-scroll-margin 0) ;; (setq vertico-scroll-margin 0)
;; Show more candidates ;; Show more candidates
;; (setq vertico-count 20) ;; (setq vertico-count 20)
;; Grow and shrink the Vertico minibuffer ;; Grow and shrink the Vertico minibuffer
(setq vertico-resize t) (setq vertico-resize t)
;; Optionally enable cycling for `vertico-next' and `vertico-previous'. ;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
(setq vertico-cycle t)) (setq vertico-cycle t))
;; Persist history over Emacs restarts. Vertico sorts by history position. ;; Persist history over Emacs restarts. Vertico sorts by history position.
(use-package savehist (use-package savehist
:init :init
(savehist-mode)) (savehist-mode))
;; A few more useful configurations... ;; A few more useful configurations...
(use-package emacs (use-package emacs
:init :init
;; Add prompt indicator to `completing-read-multiple'. ;; Add prompt indicator to `completing-read-multiple'.
;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma. ;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma.
(defun crm-indicator (args) (defun crm-indicator (args)
(cons (format "[CRM%s] %s" (cons (format "[CRM%s] %s"
(replace-regexp-in-string (replace-regexp-in-string
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
crm-separator) crm-separator)
(car args)) (car args))
(cdr args))) (cdr args)))
(advice-add #'completing-read-multiple :filter-args #'crm-indicator) (advice-add #'completing-read-multiple :filter-args #'crm-indicator)
;; Do not allow the cursor in the minibuffer prompt ;; Do not allow the cursor in the minibuffer prompt
(setq minibuffer-prompt-properties (setq minibuffer-prompt-properties
'(read-only t cursor-intangible t face minibuffer-prompt)) '(read-only t cursor-intangible t face minibuffer-prompt))
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
;; Support opening new minibuffers from inside existing minibuffers. ;; Support opening new minibuffers from inside existing minibuffers.
(setq enable-recursive-minibuffers t) (setq enable-recursive-minibuffers t)
;; Emacs 28 and newer: Hide commands in M-x which do not work in the current ;; Emacs 28 and newer: Hide commands in M-x which do not work in the current
;; mode. Vertico commands are hidden in normal buffers. This setting is ;; mode. Vertico commands are hidden in normal buffers. This setting is
;; useful beyond Vertico. ;; useful beyond Vertico.
(setq read-extended-command-predicate #'command-completion-default-include-p)) (setq read-extended-command-predicate #'command-completion-default-include-p))
;; Optionally use the `orderless' completion style.
(use-package orderless (use-package orderless
:init :ensure t
;; Configure a custom style dispatcher (see the Consult wiki) :custom
;; (setq orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch) (completion-styles '(orderless basic))
;; orderless-component-separator #'orderless-escapable-split-on-space) (completion-category-overrides '((file (styles basic partial-completion)))))
(setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion)))))
#+end_src #+end_src
*** which-key *** which-key
@ -187,25 +189,6 @@ which-key is a nice little package that allows to have a minibuffer showing whic
(which-key-mode)) (which-key-mode))
#+end_src #+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 *** Reload org config config on save
This allows to tangle automatically when saving the config. This is mostly for convenience. This allows to tangle automatically when saving the config. This is mostly for convenience.
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -234,24 +217,24 @@ I use org-superstar-mode, as it makes headlines and bullets look really nice.
#+end_src #+end_src
** Programming ** Programming
*** LSP *** Eglot
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun my-lsp-mode-setup () (use-package eglot
"Enable lsp-mode except in org-mode and emacs-lisp-mode." :bind (:map eglot-mode-map
(unless (or (derived-mode-p 'org-mode) ("C-c C-d" . eldoc)
(derived-mode-p 'emacs-lisp-mode)) ("C-c C-e" . eglot-rename)
(lsp))) ("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 ;; makes eglot faster using a rust wrapper, needs to be in PATH
:hook (prog-mode . my-lsp-mode-setup) (use-package eglot-booster
(lsp-mode . lsp-enable-which-key-integration) :vc (:fetcher github :repo jdtsmith/eglot-booster)
:init :after eglot
(setq lsp-keymap-prefix "C-c l") :config
(setq read-process-output-max (* 1024 1024)) (eglot-booster-mode))
(setq gc-cons-threshold 100000000))
(use-package lsp-ui)
#+end_src #+end_src
*** Projectile *** Projectile
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package projectile (use-package projectile
@ -264,9 +247,13 @@ I use org-superstar-mode, as it makes headlines and bullets look really nice.
*** Autocompletion *** Autocompletion
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package company (use-package corfu
:config :custom
(setq company-idle-delay 0)) (corfu-auto t)
:init
(global-corfu-mode)
(setq corfu-popupinfo-delay 0.2)
(corfu-popupinfo-mode))
#+end_src #+end_src
*** Snippets *** Snippets
@ -311,7 +298,7 @@ Magit is a git client in Emacs.
(tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src") (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src") (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
(yaml "https://github.com/ikatyang/tree-sitter-yaml"))) (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 '("\\.ts\\'" . tsx-ts-mode))
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode)) (add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode))
#+end_src #+end_src
@ -338,3 +325,16 @@ Magit is a git client in Emacs.
(use-package expand-region (use-package expand-region
:bind ("C-=" . er/expand-region)) :bind ("C-=" . er/expand-region))
#+end_src #+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. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(package-selected-packages '(package-selected-packages '(eglot-booster))
'(rust-mode which-key org-superstar org-superstar-mode vertico doom-modeline catppuccin-theme))) '(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
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.