aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2025-03-16 21:40:38 +0100
committerNicholas Rodrigues Lordello <[email protected]>2025-03-16 21:40:38 +0100
commit7604c5aeef469e51e8dd19a514b883e415f462fb (patch)
tree3f44485cc6fc1181fc9200266e796607b5bc3538
parentb9d7af835c5e1cecf11f852dd033f48fac829d07 (diff)
More Emacs Customization
Refactored init.el, got rid of modal editing and added a few more useful packages. Ported code to `lexical-binding: t`.
-rw-r--r--config/emacs/early-init.el12
-rw-r--r--config/emacs/gtd.el14
-rw-r--r--config/emacs/init.el89
-rw-r--r--config/emacs/ligatures.el4
-rw-r--r--config/emacs/meow.el86
-rw-r--r--config/emacs/sanemacs.el20
6 files changed, 95 insertions, 130 deletions
diff --git a/config/emacs/early-init.el b/config/emacs/early-init.el
index 9e6be8e..4036466 100644
--- a/config/emacs/early-init.el
+++ b/config/emacs/early-init.el
@@ -1,17 +1,19 @@
-;;; Go VROOM-VROOM
+;;; -*- lexical-binding: t -*-
+
+;; Go VROOM-VROOM
(setq gc-cons-threshold 10000000)
-;;; Setup the cache directory nice and early; we use it everywhere
+;; Setup the cache directory nice and early; we use it everywhere
(make-directory "~/.cache/emacs" t)
-;;; Configure package.el directories
+;; Configure package.el directories
(setq
package-user-dir "~/.cache/emacs/elpa/"
package-gnupghome-dir "~/.cache/emacs/elpa/gnupg")
-;;; Configure native-comp cache direactory
+;; Configure native-comp cache direactory
(when (boundp 'native-comp-eln-load-path)
(startup-redirect-eln-cache "~/.cache/emacs/eln-cache"))
-;;; Suppress native-comp warnings on startup
+;; Suppress native-comp warnings on startup
(setq warning-suppress-log-types '((comp) (bytecomp)))
diff --git a/config/emacs/gtd.el b/config/emacs/gtd.el
index 9733229..2c910a4 100644
--- a/config/emacs/gtd.el
+++ b/config/emacs/gtd.el
@@ -1,13 +1,13 @@
-;;;
+;;; -*- lexical-binding: t -*-
;;; GTD Org-mode Setup <https://www.labri.fr/perso/nrougier/GTD/index.html>
;;;
(require 'org)
-;;; Configure Org-mode
+;; Configure Org-mode
(setq org-directory "~/Documents/Org")
-;;; Org capture templates
+;; Org capture templates
(setq
org-capture-templates `(
("i" "Inbox" entry (file "inbox.org")
@@ -17,7 +17,7 @@
(interactive)
(org-capture nil "i"))
-;;; Org agenda
+;; Org agenda
(setq
org-agenda-files (list "inbox.org" "projects.org")
org-agenda-hide-tags-regexp "."
@@ -39,13 +39,13 @@
((org-agenda-overriding-header "\nCompleted today\n")))))))
(add-hook 'org-agenda-mode-hook 'delete-other-windows)
-;;; Org refiling
+;; Org refiling
(setq
org-refile-targets '(("projects.org" :regexp . "\\(?:\\(?:Note\\|Task\\)s\\)"))
org-refile-use-outline-path 'file
org-outline-path-complete-in-steps nil)
-;;; Org todo
+;; Org todo
(setq
org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "HOLD(h)" "|" "WONTFIX(x)" "DONE(d)"))
org-log-done 'time)
@@ -56,7 +56,7 @@
(org-entry-put nil "ACTIVATED" (format-time-string "[%Y-%m-%d]"))))
(add-hook 'org-after-todo-state-change-hook #'gtd-log-todo-next-creation-date)
-;;; Key bindings
+;; Key bindings
(define-key global-map (kbd "C-c c") 'org-capture)
(define-key global-map (kbd "C-c i") 'gtd-org-capture-inbox)
(define-key global-map (kbd "C-c a") 'org-agenda)
diff --git a/config/emacs/init.el b/config/emacs/init.el
index d39a80b..9de677e 100644
--- a/config/emacs/init.el
+++ b/config/emacs/init.el
@@ -1,46 +1,89 @@
+;;; -*- lexical-binding:t -*-
+
+;;; TODO(nlordell):
+;; 1. Update remaining init scripts:
+;; (load "~/.config/emacs/gtd.el" nil t)
+;; 2. Emacs over devcontainers/docker with TRAMP
+;; <https://happihacking.com/blog/posts/2023/dev-containers-emacs/>
+;; 3. Investigate other potential sane Emacs defaults
+;; <https://idiomdrottning.org/bad-emacs-defaults>
+;; 4. Setup GPTel - should be possible without FastGPT credits
+;; 5. Resolve ELisp lint issues from Flycheck
+
(load "~/.config/emacs/sanemacs.el" nil t)
(load "~/.config/emacs/ligatures.el" nil t)
-(load "~/.config/emacs/meow.el" nil t)
+
+;;;
+;;; General
+;;;
+
+(use-package ace-window
+ :bind
+ (("C-c o" . ace-window)))
+
+(use-package avy
+ :bind
+ (("C-:" . avy-goto-char)
+ ("M-g f" . avy-goto-line)))
+
+(use-package flycheck
+ :config
+ (add-hook 'after-init-hook #'global-flycheck-mode))
+
+(use-package flycheck-eglot
+ :after (flycheck eglot)
+ :config
+ (global-flycheck-eglot-mode +1))
(use-package ligature
- :ensure t
:config
(ligature-set-ligatures 'prog-mode ligatures-berkeley-mono)
- (global-ligature-mode t))
+ (global-ligature-mode +1))
(use-package magit
- :ensure t)
+ :custom
+ (transient-levels-file "~/.cache/emacs/transient/levels.el")
+ (transient-values-file "~/.cache/emacs/transient/values.el")
+ (transient-history-file "~/.cache/emacs/transient/history.el"))
+
+(use-package projectile
+ :bind-keymap
+ ("C-c p" . projectile-command-map)
+ :custom
+ (projectile-known-projects-file "~/.cache/emacs/projectile-bookmarks.eld")
+ (projectile-project-search-path '(("~/Developer/" . 2)))
+ :config
+ (projectile-mode +1))
-(use-package meow
- :ensure t
+(use-package undo-tree
+ :custom
+ (undo-tree-auto-save-history nil)
:config
- (meow-setup-qwerty)
- (meow-global-mode 1))
+ (global-undo-tree-mode +1))
(use-package which-key
- :ensure t
:config
- (which-key-mode))
+ (which-key-mode +1))
+;;;
;;; OCaml
-(use-package tuareg
- :ensure t)
+;;;
+
+(use-package tuareg)
+
(use-package ocaml-eglot
- :ensure t
- :after tuareg
+ :after (flycheck tuareg)
+ :custom
+ (ocaml-eglot-syntax-checker 'flycheck)
:hook
(tuareg-mode . ocaml-eglot)
(ocaml-eglot . eglot-ensure))
-;;; TODO(nlordell):
-;;; 1. Update remaining init scripts:
-;;; (load "~/.config/emacs/gtd.el" nil t)
-;;; 2. Emacs over devcontainers/docker with TRAMP
-;;; <https://happihacking.com/blog/posts/2023/dev-containers-emacs/>
-;;; 3. Investigate other potential sane Emacs defaults
-;;; <https://idiomdrottning.org/bad-emacs-defaults>
-
-;;; Make the shell environement available when started on macOS Spotlight.
+;;;
+;;; macOS
+;;;
+
+;; Make the shell environement available when started on macOS Spotlight.
(when (memq window-system '(mac ns))
(use-package exec-path-from-shell
:config
diff --git a/config/emacs/ligatures.el b/config/emacs/ligatures.el
index cf98861..428675b 100644
--- a/config/emacs/ligatures.el
+++ b/config/emacs/ligatures.el
@@ -1,4 +1,6 @@
-(defvar
+;;; -*- lexical-binding: t -*-
+
+(defconst
ligatures-berkeley-mono
'(; Group A
".." ".=" "..." "..<" "::" ":::" ":=" "::=" ";;" ";;;" "??" "???" ".?" "?."
diff --git a/config/emacs/meow.el b/config/emacs/meow.el
deleted file mode 100644
index fcdb610..0000000
--- a/config/emacs/meow.el
+++ /dev/null
@@ -1,86 +0,0 @@
-(defun meow-setup-qwerty ()
- "Default QWERTY Meow setup."
- (setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty)
- (meow-motion-overwrite-define-key
- '("j" . meow-next)
- '("k" . meow-prev)
- '("<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-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)
- '("a" . meow-append)
- '("A" . meow-open-below)
- '("b" . meow-back-word)
- '("B" . meow-back-symbol)
- '("c" . meow-change)
- '("d" . meow-delete)
- '("D" . meow-backward-delete)
- '("e" . meow-next-word)
- '("E" . meow-next-symbol)
- '("f" . meow-find)
- '("g" . meow-cancel-selection)
- '("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)
- '("n" . meow-search)
- '("o" . meow-block)
- '("O" . meow-to-block)
- '("p" . meow-yank)
- '("q" . meow-quit)
- '("Q" . meow-goto-line)
- '("r" . meow-replace)
- '("R" . meow-swap-grab)
- '("s" . meow-kill)
- '("t" . meow-till)
- '("u" . meow-undo)
- '("U" . meow-undo-in-selection)
- '("v" . meow-visit)
- '("w" . meow-mark-word)
- '("W" . meow-mark-symbol)
- '("x" . meow-line)
- '("X" . meow-goto-line)
- '("y" . meow-save)
- '("Y" . meow-sync-grab)
- '("z" . meow-pop-selection)
- '("'" . repeat)
- '("<escape>" . ignore)))
diff --git a/config/emacs/sanemacs.el b/config/emacs/sanemacs.el
index 323986d..524eee5 100644
--- a/config/emacs/sanemacs.el
+++ b/config/emacs/sanemacs.el
@@ -1,8 +1,6 @@
-;;;
-;;; Customized Sanemacs <https://sanemacs.com>
-;;;
+;;; -*- lexical-binding: t -*-
-;;; Customize Emacs
+;; Customize Emacs
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
@@ -20,7 +18,7 @@
tab-width 4)
(load-theme 'modus-vivendi)
-;;; Write auto-saves, backups and bookmarks to `.cache` directory
+;; Write auto-saves, backups and bookmarks to `.cache` directory
(setq
auto-save-list-file-prefix "~/.cache/emacs/auto-save/"
auto-save-file-name-transforms '((".*" "~/.cache/emacs/auto-save/" t))
@@ -29,16 +27,22 @@
bookmark-default-file "~/.cache/emacs/bookmarks"
create-lockfiles nil)
-;;; Configure TRAMP
+;; Configure TRAMP
(with-eval-after-load 'tramp-cache
(setq tramp-persistency-file-name "~/.cache/emacs/tramp"))
-;;; Use separate file for custom variables
+;; Use separate file for custom variables
(setq custom-file "~/.cache/emacs/custom.el")
(unless (file-exists-p custom-file)
(write-region "" nil custom-file))
(load custom-file nil t)
-;;; Include MELPA packages
+;; Configure package management
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
+(setq package-archive-priorities
+ '(("gnu" . 42)
+ ("nongnu" . 42)
+ ("melpa" . 0)))
+(require 'use-package)
+(setq use-package-always-ensure t)