about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--.emacs.d/init.el3
-rw-r--r--.emacs.d/lisp/init-completion.el3
-rw-r--r--.emacs.d/lisp/init-dired.el6
-rw-r--r--.emacs.d/lisp/init-editor.el7
-rw-r--r--.emacs.d/lisp/init-emacs-lisp.el3
-rw-r--r--.emacs.d/lisp/init-minibuffer.el8
-rw-r--r--.emacs.d/lisp/init-modeline.el3
-rw-r--r--.emacs.d/lisp/init-packages.el87
-rw-r--r--.emacs.d/lisp/init-project.el1
-rw-r--r--.emacs.d/lisp/init-search.el3
-rw-r--r--.emacs.d/lisp/init-sql.el3
-rw-r--r--.emacs.d/lisp/init-tramp.el3
-rw-r--r--.emacs.d/lisp/init-windows.el3
-rw-r--r--.emacs.d/lisp/init-xml.el3
14 files changed, 68 insertions, 68 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 75801a3..582a1f5 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -21,7 +21,8 @@
 (add-hook 'emacs-startup-hook
           (lambda ()
             (message "%s packages loaded in %0.1f seconds"
-                     (length package-activated-list)
+                     ;;(length package-activated-list)
+                     (hash-table-count straight--profile-cache)
                      (string-to-number (emacs-init-time)))))
 
 (add-hook 'after-init-hook #'(lambda ()
diff --git a/.emacs.d/lisp/init-completion.el b/.emacs.d/lisp/init-completion.el
index 47c984e..ce66ddb 100644
--- a/.emacs.d/lisp/init-completion.el
+++ b/.emacs.d/lisp/init-completion.el
@@ -11,8 +11,7 @@
   (setq dabbrev-case-fold-search t)
   (setq dabbrev-case-replace nil))
 
-(use-package hippie-expand
-  :ensure nil
+(use-feature hippie-expand
   :init
   (setq hippie-expand-try-functions-list
       '(;yas-hippie-try-expand
diff --git a/.emacs.d/lisp/init-dired.el b/.emacs.d/lisp/init-dired.el
index f1c7fe6..75a952f 100644
--- a/.emacs.d/lisp/init-dired.el
+++ b/.emacs.d/lisp/init-dired.el
@@ -2,8 +2,7 @@
 ;;; Commentary:
 ;;; Code:
 
-(use-package dired
-  :ensure nil
+(use-feature dired
   :config
   (put 'dired-find-alternate-file 'disabled nil)
   :custom
@@ -14,8 +13,7 @@
   (dired-kill-when-opening-new-dired-buffer t)
   (wdired-use-dired-vertical-movement 'sometimes))
 
-(use-package dired-x
-  :ensure nil)
+(use-feature dired-x)
 
 (use-package dired-subtree
   :config
diff --git a/.emacs.d/lisp/init-editor.el b/.emacs.d/lisp/init-editor.el
index a01958d..f89bb15 100644
--- a/.emacs.d/lisp/init-editor.el
+++ b/.emacs.d/lisp/init-editor.el
@@ -4,7 +4,6 @@
 ;;; Code:
 
 (use-package emacs
-  :ensure nil
   :bind
   ("C-x \\" . align-regexp)
   ("C-+" . text-scale-increase)
@@ -123,9 +122,8 @@
   (undo-tree-history-directory-alist `((".*" . ,temporary-file-directory)))
   (undo-tree-auto-save-history t))
 
-(use-package abbrev
+(use-feature abbrev
   :defer 5
-  :ensure nil
   :diminish
   :hook
   (text-mode . abbrev-mode)
@@ -148,8 +146,7 @@
   :bind
   ("C-c ." . operate-on-number-at-point))
 
-(use-package xref
-  :ensure nil
+(use-feature xref
   :custom (xref-search-program 'ripgrep)
   :config
   (defun xref-find-references-other-window (identifier)
diff --git a/.emacs.d/lisp/init-emacs-lisp.el b/.emacs.d/lisp/init-emacs-lisp.el
index 7642ca9..b206d90 100644
--- a/.emacs.d/lisp/init-emacs-lisp.el
+++ b/.emacs.d/lisp/init-emacs-lisp.el
@@ -5,8 +5,7 @@
 
 (require 'init-lisp)
 
-(use-package eldoc
-  :ensure nil
+(use-feature eldoc
   :diminish)
 
 (use-package elisp-slime-nav
diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el
index 6124bd6..397e77d 100644
--- a/.emacs.d/lisp/init-minibuffer.el
+++ b/.emacs.d/lisp/init-minibuffer.el
@@ -31,6 +31,8 @@
         #'command-completion-default-include-p))
 
 (use-package vertico
+  :straight (vertico :files (:defaults "extensions/*")
+                     :includes (vertico-directory vertico-repeat))
   :init
   (vertico-mode)
   :custom (vertico-cycle t)
@@ -95,8 +97,7 @@ DEFS is a plist associating completion categories to commands."
          ("C-M-S-g" . minibuffer-really-quit)
          (:map vertico-map ("M-RET" . minibuffer-force-complete-and-exit))))
 
-(use-package vertico-directory
-  :ensure nil
+(use-feature vertico-directory
   :after vertico
   :init
   (defvar switching-project nil)
@@ -144,8 +145,7 @@ DEFS is a plist associating completion categories to commands."
   ;; Tidy shadowed file names
   :hook (rfn-eshadow-update-overlay . vertico-directory-tidy))
 
-(use-package vertico-repeat
-  :ensure nil
+(use-feature vertico-repeat
   :bind ("M-P" . vertico-repeat))
 
 (use-package consult
diff --git a/.emacs.d/lisp/init-modeline.el b/.emacs.d/lisp/init-modeline.el
index f9f51c6..6e20428 100644
--- a/.emacs.d/lisp/init-modeline.el
+++ b/.emacs.d/lisp/init-modeline.el
@@ -6,8 +6,7 @@
 (column-number-mode t)
 ;(size-indication-mode t) ; TODO
 
-(use-package which-func
-  :ensure nil
+(use-feature which-func
   :config
   (which-function-mode 1))
 
diff --git a/.emacs.d/lisp/init-packages.el b/.emacs.d/lisp/init-packages.el
index 8455f2d..57a6859 100644
--- a/.emacs.d/lisp/init-packages.el
+++ b/.emacs.d/lisp/init-packages.el
@@ -2,55 +2,68 @@
 ;;; Commentary:
 ;;; Code:
 
-;; TODO - straight.el?
-
-(require 'package)
-(require 'url)
+(defvar initial-features features)
 
 (setq package-archives '(("melpa" . "https://melpa.org/packages/")
                          ("melpa-stable" . "https://stable.melpa.org/packages/")
                          ("nongnu" . "https://elpa.nongnu.org/nongnu/")
                          ("elpa" . "https://elpa.gnu.org/packages/")))
-(setq package-pinned-packages '((cider . "melpa-stable")))
-(package-initialize)
 
-(unless package-archive-contents
-  (package-refresh-contents))
+(setq straight-use-package-by-default t
+      straight-vc-git-default-clone-depth 1
+      straight-check-for-modifications '(find-when-checking check-on-save)
+      use-package-always-defer t
+      package-native-compile t)
 
-(setq package-native-compile t)
+(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))
 
-(unless (package-installed-p 'use-package)
-   (package-install 'use-package))
-(require 'use-package)
+(straight-use-package 'use-package)
 
-(setq use-package-always-ensure t
-      use-package-always-defer t)
+;; https://github.com/radian-software/radian/blob/e3aad124c8e0cc870ed09da8b3a4905d01e49769/emacs/radian.el#L352
+(defmacro use-feature (name &rest args)
+  "Like `use-package', but with `straight-use-package-by-default' disabled.
+`NAME' and `ARGS' are as with `use-package'"
+  (declare (indent defun))
+  `(use-package ,name
+     :straight nil
+     ,@args))
+(use-feature straight-x
+  :commands (straight-x-fetch-all))
 
 (use-package diminish)
 
-(use-package epl
-  :if noninteractive
-  :demand t
-  :config
-  ;; TODO make a copy of the built-in check for system packages work instead
-  (defvar my/system-packages '(vterm))
-  ;; emacs -Q --batch -L "~/.emacs.d/lisp/" -l "init-packages.el" -f "my/upgrade-packages"
-  (defun my/upgrade-packages ()
-    (interactive)
-    (epl-refresh)
-    (when-let ((upgrades (seq-filter (lambda (u)
-                                       (not (member
-                                             (epl-package-name (epl-upgrade-available u))
-                                             my/system-packages)))
-                                     (epl-find-upgrades))))
-      ;; TODO why doesn't this work?
-      ;; (epl-upgrade (mapcar 'epl-upgrade-available upgrades)
-      (dolist (upgrade upgrades)
-        (epl-package-install (epl-upgrade-available upgrade) 'force)
-        (epl-package-delete (epl-upgrade-installed upgrade))))
-    (message "Package upgrade finished.")
-    ;; TODO does this help async native-comp to finish when called from the command line?
-    (sit-for 30)))
+(defun run-straight-lock-file-function (func)
+  "Safely run straight lockfile-related function `FUNC'.
+This will set `features' back the value it had before loading straight, to ensure
+that everything loaded by `require' or `use-package' is re-loaded."
+  (setq features initial-features)
+  (funcall func))
+
+(defun my/upgrade-packages ()
+  "Upgrade all packages installed with straight."
+  (interactive)
+  (straight-pull-recipe-repositories) ;; TODO is this needed?
+  (straight-x-fetch-all)
+  (straight-merge-all)
+  (straight-check-all)
+  ;; Do this automatically, as we can always revert and thaw
+  (run-straight-lock-file-function 'straight-freeze-versions))
+
+(defun my/thaw-packages ()
+  "Restore all packages to the versions in the straight lockfile."
+  (interactive)
+  (run-straight-lock-file-function 'straight-thaw-versions))
 
 (provide 'init-packages)
 ;;; init-packages.el ends here
diff --git a/.emacs.d/lisp/init-project.el b/.emacs.d/lisp/init-project.el
index ac27710..62f2630 100644
--- a/.emacs.d/lisp/init-project.el
+++ b/.emacs.d/lisp/init-project.el
@@ -5,7 +5,6 @@
 (require 'subr-x)
 
 (use-package project
-  :ensure nil
   :config
   (defun project--clojure-switch-to-test (filename project-root)
     (let* ((project-src-file (string-remove-prefix project-root filename))
diff --git a/.emacs.d/lisp/init-search.el b/.emacs.d/lisp/init-search.el
index f9c8c31..163d91d 100644
--- a/.emacs.d/lisp/init-search.el
+++ b/.emacs.d/lisp/init-search.el
@@ -2,8 +2,7 @@
 ;;; Commentary:
 ;;; Code:
 
-(use-package isearch
-  :ensure nil
+(use-feature isearch
   :custom
   (search-whitespace-regexp ".*\\b")
   (isearch-lax-whitespace t)
diff --git a/.emacs.d/lisp/init-sql.el b/.emacs.d/lisp/init-sql.el
index ac24b91..34335a8 100644
--- a/.emacs.d/lisp/init-sql.el
+++ b/.emacs.d/lisp/init-sql.el
@@ -2,8 +2,7 @@
 ;;; Commentary:
 ;;; Code:
 
-(use-package sql
-  :ensure nil
+(use-feature sql
   :commands add-sql-connection
   :config
   ;; partially inspired by https://dev.to/viglioni/emacs-as-sql-client-with-lsp-143l (but currently only works for postgres)
diff --git a/.emacs.d/lisp/init-tramp.el b/.emacs.d/lisp/init-tramp.el
index d70042f..739236b 100644
--- a/.emacs.d/lisp/init-tramp.el
+++ b/.emacs.d/lisp/init-tramp.el
@@ -2,9 +2,8 @@
 ;;; Commentary:
 ;;; Code:
 
-(use-package tramp
+(use-feature tramp
   :defer 5
-  :ensure nil
   :custom
   (tramp-default-method "ssh")
   (vc-ignore-dir-regexp
diff --git a/.emacs.d/lisp/init-windows.el b/.emacs.d/lisp/init-windows.el
index 0a6d505..7c0046e 100644
--- a/.emacs.d/lisp/init-windows.el
+++ b/.emacs.d/lisp/init-windows.el
@@ -56,8 +56,7 @@
          ("C-S-<left>" . buf-move-left)
          ("C-S-<right>" . buf-move-right)))
 
-(use-package uniquify
-  :ensure nil
+(use-feature uniquify
   :custom
   (uniquify-buffer-name-style 'forward))
 
diff --git a/.emacs.d/lisp/init-xml.el b/.emacs.d/lisp/init-xml.el
index 60c9835..ec9d6b9 100644
--- a/.emacs.d/lisp/init-xml.el
+++ b/.emacs.d/lisp/init-xml.el
@@ -3,8 +3,7 @@
 ;; Based on prelude-xml.el
 ;;; Code:
 
-(use-package nxml-mode
-  :ensure nil
+(use-feature nxml-mode
   :config
   (push '("<\\?xml" . nxml-mode) magic-mode-alist)
   (add-to-list 'auto-mode-alist '("\\.pom\\'" . nxml-mode))