From 5ca8f68521d1f7671533729e7d496598490be937 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 17 Sep 2022 13:48:44 -0700 Subject: feat(packages): install all required packages via straight Remove all the code related to installing packages, and created a new module that lists all the packages I need to install. This does not seem to be breaking anything so far ... Change-Id: I02f07c6a95bfde55d0897d804ea4d32097a79842 --- emacs/custom/my-packages.el | 76 +++++++++++++++++++++++++++++++++++++++++++++ emacs/init.el | 75 ++------------------------------------------ 2 files changed, 78 insertions(+), 73 deletions(-) create mode 100644 emacs/custom/my-packages.el (limited to 'emacs') diff --git a/emacs/custom/my-packages.el b/emacs/custom/my-packages.el new file mode 100644 index 0000000..67bb510 --- /dev/null +++ b/emacs/custom/my-packages.el @@ -0,0 +1,76 @@ +;;; my-packages.el --- List of packages to install -*- lexical-binding: t -*- +;; Author: Franck Cuny + +;;; Commentary: + +;;; Code: + +(require 'straight) + +;; packages needed for LSP +(straight-use-package 'lsp-mode) +(straight-use-package 'lsp-ui) + +;; packages needed for python +(straight-use-package 'blacken) +(straight-use-package 'python-docstring) +(straight-use-package 'python-mode) + +;; packages needed for go +(straight-use-package 'go-mode) +(straight-use-package 'gotest) + +;; packages needed for nix +(straight-use-package 'nix-mode) + +;; packages needed for rust +(straight-use-package 'rustic) + +;; packages needed to work with various configuration files +(straight-use-package 'chef-mode) +(straight-use-package 'terraform-doc) +(straight-use-package 'terraform-mode) +(straight-use-package 'toml-mode) +(straight-use-package 'systemd) +(straight-use-package 'dockerfile-mode) +(straight-use-package 'hcl-mode) +(straight-use-package 'jq-format) +(straight-use-package 'yaml-mode) +(straight-use-package 'protobuf-mode) + +;; packages needed for git +(straight-use-package 'git-commit) +(straight-use-package 'git-link) +(straight-use-package 'git-modes) +(straight-use-package 'magit) + +;; packages related to elfeed +(straight-use-package 'elfeed) +(straight-use-package 'elfeed-org) + +;; packages for eshell +(straight-use-package 'eshell-bookmark) + +;; packages for various text modes +(straight-use-package 'markdown-mode) +(straight-use-package 'yasnippet) + +;; packages for tree-sitter +(straight-use-package 'tree-sitter) +(straight-use-package 'tree-sitter-langs) + +;; packages for navigation +(straight-use-package 'consult) +(straight-use-package 'corfu) +(straight-use-package 'marginalia) +(straight-use-package 'orderless) +(straight-use-package 'vertico) +(straight-use-package 'which-key) + +;; packages for interacting with tools +(straight-use-package 'rg) +(straight-use-package 'exec-path-from-shell) + +(provide 'my-packages) + +;;; my-packages.el ends here diff --git a/emacs/init.el b/emacs/init.el index 22ffb24..174f5e8 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -15,79 +15,6 @@ ;; restore after startup (setq gc-cons-threshold 800000))) -(require 'package) - -(add-to-list 'package-archives - '("melpa" . - "https://melpa.org/packages/")) - -(defvar my/package-list '(chef-mode - consult - corfu - dockerfile-mode - eglot - elfeed - elfeed-org - eshell-bookmark - exec-path-from-shell - git-commit - git-link - git-modes - go-mode - gotest - hcl-mode - jq-format - magit - marginalia - markdown-mode - nix-mode - notmuch - ol-notmuch - orderless - protobuf-mode - rg - rustic - systemd - terraform-doc - terraform-mode - toml-mode - tree-sitter - tree-sitter-langs - vertico - which-key - yaml-mode - yasnippet) - "List of packages to be installed.") - -(defun my/packages-installed-p () - "Check if all packages in `my/package-list' are installed." - (cl-every #'package-installed-p my/package-list)) - -(defun my/require-package (package) - "Install PACKAGE unless already installed." - (unless (memq package my/package-list) - (add-to-list 'my/package-list package)) - (unless (package-installed-p package) - (package-install package))) - -(defun my/require-packages (packages) - "Ensure PACKAGES are installed. -Missing packages are installed automatically." - (mapc #'my/require-package packages)) - -(defun my/install-packages () - "Install all packages listed in `my/package-list'." - (unless (my/packages-installed-p) - ;; check for new packages (package versions) - (message "%s" "Reloading packages DB...") - (package-refresh-contents) - (message "%s" " done.") - ;; install the missing packages - (my/require-packages my/package-list))) - -;; run package installation -(my/install-packages) - ;; configure straight to manage packages (defvar bootstrap-version) (let ((bootstrap-file @@ -105,6 +32,8 @@ Missing packages are installed automatically." (add-to-list 'load-path (expand-file-name "custom/" user-emacs-directory)) (add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) +(require 'my-packages) + (require 'my-settings) (require 'my-ui) (require 'my-dired) -- cgit 1.4.1