ThoomEmacs init changes

- Move package management to top
- Add exec-path-from-shell
- Add server start
- Move thoom/meow-negate macro out of use-package block
- Add visual-line-mode to org
- Set org src indentation to 0 (but don't actually reindent yet)
- Add aspirational headings for modes to configure
This commit is contained in:
2022-10-09 10:28:19 -07:00
parent f9d334ea6d
commit a2d1776e60
2 changed files with 97 additions and 61 deletions

View File

@@ -2,29 +2,7 @@
#+PROPERTY: header-args:emacs-lisp :tangle ./init.el :mkdirp yes
#+STARTUP: content
* Prelude
** 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)))
#+end_src
** Auto-tangle this file
#+begin_src emacs-lisp
(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)))
#+end_src
* Package Management
** straight.el
** Package Management
#+BEGIN_SRC emacs-lisp
(defvar bootstrap-version)
(let ((bootstrap-file
@@ -38,14 +16,41 @@
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
#+END_SRC
** use-package
#+BEGIN_SRC emacs-lisp
(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)))
#+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
:straight t
:if (and ON-MAC (memq window-system '(mac ns)))
:config
(dolist (var '("NIX_SSL_CERT_FILE"
"NIX_PATH"
"NIX_PROFILES"))
(add-to-list 'exec-path-from-shell-variables var))
(exec-path-from-shell-initialize))
#+end_src
** Auto-tangle this file
#+begin_src emacs-lisp
(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)))
#+end_src
* Basic UI Tweaks
** Theme
#+begin_src emacs-lisp
@@ -63,7 +68,7 @@
(doom-themes-org-config))
#+end_src
** Hiding Stuff
** Hiding Clutter
Disable a bunch of stuff we don't want to see.
#+BEGIN_SRC emacs-lisp
@@ -100,18 +105,14 @@ Set some common settings, like global-auto-revert-mode.
;; 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
:straight t
:init
(global-hl-todo-mode))
#+end_src
** Repeat Mode
#+begin_src emacs-lisp
(repeat-mode 1)
@@ -133,20 +134,22 @@ Set some common settings, like global-auto-revert-mode.
#+end_src
** Tab Bar
#+begin_src emacs-lisp
(tab-bar-mode)
;; 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"))
#+END_SRC
* Emacs Server
#+begin_src emacs-lisp
(require 'server)
(unless (server-running-p) (server-start))
#+end_src
* Keybindings
** Which-key
@@ -183,6 +186,7 @@ Set a location for the custom file so it doesn't pollute this file.
("C-c b b" . consult-buffer)
("C-c b p" . previous-buffer)
("C-c b n" . next-buffer)
("C-c b C-c" . server-edit)
("C-o" . pop-global-mark)
("M-DEL" . backward-kill-word)
@@ -202,16 +206,17 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
#+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)
(defmacro thoom/meow-negate (meow-command)
`(lambda ()
(interactive)
(let ((current-prefix-arg -1))
(call-interactively ,meow-command))))
;; TODO - debug this. should make org headings into meow things
(meow-thing-register 'heading 'heading 'heading)
@@ -345,14 +350,18 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
(meow-global-mode 1))
#+end_src
** TODO Autocompletion
* Org
#+begin_src emacs-lisp
(use-package org
:hook (org-mode . visual-line-mode)
:config
;; Add structure templates
(add-to-list 'org-modules 'org-tempo t)
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(setq org-edit-src-content-indentation 0)
;; Repeat map for previous/next heading
(thoom/repeat-map thoom/org-previous-next-visible-heading-repeat-map
("n" . org-next-visible-heading)
@@ -366,7 +375,6 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
#+end_src
* VMOCE
** Vertico
#+begin_src emacs-lisp
(use-package vertico
@@ -548,3 +556,13 @@ When in indent-rigidly mode (=+= in normal state), use =H/L= to adjust indent by
:hook
(embark-collect-mode . consult-preview-at-point-mode))
#+end_src
* TODO Git
* TODO Direnv
* Programming
** TODO LSP
** TODO Python
** TODO Web
** TODO Nix