Reindent ThoomEmacs.org

This commit is contained in:
2022-10-09 10:31:41 -07:00
parent a2d1776e60
commit b8c53386e0

View File

@@ -4,8 +4,8 @@
* Prelude
** Package Management
#+BEGIN_SRC emacs-lisp
(defvar bootstrap-version)
(let ((bootstrap-file
(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)
@@ -17,20 +17,20 @@
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(straight-use-package 'use-package)
#+END_SRC
** Utility constants for checking operating system
#+begin_src emacs-lisp
;; Check the system used
(defconst ON-LINUX (eq system-type 'gnu/linux))
(defconst ON-MAC (eq system-type 'darwin))
(defconst ON-BSD (or ON-MAC (eq system-type 'berkeley-unix)))
(defconst ON-WINDOWS (memq system-type '(cygwin windows-nt ms-dos)))
;; Check the system used
(defconst ON-LINUX (eq system-type 'gnu/linux))
(defconst ON-MAC (eq system-type 'darwin))
(defconst ON-BSD (or ON-MAC (eq system-type 'berkeley-unix)))
(defconst ON-WINDOWS (memq system-type '(cygwin windows-nt ms-dos)))
#+end_src
** Fix PATH on macOS
Emacs on macOS doesn't naturally find shell variables like PATH, so to help it out we run a shell and load some variables from the env command.
#+begin_src emacs-lisp
(use-package exec-path-from-shell
(use-package exec-path-from-shell
:straight t
:if (and ON-MAC (memq window-system '(mac ns)))
:config
@@ -42,19 +42,19 @@ Emacs on macOS doesn't naturally find shell variables like PATH, so to help it o
#+end_src
** Auto-tangle this file
#+begin_src emacs-lisp
(defun thoom/org-babel-tangle-config ()
(defun thoom/org-babel-tangle-config ()
(when (string-equal (file-truename (buffer-file-name))
(expand-file-name "~/.dotfiles/thoom-emacs/ThoomEmacs.org"))
;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle))))
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'thoom/org-babel-tangle-config)))
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'thoom/org-babel-tangle-config)))
#+end_src
* Basic UI Tweaks
** Theme
#+begin_src emacs-lisp
(use-package doom-themes
(use-package doom-themes
:straight t
:config
;; Global settings (defaults)
@@ -72,14 +72,14 @@ Emacs on macOS doesn't naturally find shell variables like PATH, so to help it o
Disable a bunch of stuff we don't want to see.
#+BEGIN_SRC emacs-lisp
(setq inhibit-startup-message t
(setq inhibit-startup-message t
use-dialog-box nil)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(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)
;; 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))
#+END_SRC
@@ -87,36 +87,36 @@ Disable a bunch of stuff we don't want to see.
Set some common settings, like global-auto-revert-mode.
#+BEGIN_SRC emacs-lisp
(setq-default scroll-error-top-bottom t)
(setq-default scroll-error-top-bottom t)
;; Revert buffers when the underlying file has changed
(global-auto-revert-mode 1)
;; Revert buffers when the underlying file has changed
(global-auto-revert-mode 1)
;; Remember recent files
(recentf-mode 1)
;; Remember recent files
(recentf-mode 1)
;; Save what you enter into minibuffer prompts
(setq history-length 25)
(savehist-mode 1)
;; Save what you enter into minibuffer prompts
(setq history-length 25)
(savehist-mode 1)
;; Visually mark the line the cursor is on
(global-hl-line-mode 1)
;; Visually mark the line the cursor is on
(global-hl-line-mode 1)
;; TODO - Decide whether to enable this
;; (defalias 'yes-or-no-p 'y-or-n-p)
;; TODO - Decide whether to enable this
;; (defalias 'yes-or-no-p 'y-or-n-p)
#+END_SRC
** hl-todo
#+begin_src emacs-lisp
(use-package hl-todo
(use-package hl-todo
:straight t
:init
(global-hl-todo-mode))
#+end_src
** Repeat Mode
#+begin_src emacs-lisp
(repeat-mode 1)
(repeat-mode 1)
(defmacro thoom/repeat-map (keymap-sym &rest bindings)
(defmacro thoom/repeat-map (keymap-sym &rest bindings)
"A helper macro for defining repeat maps. keymap-sym is a symbol to name the keymap with.
bindings are a sequence of cons cells containing a string to be passed to kbd and a function
for that key to be mapped to."
@@ -135,26 +135,26 @@ Set some common settings, like global-auto-revert-mode.
** Tab Bar
#+begin_src emacs-lisp
(tab-bar-mode)
(tab-bar-mode)
;; TODO - keybindings
;; TODO - keybindings
#+end_src
** Custom File
Set a location for the custom file so it doesn't pollute this file.
#+BEGIN_SRC emacs-lisp
(setq custom-file (locate-user-emacs-file "custom-vars.el"))
(setq custom-file (locate-user-emacs-file "custom-vars.el"))
#+END_SRC
* Emacs Server
#+begin_src emacs-lisp
(require 'server)
(unless (server-running-p) (server-start))
(require 'server)
(unless (server-running-p) (server-start))
#+end_src
* Keybindings
** Which-key
#+begin_src emacs-lisp
(use-package which-key
(use-package which-key
:straight t
:init
(which-key-mode)
@@ -162,7 +162,7 @@ Set a location for the custom file so it doesn't pollute this file.
#+end_src
** Keybindings
#+BEGIN_SRC emacs-lisp
(use-package emacs
(use-package emacs
:bind
;; Window management
(("C-c w v" . split-window-right)
@@ -198,21 +198,21 @@ Set a location for the custom file so it doesn't pollute this file.
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
;; TODO - define keys to move region up and down by lines
(define-key indent-rigidly-map (kbd "H") 'indent-rigidly-left)
(define-key indent-rigidly-map (kbd "L") 'indent-rigidly-right)
(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)
;; TODO - define keys to move region up and down by lines
(define-key indent-rigidly-map (kbd "H") 'indent-rigidly-left)
(define-key indent-rigidly-map (kbd "L") 'indent-rigidly-right)
(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)
(defmacro thoom/meow-negate (meow-command)
`(lambda ()
(interactive)
(let ((current-prefix-arg -1))
(call-interactively ,meow-command))))
(use-package meow
(use-package meow
:straight t
:init
;; TODO - make this unnecessary
@@ -353,7 +353,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
** TODO Autocompletion
* Org
#+begin_src emacs-lisp
(use-package org
(use-package org
:hook (org-mode . visual-line-mode)
:config
;; Add structure templates
@@ -369,7 +369,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
("p" . org-previous-visible-heading)
("C-p" . org-previous-visible-heading)))
(use-package org-bullets
(use-package org-bullets
:straight t
:hook org-mode)
#+end_src
@@ -377,14 +377,14 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
* VMOCE
** Vertico
#+begin_src emacs-lisp
(use-package vertico
(use-package vertico
:straight t
:init
(vertico-mode))
#+end_src
** Marginalia
#+begin_src emacs-lisp
(use-package marginalia
(use-package marginalia
:straight t
;; Either bind `marginalia-cycle' globally or only in the minibuffer
:bind (:map minibuffer-local-map
@@ -395,7 +395,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
#+end_src
** Orderless
#+begin_src emacs-lisp
(use-package orderless
(use-package orderless
:straight t
:init
;; Configure a custom style dispatcher (see the Consult wiki)
@@ -407,7 +407,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
#+end_src
** Consult
#+begin_src emacs-lisp
(use-package consult
(use-package consult
:straight t
;; Replace bindings. Lazily loaded due by `use-package'.
:bind (;; C-c bindings (mode-specific-map)
@@ -527,7 +527,7 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
#+end_src
** Embark
#+begin_src emacs-lisp
(use-package embark
(use-package embark
:straight t
:bind
@@ -546,8 +546,8 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
nil
(window-parameters (mode-line-format . none)))))
;; Consult users will also want the embark-consult package.
(use-package embark-consult
;; Consult users will also want the embark-consult package.
(use-package embark-consult
:straight t
:after (embark consult)
:demand t ; only necessary if you have the hook below