diff options
author | noa@gaiwan.org | 2024-06-23 10:35:04 +0000 |
---|---|---|
committer | noa@gaiwan.org | 2024-06-23 10:35:04 +0000 |
commit | b1cd32b8076005142083020fbfdd640689065ab5 (patch) | |
tree | 41ea30f28e815e50ecd888697a880a458712ecc9 | |
parent | 5847a3247570024d87f7b3d1f631638734fe0602 (diff) |
Replace use-package with package-ensure almost everywhere
-rw-r--r-- | config.org | 145 |
1 files changed, 88 insertions, 57 deletions
diff --git a/config.org b/config.org index f1ba891..22bdace 100644 --- a/config.org +++ b/config.org @@ -77,12 +77,8 @@ For a long time i used use-package to manage emacs package configuration. Over I've taken a little defun from acdw to install packages from source. #+begin_src elisp - (defun is-pair-p (p) - (and (cdr p) - (atom (cdr p)))) - (defun package-ensure (pkg) - (unless (package-installed-p (if (is-pair-p pkg) (car pkg) pkg)) + (unless (package-installed-p (car pkg)) (package-vc-install pkg))) #+end_src @@ -118,7 +114,9 @@ It is often useful to be able to run a command while i am already in the process Vertico is a package for a nice minibuffer completion experience. It displays a vertical list of candidates. It integrates well with the emacs ecosystem and lets me use other packages that also play nicely. #+begin_src elisp - (use-package vertico :ensure t) + (package-ensure '(vertico + :url "https://github.com/minad/vertico.git" + :lisp-dir "extensions/")) (setopt vertico-mode t) #+end_src @@ -173,10 +171,11 @@ If i type ~/ etc in a find-file prompt, get rid of the preceding directory names #+end_src #+begin_src elisp -(use-package orderless :ensure t) -(setopt completion-styles '(orderless basic)) -(setopt completion-category-defaults nil) -(setopt completion-category-overrides '((file (styles partial-completion)))) + (package-ensure '(orderless + :url "https://github.com/oantolin/orderless")) + (setopt completion-styles '(orderless basic)) + (setopt completion-category-defaults nil) + (setopt completion-category-overrides '((file (styles partial-completion)))) #+end_src #+begin_src elisp @@ -290,7 +289,8 @@ I'd like to change the face, but ~pulse-highlight-face~ has *DO NOT CUSTOMIZE* i Jabber.el is an xmpp client in emacs. I don't actually use xmpp as xmpp that much. But i do use it to connect to irc, and this package lets me do that. Unfortunately, it's not a particularly well-behaved package; by default it clobbers some keybindings and floods the echo area with unhelpful messages. #+begin_src elisp - (use-package jabber :ensure t) + (package-ensure '(jabber + :url "https://codeberg.org/emacs-jabber/emacs-jabber.git")) (setopt jabber-account-list '(("noa@hmm.st"))) #+end_src @@ -378,8 +378,9 @@ Abbrev mode expands one string into another string. I use it as a simple autoco Jinx is a package for spellchecking. Previously i used [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Spelling.html][flyspell]], which is built in, and [[https://codeberg.org/ideasman42/emacs-spell-fu][spell-fu]]. Flyspell is not ideal because it only checks the word under the point. Furthermore, the correction interface is not pleasant to look at with a proportional font as it uses spaces to align the candidates. Spell-fu checks all the words that are visible, thereby behaving much more like a traditional spell checker. Jinx improves on spell-fu by interacting with the spellcheck process in a more efficient way, and has a nicer interface to corrections. #+begin_src elisp -(use-package jinx :ensure t) -(setopt global-jinx-mode t) + (package-ensure '(jinx + :url "https://github.com/minad/jinx.git")) + (setopt global-jinx-mode t) #+end_src Replace the default spellcheck binding with jinx @@ -439,11 +440,12 @@ Consult buffer can be used instead of the default buffer menu. It lists recentl These are some other almost default functions but with extra interactivity. #+begin_src elisp -(global-set-key [remap yank-pop] #'consult-yank-pop) -(global-set-key [remap goto-line] #'consult-goto-line) -(global-set-key [remap imenu] #'consult-imenu) -(bind-key [remap imenu] #'consult-org-heading #'org-mode-map) -(global-set-key [remap info] #'consult-info) + (global-set-key [remap yank-pop] #'consult-yank-pop) + (global-set-key [remap goto-line] #'consult-goto-line) + (global-set-key [remap imenu] #'consult-imenu) + (with-eval-after-load 'org + (bind-key [remap imenu] #'consult-org-heading #'org-mode-map)) + (global-set-key [remap info] #'consult-info) #+end_src ** Embark: sort of like right click, but better @@ -462,9 +464,9 @@ I've only recently started making use of embark and i definitely need to experim Embark indicators give us visual indication of what embark will do. The minimal indicator puts a message in the echo area. The highlight indicator highlights the region in the buffer that is being acted on. The isearch indicator does the same for when there are multiple regions to be acted on. If we want to see how we can act on the region, we can press C-h. #+begin_src elisp -(setopt embark-indicators '(embark-minimal-indicator - embark-highlight-indicator - embark-isearch-highlight-indicator)) + (setopt embark-indicators '(embark-minimal-indicator + embark-highlight-indicator + embark-isearch-highlight-indicator)) #+end_src As mentioned in the vertico configuration above, we can set vertico to use a different layout when completing different things. In this case, we set embark to take control of showing bindings help and of the prefix help, which is pressing C-h after pressing a prefix. Then we ensure we get a grid layout, so that we can see more commands on screen at a time. @@ -478,16 +480,18 @@ As mentioned in the vertico configuration above, we can set vertico to use a dif Because i use consult, it's recommended to have this package installed. #+begin_src elisp -(use-package embark-consult :ensure t) -(add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode) + (package-ensure '(embark-consult + :url "https://github.com/oantolin/embark.git")) + (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode) #+end_src ** Annotations for completing-read Marginalia provides us with annotations for candidates in completing read functions. This is things like docstrings for functions, file permissions in find-file, and so on. It's a small quality of life improvement. #+begin_src elisp -(use-package marginalia :ensure t) -(setopt marginalia-mode t) + (package-ensure '(marginalia + :url "https://github.com/minad/marginalia.git")) + (setopt marginalia-mode t) #+end_src We want to always show the relative age of a file. By default, files which haven't been modified for more than two weeks will display an absolute date. @@ -660,15 +664,17 @@ This doesn't work with code blocks at the moment. #+end_src #+begin_src elisp -(use-package helm-org-ql :ensure t) -(use-package org-super-links) -(setopt org-super-links-search-function #'helm-org-ql) + (package-ensure '(helm-org-ql + :url "https://github.com/alphapapa/org-ql.git")) + (use-package org-super-links) + (setopt org-super-links-search-function #'helm-org-ql) #+end_src -#+begin_src -(use-package org-modern :ensure t) -(add-hook 'org-mode-hook #'org-modern-mode) -;; (add-hook 'org-agenda-finalize-hook #'org-modern-agenda) +#+begin_src elisp + (package-ensure '(org-modern + :url "https://github.com/minad/org-modern.git")) + (add-hook 'org-mode-hook #'org-modern-mode) + ;; (add-hook 'org-agenda-finalize-hook #'org-modern-agenda) #+end_src There are three ways to make bullet lists in org mode, which seems a bit excessive to me. I almost always only use the hyphen, but i like my bullet points to look like bullets, so here i overwrite the hyphen display to show a bullet point. While i'm at it, i overwrite the others too, because they are functionally identical so should probably look the same too. @@ -835,7 +841,8 @@ The index page generation functions were taken from Dennis Ogbe. Thank you! Reading prose with long lines is a chore. Luckily there are several packages in emacs to make the windows squeeze text into a more legible sliver. Previously i used olivetti, which is a really nice package, but it's quite heavyweight and broke on me with no explanation more frequently than i appreciated. I've switched to visual-fill-column and been quite satisfied. #+begin_src elisp - (use-package visual-fill-column :ensure t) + (package-ensure '(visual-fill-column + :url "https://codeberg.org/joostkremers/visual-fill-column.git")) (setopt visual-fill-column-enable-sensible-window-split t) (setopt visual-fill-column-center-text t) (advice-add 'text-scale-adjust :after #'visual-fill-column-adjust) @@ -967,9 +974,10 @@ By default, don't show dired details I find it useful to see the recursive sizes of directories. This can be a little slow, so setting it as always on might not be the best idea, but the longest i've had to wait is about a second, and that's only if i run it on my home directory, so i think it's worth it at the moment. #+begin_src elisp -(use-package dired-du :ensure t) -(setopt dired-du-size-format t) -(add-hook 'dired-mode-hook #'dired-du-mode) + (package-ensure '(dired-du + :url "https://github.com/calancha/dired-du.git")) + (setopt dired-du-size-format t) + (add-hook 'dired-mode-hook #'dired-du-mode) #+end_src ** Indentation: tabs and whitespace settings @@ -1347,8 +1355,9 @@ My preferred behaviour is for the point to be at the start of the match. Becaus Okay, i lied about being vanilla. I want isearch to use the minibuffer like a good normal part of emacs #+begin_src elisp -(use-package isearch-mb :ensure t) -(setopt isearch-mb-mode t) + (package-ensure '(isearch-mb + :url "https://github.com/astoff/isearch-mb.git")) + (setopt isearch-mb-mode t) #+end_src #+begin_src elisp @@ -1370,19 +1379,21 @@ Undo is on C-/ and redo is on C-S-/. It's not standard, but these bindings are #+end_src #+begin_src elisp -(use-package markdown-mode - :ensure t - :mode ("\\.md\\'" . markdown-mode)) + (package-ensure '(markdown-mode + :url "https://github.com/jrblevin/markdown-mode.git")) + (add-to-list 'auto-mode-alist + '("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode)) + #+end_src #+begin_src elisp -(use-package valign - :ensure t - :hook (markdown-mode . valign-mode) - :hook (org-mode . valign-mode) - :custom - (valign-fancy-bar t) - (valign-max-table-size 0)) + (package-ensure '(valign + :url "https://github.com/casouri/valign.git")) + (add-hook 'markdown-mode-hook #'valign-mode) + (add-hook 'org-mode-hook #'valign-mode) + + (setopt valign-fancy-bar t) + (setopt valign-max-table-size 0) #+end_src This is my own version of fixed-pitch, which has some changes to it. No hooks are added by default. Updating the whitelist automatically applies the hooks. And there is no functionality for changing the cursor type. @@ -1430,10 +1441,11 @@ Similar to the above, we have to manually set the font we want to be used for em While we're here, let's set up emoji input. #+begin_src elisp -(use-package cape :ensure t) -(add-to-list 'vertico-multiform-categories - '(cape-emoji grid indexed (vertico-grid-annotate . 6))) -(global-set-key (kbd "C-.") #'cape-emoji) + (package-ensure '(cape + :url "https://github.com/minad/cape.git")) + (add-to-list 'vertico-multiform-categories + '(cape-emoji grid indexed (vertico-grid-annotate . 6))) + (global-set-key (kbd "C-.") #'cape-emoji) #+end_src Describe a key based on a string like "C-SPC" @@ -1455,16 +1467,18 @@ Update the calendar. We want weeks to start on a monday, the first day of the w Multiple cursors are a nice feature because they are very interactive. However, i've always found the emacs implementation a bit too janky. Iedit implements one case where multiple cursors are used, which is to put a cursor at every same symbol in the buffer and edit them all, sort of like a real-time query-replace. #+begin_src elisp -(use-package iedit :ensure t) + (package-ensure '(iedit + :url "https://github.com/victorhge/iedit.git")) #+end_src ** Replace Anzu provides real-time updates to the replacement string when running query-replace. #+begin_src elisp -(use-package anzu :ensure t) -(global-set-key [remap query-replace] 'anzu-query-replace) -(global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp) + (package-ensure '(anzu + :url "https://github.com/emacsorphanage/anzu.git")) + (global-set-key [remap query-replace] 'anzu-query-replace) + (global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp) #+end_src My computer has a small screen, so i find that it's more beneficial for me to split the frame into columns, so i get more context. However, splitting in this way only gives me a (window-width) of 61, so emacs will always split into vertically stacked windows. By setting this to 80, the first split should always be vertical. @@ -1530,6 +1544,8 @@ I don't know why but it seems cool #+begin_src elisp ;; (use-package i-ching :ensure t) + ;; (package-ensure '(i-ching + ;; :url "https://github.com/zzkt/i-ching.git")) #+end_src ** Unfill commands @@ -1584,12 +1600,21 @@ The auth-source library allows packages to request password information. It has #+end_src #+begin_src elisp + (package-ensure '(pass + :url "https://github.com/NicolasPetton/pass.git")) +#+end_src + +#+begin_src elisp (setopt confirm-kill-emacs 'y-or-n-p) #+end_src #+begin_src elisp -(global-set-key (kbd "C-=") #'calc) + (global-set-key (kbd "C-=") #'calc) #+end_src + +* Version control +I don't use magit. I tried it once, but my use of version control is very limited to just making some changes and then committing them. I don't work in programming and my projects are simple. + * Email I like to have my email offline. Of course my preference is also to have it inside of emacs for consistency with everything else. Currently i use mu4e as my mail user agent, which relies on an external tool. I also use two small command line programs to download and send mail. @@ -1755,3 +1780,9 @@ I have experimented with lots of different methods of reading mail, both in and (setopt message-forward-as-mime t) (setopt message-interactive t) #+end_src +* Music +#+begin_src elisp + (package-ensure '(listen + :url "https://github.com/alphapapa/listen.el.git")) + (setopt listen-directory "~/media/music") +#+end_src |