use straight.el for package management

This commit is contained in:
Grigory Shipunov 2023-05-04 15:31:50 +02:00
parent 220f79481a
commit 0336e986eb
Signed by: 0xa
GPG key ID: 91FA5E5BF9AA901C
5 changed files with 34 additions and 35 deletions

34
init.el
View file

@ -1,12 +1,10 @@
(add-to-list 'load-path "~/.emacs.d/lisp/") (add-to-list 'load-path "~/.emacs.d/lisp/")
;;; package management ;; supress nativecomp warnings
(require 'package) (setq native-comp-async-report-warnings-errors 'quiet)
(package-initialize)
(setq package-native-compile t ;;; straight for package management
native-comp-async-report-warnings-errors nil) (require 'oxa/package-mgmt)
;;; soruces
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;;; basic bits ;;; basic bits
(require 'oxa/sane-defaults) (require 'oxa/sane-defaults)
@ -17,7 +15,7 @@
(require 'oxa/latex) (require 'oxa/latex)
;;; theme ;;; theme
(oxa/insure 'gruber-darker-theme) (straight-use-package 'gruber-darker-theme)
(load-theme 'gruber-darker t) (load-theme 'gruber-darker t)
(set-face-italic 'font-lock-comment-face t) (set-face-italic 'font-lock-comment-face t)
(set-face-italic 'font-lock-comment-delimiter-face nil) (set-face-italic 'font-lock-comment-delimiter-face nil)
@ -41,12 +39,12 @@
(add-hook 'c-mode-hook 'tabs-yay) (add-hook 'c-mode-hook 'tabs-yay)
;;; expand region ;;; expand region
(oxa/insure 'expand-region) (straight-use-package 'expand-region)
(require 'expand-region) (require 'expand-region)
(global-set-key (kbd "C-=") 'er/expand-region) (global-set-key (kbd "C-=") 'er/expand-region)
;;; move text ;;; move text
(oxa/insure 'move-text) (straight-use-package 'move-text)
(global-set-key (kbd "M-n") 'move-text-down) (global-set-key (kbd "M-n") 'move-text-down)
(global-set-key (kbd "M-p") 'move-text-up) (global-set-key (kbd "M-p") 'move-text-up)
@ -61,23 +59,23 @@
(ido-ubiquitous-mode 1) (ido-ubiquitous-mode 1)
;; direnv ;; direnv
(oxa/insure 'direnv) (straight-use-package 'direnv)
(direnv-mode 1) (direnv-mode 1)
;; magit ;; magit
(oxa/insure 'magit) (straight-use-package 'magit)
(require 'magit) (require 'magit)
(global-set-key (kbd "C-x g") 'magit-status) (global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-x M-g") 'magit-dispatch) (global-set-key (kbd "C-x M-g") 'magit-dispatch)
(global-set-key (kbd "C-c M-g") 'magit-file-dispatch) (global-set-key (kbd "C-c M-g") 'magit-file-dispatch)
;;; Language support ;;; Language support
(oxa/insure 'nix-mode) (straight-use-package 'nix-mode)
(setq nix-nixfmt-bin "nixpkgs-fmt") (setq nix-nixfmt-bin "nixpkgs-fmt")
(oxa/insure 'markdown-mode) (straight-use-package 'markdown-mode)
(oxa/insure 'yaml-mode) (straight-use-package 'yaml-mode)
(oxa/insure 'rust-mode) (straight-use-package 'rust-mode)
(require 'rust-mode) (require 'rust-mode)
(oxa/hook rust-mode-hook (oxa/hook rust-mode-hook
(setq-local fill-column 100)) (setq-local fill-column 100))
@ -90,7 +88,7 @@
(other . "stroustrup"))) (other . "stroustrup")))
;; completion ;; completion
(oxa/insure 'company) (straight-use-package 'company)
(global-company-mode) (global-company-mode)
(custom-set-variables (custom-set-variables
@ -99,7 +97,7 @@
(face tabs spaces trailing space-before-tab newline indentation empty space-after-tab space-mark tab-mark)))) (face tabs spaces trailing space-before-tab newline indentation empty space-after-tab space-mark tab-mark))))
;; nya-nya-nya-nya-nya-nya ;; nya-nya-nya-nya-nya-nya
(oxa/insure 'nyan-mode) (straight-use-package 'nyan-mode)
(require 'nyan-mode) (require 'nyan-mode)
(nyan-mode 1) (nyan-mode 1)

View file

@ -1,4 +1,4 @@
(oxa/insure 'auctex) (straight-use-package 'auctex)
(require 'tex-site) (require 'tex-site)
(require 'reftex) (require 'reftex)

View file

@ -2,8 +2,9 @@
(require 'calendar) (require 'calendar)
(setq calendar-week-start-day 1) (setq calendar-week-start-day 1)
(straight-use-package 'org)
(straight-use-package 'org-roam)
(require 'org) (require 'org)
(oxa/insure 'org-roam)
(require 'org-roam) (require 'org-roam)
;; expose org functions ;; expose org functions

15
lisp/oxa/package-mgmt.el Normal file
View file

@ -0,0 +1,15 @@
;; straight.el bootstrap
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(provide 'oxa/package-mgmt)

View file

@ -1,18 +1,3 @@
;;; Package management
(require 'package)
(defvar oxa/package-archive-refreshed nil)
(defun oxa/refresh-archive ()
(when (not oxa/package-archive-refreshed)
(package-refresh-contents)
(setq oxa/package-archive-refreshed t)))
;; ensure package
(defun oxa/insure (package)
(when (not (package-installed-p package))
(oxa/refresh-archive)
(package-install package)))
;; Macro to simplify setting mode-local vars ;; Macro to simplify setting mode-local vars
(defmacro oxa/hook (hook-name &rest body) (defmacro oxa/hook (hook-name &rest body)
`(add-hook ',hook-name '(lambda nil ,@body))) `(add-hook ',hook-name '(lambda nil ,@body)))