diff options
| author | Jakob L. Kreuze | 2019-02-23 15:02:27 -0500 |
|---|---|---|
| committer | Jakob L. Kreuze | 2019-02-23 15:02:27 -0500 |
| commit | 9de61cbf3d27c5de527d0bcfa57cbf260ba33ff3 (patch) | |
| tree | 830b1ff44c299fca141163c0e30c3669524ca7f8 /jakob.org | |
| parent | a24867390655fd81157b1ad79ad2021917ac97e9 (diff) | |
Migrate to straight.el for package management
Diffstat (limited to 'jakob.org')
| -rw-r--r-- | jakob.org | 166 |
1 files changed, 87 insertions, 79 deletions
@@ -13,6 +13,54 @@ These are prefixed with =my-= rather than replacing the original symbol, because I imagine messing with built-in functionality in such a careless way would break many things down the line. +* Package Management + +** straight.el + +I prefer the purely functional [[https://github.com/raxod502/straight.el][straight.el]] to =package.el=. This is not included +in vanilla Emacs, however, and requires the bootstrapping shown here. + +#+BEGIN_SRC elisp +(defvar bootstrap-version) +(let ((bootstrap-file + (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) + (bootstrap-version 5)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) +#+END_SRC + +** use-package + +[[https://github.com/jwiegley/use-package][use-package]], my preferred means for configuring third-party packages, +additionally requires bootstrapping. + +#+BEGIN_SRC elisp +(straight-use-package 'use-package) +(setq straight-use-package-by-default t) +#+END_SRC + +=bind-key= is required early on to support =use-package='s =:bind= declarations. + +#+BEGIN_SRC elisp +(use-package bind-key :defer t) +#+END_SRC + +* Libraries for Custom Elisp + +This file is interspersed with snippets of Elisp that depend on third-party +libraries, which are loaded here to avoid the issue of symbols not being +defined. + +#+BEGIN_SRC elisp +(require 'cl) +#+END_SRC + * Vanilla Functionality ** Startup @@ -68,50 +116,6 @@ massacre is not made of my =init.el=. (load custom-file)) #+END_SRC -** Packages - -For package archives, I currently use [[http://melpa.org/][MELPA]] and [[https://orgmode.org/elpa.html][Org's elpa]], the latter of which -is only enabled because Gentoo's Emacs package lacks =org-contribdir=. - -#+BEGIN_SRC elisp -(require 'package) -(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/")) -(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) -(package-initialize) -#+END_SRC - -Bootstrapping for =use-package=, which is how I prefer to declare and configure -third-party packages. - -#+BEGIN_SRC elisp -(unless (package-installed-p 'use-package) - (progn - (package-refresh-contents) - (package-install 'use-package))) - -(require 'use-package) -#+END_SRC - -Ensure that packages are installed by default. This can be overridden in with -=:ensure nil=. The automatic installation functionality of =use-package= is the -main reason I use it, so why not enable it by default? - -#+BEGIN_SRC elisp -(setq use-package-always-ensure t) -#+END_SRC - -Require =bind-key= early on for =:bind= declarations. - -#+BEGIN_SRC elisp -(use-package bind-key :defer t) -#+END_SRC - -And require the libraries that I use throughout this file. - -#+BEGIN_SRC elisp -(require 'cl) -#+END_SRC - ** Quality of Life Use a consistent confirmation dialog of "y or n". @@ -780,7 +784,7 @@ escaped twice -- once for =battery-format=, and once for =mode-line-format=. #+BEGIN_SRC elisp (use-package battery - :ensure t + :straight nil :config (add-to-mode-line (lambda () @@ -842,7 +846,7 @@ Transformer to highlight channels in the =completing-read= of (use-package counsel :bind (:map org-mode-map - ("C-c C-q" . counsel-org-tag))) + ("C-c C-q" . counsel-org-tag))) #+END_SRC * Dired @@ -852,7 +856,7 @@ preference of mine. #+BEGIN_SRC elisp (use-package dired - :ensure nil + :straight nil :init (setq-default dired-listing-switches "-alL")) #+END_SRC @@ -872,11 +876,10 @@ Yes, I use Emacs as my window manager. You should try it out some time! #+BEGIN_SRC elisp (use-package exwm-config - :after exwm - :ensure nil) + :straight nil + :after exwm) (use-package exwm - :ensure t :config (exwm-enable) #+END_SRC @@ -999,6 +1002,7 @@ pinentry's job. #+BEGIN_SRC elisp (use-package epa + :straight nil :config (setq epa-pinentry-mode 'loopback)) #+END_SRC @@ -1009,6 +1013,7 @@ Preference of hygene. See [[Filesystem]]. #+BEGIN_SRC elisp (use-package org + :straight nil :init (setq-default org-id-locations-file "~/.cache/emacs/org-id-locations") (setq-default org-latex-preview-ltxpng-directory "~/.cache/emacs/ltximg/") @@ -1144,6 +1149,28 @@ Code for generating hierarchical category listings. (newline)))))))) #+END_SRC +** Workflow + +Automatically open a buffer named =*Mind Dump*= to, well, save all of my +thoughts. They're dated and saved in a directory so I can =ag= them. This is the +closest thing I will ever have to an implementation of =ag= for my thoughts. + +#+BEGIN_SRC elisp +(defvar mind-dump-directory "~/Notes/Mind Dumps" + "Where to store dated 'mind dump' files.") + +(defun mind-dump-filename () + "Returns the path of today's 'mind dump' file." + (concatenate 'string + (file-name-as-directory mind-dump-directory) + (format-time-string "%Y-%m-%d") + ".org")) + +(let* ((buffer (find-file-noselect (mind-dump-filename)))) + (set-buffer buffer) + (rename-buffer "*Mind Dump*")) +#+END_SRC + ** Capture Low-friction of adding things to the day's "mind dump" and my GTD inbox. @@ -1235,28 +1262,6 @@ items right on the first try. It's unhelpful and really just annoying. (setq org-drill-forgetting-index 100)) #+END_SRC -** Workflow - -Automatically open a buffer named =*Mind Dump*= to, well, save all of my -thoughts. They're dated and saved in a directory so I can =ag= them. This is the -closest thing I will ever have to an implementation of =ag= for my thoughts. - -#+BEGIN_SRC elisp -(defvar mind-dump-directory "~/Notes/Mind Dumps" - "Where to store dated 'mind dump' files.") - -(defun mind-dump-filename () - "Returns the path of today's 'mind dump' file." - (concatenate 'string - (file-name-as-directory mind-dump-directory) - (format-time-string "%Y-%m-%d") - ".org")) - -(let* ((buffer (find-file-noselect (mind-dump-filename)))) - (set-buffer buffer) - (rename-buffer "*Mind Dump*")) -#+END_SRC - * Yasnippet Load all snippets when =yas-minor-mode= is enabled. @@ -1301,6 +1306,7 @@ including =truncate=, but omitting =autojoin=. #+BEGIN_SRC elisp (use-package erc + :straight nil :config (setq erc-modules '(button completion fill irccontrols list match @@ -1566,7 +1572,7 @@ I don't really care about persisting minibuffer history between sessions. #+BEGIN_SRC elisp (use-package savehist - :ensure nil + :straight nil :config (savehist-mode -1) #+END_SRC @@ -1593,6 +1599,7 @@ Preference of hygene. See [[Filesystem]]. #+BEGIN_SRC elisp (use-package tramp + :straight nil :init (setq-default tramp-persistency-file-name "~/.cache/emacs/tramp")) #+END_SRC @@ -1603,6 +1610,7 @@ Configuration for using the [[https://wiki.call-cc.org/emacs#builtin-scheme-supp #+BEGIN_SRC elisp (use-package xscheme + :straight nil :init (setq scheme-program-name "csi -:c") #+END_SRC @@ -1696,10 +1704,10 @@ Use standard movement keys instead of those used for minibuffer next/previous. #+BEGIN_SRC elisp :bind (:map company-active-map - ("M-n" . nil) - ("M-p" . nil) - ("C-n" . #'company-select-next) - ("C-p" . #'company-select-previous))) + ("M-n" . nil) + ("M-p" . nil) + ("C-n" . #'company-select-next) + ("C-p" . #'company-select-previous))) #+END_SRC * Flycheck @@ -1771,6 +1779,7 @@ Generally, I adhere to the [[https://www.kernel.org/doc/html/v4.10/process/codin #+BEGIN_SRC elisp (use-package cc-mode + :straight nil :hook (c-mode . (lambda () (c-set-style "linux")))) #+END_SRC @@ -1781,8 +1790,7 @@ Enable [[company]]. #+BEGIN_SRC elisp (use-package elisp-mode - :ensure nil - + :straight nil :hook (lisp-interaction-mode . company-mode) (emacs-lisp-mode . company-mode) |