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