Start migrating thoom-emacs away from org

This commit is contained in:
2024-04-05 11:21:11 -07:00
parent 0c59bfa350
commit 583dbf635d
7 changed files with 434 additions and 188 deletions

View File

@@ -1,23 +1,52 @@
#+title: Thoom Emacs
#+PROPERTY: header-args:emacs-lisp :tangle ./init.el :mkdirp yes
#+STARTUP: content
* Prelude
** Package Management
* DONE Prelude
** Package Management - Elpaca
#+BEGIN_SRC emacs-lisp
(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))
(defvar elpaca-installer-version 0.7)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
:ref nil :depth 1
:files (:defaults "elpaca-test.el" (:exclude "extensions"))
:build (:not elpaca--activate-package)))
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory))
(order (cdr elpaca-order))
(default-directory repo))
(add-to-list 'load-path (if (file-exists-p build) build repo))
(unless (file-exists-p repo)
(make-directory repo t)
(when (< emacs-major-version 28) (require 'subr-x))
(condition-case-unless-debug err
(if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
((zerop (apply #'call-process `("git" nil ,buffer t "clone"
,@(when-let ((depth (plist-get order :depth)))
(list (format "--depth=%d" depth) "--no-single-branch"))
,(plist-get order :repo) ,repo))))
((zerop (call-process "git" nil buffer t "checkout"
(or (plist-get order :ref) "--"))))
(emacs (concat invocation-directory invocation-name))
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
"--eval" "(byte-recompile-directory \".\" 0 'force)")))
((require 'elpaca))
((elpaca-generate-autoloads "elpaca" repo)))
(progn (message "%s" (buffer-string)) (kill-buffer buffer))
(error "%s" (with-current-buffer buffer (buffer-string))))
((error) (warn "%s" err) (delete-directory repo 'recursive))))
(unless (require 'elpaca-autoloads nil t)
(require 'elpaca)
(elpaca-generate-autoloads "elpaca" repo)
(load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))
(straight-use-package 'use-package)
(elpaca elpaca-use-package
(elpaca-use-package-mode))
;; Wait for elpaca-use-package to finish installing before proceding
(elpaca-wait)
#+END_SRC
** Utility constants for checking operating system
#+begin_src emacs-lisp
@@ -51,7 +80,7 @@ Emacs on macOS doesn't naturally find shell variables like PATH, so to help it o
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'thoom/org-babel-tangle-config)))
#+end_src
* Basic UI Tweaks
* DONE Basic UI Tweaks
** Theme
#+begin_src emacs-lisp
(use-package doom-themes
@@ -83,8 +112,8 @@ Disable a bunch of stuff we don't want to see.
(scroll-bar-mode -1)
;; On a Mac, the menu bar doesn't take up screen real-estate, so leave it on
(if (not ON-MAC)
(menu-bar-mode -1))
(unless ON-MAC
(menu-bar-mode -1))
#+END_SRC
** General Settings
@@ -145,9 +174,8 @@ Set a location for the custom file so it doesn't pollute this file.
(require 'server)
(unless (server-running-p) (server-start))
#+end_src
* Keybindings
** Which-key
** DONE Which-key
#+begin_src emacs-lisp
(use-package which-key
:straight t
@@ -155,7 +183,7 @@ Set a location for the custom file so it doesn't pollute this file.
(which-key-mode)
(which-key-setup-side-window-bottom))
#+end_src
** Keybindings
** WAIT Keybindings
#+BEGIN_SRC emacs-lisp
(use-package emacs
:bind
@@ -202,7 +230,7 @@ Set a location for the custom file so it doesn't pollute this file.
;; mark-page is not very useful, and shadows project.el bindings in Meow keypad
(unbind-key "C-x C-p"))
#+END_SRC
** Dired
** DONE Dired
#+begin_src emacs-lisp
(use-package dired
:bind (:map dired-mode-map
@@ -211,7 +239,7 @@ Set a location for the custom file so it doesn't pollute this file.
#+end_src
* Editing
** Fancy Indenting
** WAIT Fancy Indenting
When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by single character increments and =h/l= to adjust by tab stops.
#+begin_src emacs-lisp
@@ -221,159 +249,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
(define-key indent-rigidly-map (kbd "h") 'indent-rigidly-left-to-tab-stop)
(define-key indent-rigidly-map (kbd "l") 'indent-rigidly-right-to-tab-stop)
#+end_src
** Meow
#+begin_src emacs-lisp
(defmacro thoom/meow-negate (meow-command)
`(lambda ()
(interactive)
(let ((current-prefix-arg -1))
(call-interactively ,meow-command))))
(use-package meow
:straight t
:init
;; TODO - make this unnecessary
(require 'meow)
;; TODO - debug this. should make org headings into meow things
(meow-thing-register 'heading 'heading 'heading)
(setq meow-use-clipboard t
meow-char-thing-table '((?\( . round)
(?\) . round)
(?\[ . square)
(?\] . square)
(?\{ . curly)
(?\} . curly)
(?\" . string)
(?\' . string)
(?h . heading)
(?e . symbol)
(?w . window)
(?b . buffer)
(?p . paragraph)
(?l . line)
(?d . defun)
(?. . sentence))
meow-cheatsheet-layout meow-cheatsheet-layout-qwerty
meow-keypad-self-insert-undefined nil)
(add-to-list 'meow-mode-state-list '(eshell-mode . insert) t)
(add-hook 'git-commit-mode-hook 'meow-insert)
(meow-motion-overwrite-define-key
'("j" . meow-next)
'("k" . meow-prev)
'("J" . meow-next-expand)
'("K" . meow-prev-expand)
'(":" . execute-extended-command)
'("<escape>" . ignore))
(meow-leader-define-key
;; SPC j/k will run the original command in MOTION state.
'("j" . "H-j")
'("k" . "H-k")
;; Use SPC (0-9) for digit arguments.
'("1" . meow-digit-argument)
'("2" . meow-digit-argument)
'("3" . meow-digit-argument)
'("4" . meow-digit-argument)
'("5" . meow-digit-argument)
'("6" . meow-digit-argument)
'("7" . meow-digit-argument)
'("8" . meow-digit-argument)
'("9" . meow-digit-argument)
'("0" . meow-digit-argument)
'("/" . meow-keypad-describe-key)
'("?" . meow-cheatsheet))
(meow-define-keys 'insert
'("C-g" . meow-insert-exit)
'("C-M-g" . meow-insert-exit))
(meow-normal-define-key
'("0" . meow-expand-0)
'("9" . meow-expand-9)
'("8" . meow-expand-8)
'("7" . meow-expand-7)
'("6" . meow-expand-6)
'("5" . meow-expand-5)
'("4" . meow-expand-4)
'("3" . meow-expand-3)
'("2" . meow-expand-2)
'("1" . meow-expand-1)
'("-" . negative-argument)
'(";" . meow-reverse)
'("," . meow-inner-of-thing)
'("." . meow-bounds-of-thing)
'("[" . meow-beginning-of-thing)
'("]" . meow-end-of-thing)
;; Potential addition <, >
'("a" . meow-append)
'("A" . meow-open-below)
'("b" . meow-back-word)
'("B" . meow-back-symbol)
'("c" . meow-change)
;; Potential addition
'("d" . meow-delete)
'("D" . meow-backward-delete)
'("e" . meow-next-word)
'("E" . meow-next-symbol)
'("f" . meow-find)
`("F" . ,(thoom/meow-negate 'meow-find))
'("g g" . meow-cancel-selection)
'("g d" . xref-find-definitions)
'("g u" . xref-find-references)
'("G" . meow-grab)
'("h" . meow-left)
'("H" . meow-left-expand)
'("i" . meow-insert)
'("I" . meow-open-above)
'("j" . meow-next)
'("J" . meow-next-expand)
'("k" . meow-prev)
'("K" . meow-prev-expand)
'("l" . meow-right)
'("L" . meow-right-expand)
'("m" . meow-join)
;; Potential addition - M
'("n" . meow-search)
;; Potential addition - N
'("o" . meow-block)
'("O" . meow-to-block)
'("p" . meow-yank)
'("P" . consult-yank-pop)
'("q" . meow-cancel-selection)
;; Potential addition - Q
'("r" . meow-replace)
'("R" . meow-swap-grab)
'("s" . meow-kill)
;; Potential addition - S
'("t" . meow-till)
`("T" . ,(thoom/meow-negate 'meow-till))
'("u" . meow-undo)
'("U" . meow-undo-in-selection)
'("v" . meow-visit)
`("V" . ,(thoom/meow-negate 'meow-visit))
'("w" . meow-mark-word)
'("W" . meow-mark-symbol)
'("x" . meow-line)
`("X" . ,(thoom/meow-negate 'meow-line))
'("y" . meow-save)
'("Y" . meow-sync-grab)
'("z" . meow-pop-selection)
;; Potential addition - Z
'("'" . repeat)
'("/" . meow-comment)
'(":" . execute-extended-command)
'("=" . indent-region)
'("+" . indent-rigidly))
(meow-global-mode 1))
#+end_src
** Autocompletion
** DONE Autocompletion
#+begin_src emacs-lisp
(use-package corfu
:straight t
@@ -405,7 +281,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
:init
(setq tab-always-indent 'complete))
#+end_src
** Dumb-Jump
** DONE Dumb-Jump
#+begin_src emacs-lisp
(use-package dumb-jump
:straight t
@@ -437,8 +313,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
:straight t
:hook org-mode)
#+end_src
** Groceries
** DONE Groceries
#+begin_src emacs-lisp
(defun thoom-org-clear-all ()
(interactive)
@@ -449,9 +324,8 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
(flush-lines "CLOSED")
(message "Entries cleared."))
#+end_src
* VMOCE
** Vertico
** DONE Vertico
#+begin_src emacs-lisp
(use-package vertico
:straight (:files (:defaults "extensions/*"))
@@ -468,7 +342,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
("C-h" . vertico-directory-delete-word)
("C-l" . vertico-directory-enter)))
#+end_src
** Marginalia
** DONE Marginalia
#+begin_src emacs-lisp
(use-package marginalia
:straight t
@@ -479,7 +353,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
:init
(marginalia-mode))
#+end_src
** Orderless
** DONE Orderless
#+begin_src emacs-lisp
(use-package orderless
:straight t
@@ -491,7 +365,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion)))))
#+end_src
** Consult
** DONE Consult
#+begin_src emacs-lisp
(use-package consult
:straight t
@@ -611,7 +485,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
;; (setq consult-project-function (lambda (_) (locate-dominating-file "." ".git")))
)
#+end_src
** Embark
** DONE Embark
#+begin_src emacs-lisp
(use-package embark
:straight t
@@ -643,7 +517,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
(embark-collect-mode . consult-preview-at-point-mode))
#+end_src
* Git
* DONE Git
#+begin_src emacs-lisp
(use-package magit
:straight t
@@ -653,7 +527,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
(":" . execute-extended-command)
("x" . magit-discard)))
#+end_src
* Direnv
* DONE Direnv
#+begin_src emacs-lisp
(use-package direnv
:straight t