commit 647ecbaf3d4aa158f4075b5f0b6e569b01aa745b
parent d4cdc7d1bcfa40fddc7d582fe92671a8c24365a3
Author: dwrz <dwrz@dwrz.net>
Date: Sat, 21 Oct 2023 20:50:18 +0000
Refactor Emacs init to use use-package
Diffstat:
M | emacs/init.el | | | 915 | ++++++++++++++++++++++++++++++++++++++++++++----------------------------------- |
1 file changed, 506 insertions(+), 409 deletions(-)
diff --git a/emacs/init.el b/emacs/init.el
@@ -1,21 +1,22 @@
+;;; init.el --- Summary
+;;; Commentary:
+;;; Emacs configuration.
+;;; Code:
;; C source code variables.
-(setq abbrev-mode t
- auto-save-interval 24
+(setq auto-save-interval 24
delete-by-moving-to-trash t
echo-keystrokes 0.1
enable-recursive-minibuffers t
+ frame-inhibit-implied-resize t
next-screen-context-lines 5
+ load-prefer-newer t
scroll-conservatively 10000
use-dialog-box nil
user-full-name "David Wen Riccardi-Zhu"
ring-bell-function 'ignore
x-stretch-cursor t)
-(set-language-environment "UTF-8")
-
(setq-default fill-column 80
- indent-tabs-mode t
- require-final-newline t
tab-width 8
truncate-lines nil)
@@ -33,7 +34,17 @@
;; Custom
(setq custom-file "~/.cache/custom.el")
-;; FUNCTIONS
+;; Functions
+(defun dwrz-adjust-font-size ()
+ "Set font size based on display pixel width."
+ (interactive)
+ (let ((width (display-pixel-width)))
+ (cond
+ ((<= width 1920) (set-face-attribute 'default t :height 140))
+ ((<= width 2160) (set-face-attribute 'default t :height 160))
+ ((<= width 3180) (set-face-attribute 'default t :height 180))
+ (t (set-face-attribute 'default t :height 160)))))
+;; TODO: (add-hook 'after-make-frame-functions 'dwrz-adjust-font-size)
(defun dwrz-copy-filepath ()
"Copy the current buffer file path to the clipboard."
@@ -86,340 +97,432 @@
(let ((fill-column (point-max)))
(fill-region (region-beginning) (region-end) nil)))
-;; PACKAGES
-(setq load-prefer-newer t)
-
-(require 'package)
-(setq package-archives
- '(("elpa" . "https://elpa.nongnu.org/nongnu/")
- ("gnu" . "https://elpa.gnu.org/packages/")
- ("melpa" . "https://melpa.org/packages/")))
-
-(autoload 'notmuch "notmuch" "Notmuch mail" t)
-
-;; PACKAGE CONFIGURATION
-(with-eval-after-load 'autorevert
- (setq auto-revert-verbose nil
- global-auto-revert-non-file-buffers t))
-
-(with-eval-after-load 'avy
- (setq avy-all-windows 'all-frames
- avy-background t
- avy-case-fold-search nil
- avy-keys '(?a ?o ?e ?u ?h ?t ?n ?s)
- avy-style 'at-full))
+;; Packages
+;; TODO: try corfu, vertico, consult.
+(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
+
+(use-package abbrev :ensure nil :init (abbrev-mode t))
+
+(use-package autorevert
+ :config (setq auto-revert-verbose nil
+ global-auto-revert-non-file-buffers t)
+ :init (global-auto-revert-mode t)
+ :ensure nil)
+
+(use-package avy
+ :bind (("C-c g" . avy-goto-line)
+ ("C-c o" . avy-goto-char))
+ :config (setq avy-all-windows 'all-frames
+ avy-background t
+ avy-case-fold-search nil
+ avy-keys '(?a ?o ?e ?u ?h ?t ?n ?s)
+ avy-style 'at-full)
+ :ensure t)
+
+(use-package base16-theme
+ :config (setq base16-theme-256-color-source 'colors)
+ (load-theme 'base16-tomorrow t)
+ (set-face-attribute 'fringe nil :background "#ffffff")
+ :ensure t)
+
+(use-package bookmark :config (setq bookmark-save-flag 1) :ensure nil)
+
+(use-package calendar
+ :config (setq calendar-chinese-all-holidays-flag t
+ calendar-week-start-day 1
+ diary-file "~/org/diary.org")
+ (calendar-set-date-style 'iso)
+ :ensure nil
+ :functions calendar-set-date-style)
+
+(use-package cc-vars :config (setq-default c-basic-offset 8) :ensure nil)
+
+(use-package company
+ :bind (:map company-active-map
+ ("<return>" . nil)
+ ("<tab>" . company-complete-selection)
+ ("RET". nil))
+ :config
+ (setq company-idle-delay 0
+ company-minimum-prefix-length 1
+ company-tooltip-align-annotations t)
+ (global-company-mode t)
+ :ensure t
+ :hook (company-mode . company-box-mode))
-(with-eval-after-load 'bookmark (setq bookmark-save-flag 1))
+(use-package company-box :ensure t)
-(with-eval-after-load 'calendar
- (setq calendar-chinese-all-holidays-flag t
- calendar-date-style 'iso
- calendar-week-start-day 1
- diary-file "~/org/diary.org"))
+(use-package company-quickhelp
+ :config (setq company-quickhelp-delay 0.25)
+ :ensure t
+ :init (company-quickhelp-mode t))
-(with-eval-after-load 'cc-vars (setq-default c-basic-offset 8))
+(use-package compile
+ :config (setq compilation-message-face 'default)
+ :ensure nil)
-(with-eval-after-load 'company
- (setq company-idle-delay 0
- company-minimum-prefix-length 1
- company-show-numbers t
- company-tooltip-align-annotations t)
- (add-hook 'company-mode-hook 'company-box-mode)
- (define-key company-active-map (kbd "<return>") nil)
- (define-key company-active-map (kbd "RET") nil)
- (define-key company-active-map (kbd "<tab>") 'company-complete-selection))
+(use-package conf-mode :hook (conf-mode . rainbow-mode) :ensure nil)
-(with-eval-after-load 'company-quickhelp (setq company-quickhelp-delay 0.25))
+(use-package csv-mode :mode "\\.csv\\'" :ensure t)
-(with-eval-after-load 'compile compilation-message-face 'default)
+(use-package css-mode :hook (web-mode . css-mode) :ensure nil)
-(with-eval-after-load 'conf-mode (add-hook 'conf-space-mode-hook 'rainbow-mode))
+(use-package delsel :ensure nil :init (delete-selection-mode t))
-(with-eval-after-load 'css-mode (add-hook 'css-mode-hook 'web-mode))
-
-(with-eval-after-load 'dired
- (setq dired-listing-switches "-alh"
- dired-recursive-copies 'always)
+(use-package dired
+ :config (setq dired-listing-switches "-alh"
+ dired-recursive-copies 'always)
(put 'dired-find-alternate-file 'disabled nil)
- (dired-hide-dotfiles-mode))
-
-(with-eval-after-load 'dired-hide-dotfiles
- (define-key dired-mode-map (kbd ".") 'dired-hide-dotfiles-mode))
-
-(with-eval-after-load 'dired-x
- (setq dired-omit-verbose nil
- dired-omit-files (concat dired-omit-files "\\|^\\..+$")
- dired-clean-up-buffers-too t))
-
-(with-eval-after-load 'emacs-lisp-mode
- (add-hook 'emacs-lisp-mode-hook 'eldoc-mode)
- (add-hook 'emacs-lisp-mode-hook
- #'(lambda () (setq indent-tabs-mode nil)))
- (font-lock-add-keywords 'emacs-lisp-mode '(("\\<\\(FIX\\|TODO\\|NB\\)" 1
- font-lock-warning-face t))))
-
-(with-eval-after-load 'faces
- (set-face-attribute
- 'default t
- :family "DejaVu Sans Mono"
- :foundry "PfEd"
- :slant 'normal
- :weight 'normal
- :height 160
- :width 'normal))
-
-(with-eval-after-load 'files
- (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t))
- auto-save-visited-mode t
- backup-directory-alist `((".*" .,temporary-file-directory))
- confirm-kill-emacs 'y-or-n-p))
-
-(with-eval-after-load 'git-commit (setq git-commit-summary-max-length 50))
-
-(with-eval-after-load 'gnutls (setq gnutls-verify-error t))
-
-(with-eval-after-load 'go-mode
- (setenv "GOPATH" "/home/.local/share/go")
- (setq go-tag-args (list "-transform" "camelcase"))
- (add-hook 'go-mode-hook 'lsp)
- (add-hook 'go-mode-hook
- #'(lambda ()
- (set (make-local-variable 'before-save-hook)
- '(lsp-organize-imports
- lsp-format-buffer))))
- (define-key go-mode-map (kbd "C-c C-b") 'pop-tag-mark)
- (define-key go-mode-map (kbd "C-c t") 'go-tag-add)
- (define-key go-mode-map (kbd "C-c T") 'go-tag-remove)
- (font-lock-add-keywords 'go-mode '(("\\<\\(FIX\\|TODO\\|NB\\)" 1
- font-lock-warning-face t))))
-
-(with-eval-after-load 'go-playground
- (setq go-playground-ask-file-name nil
- go-playground-basedir "~/.local/share/go/src/playground/"
- go-playground-go-command "GO111MODULE=auto go"
- go-playground-init-command "go mod init"))
-
-(with-eval-after-load 'ido
- (setq ido-default-buffer-method 'selected-window
- ido-everywhere t
- ido-show-dot-for-dired t
- ido-use-virtual-buffers t
- ido-enable-flex-matching t))
-
-(with-eval-after-load 'isearch (setq isearch-allow-scroll t))
-
-(with-eval-after-load 'ispell
- (setq ispell-program-name "/usr/bin/aspell"
- ispell-dictionary "en_US"
- ispell-extra-args '("--sug-mode=ultra" "--lang=en_US")
- ispell-list-command "--list"
- ispell-dictionary-alist
- '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "['‘’]"
- t ("-d" "en_US") nil utf-8))))
-
-(with-eval-after-load 'js-mode
- (setq js-indent-level 2)
- (add-hook 'js-mode-hook 'lsp))
-
-(with-eval-after-load 'message
- (setq message-directory "drafts"
- message-kill-buffer-on-exit t
- message-sendmail-envelope-from 'header
- message-sendmail-f-is-evil nil))
-
-(with-eval-after-load 'notmuch
- (customize-set-variable 'notmuch-search-oldest-first nil)
- (setq notmuch-address-command 'internal
- notmuch-address-internal-completion '(sent nil)
- notmuch-address-save-filename "~/org/contacts/notmuch-contacts"
- notmuch-address-use-company t
- notmuch-crypto-process-mime t
- notmuch-fcc-dirs "sent"
- notmuch-hello-hide-tags '("spam")
- notmuch-show-all-tags-list t)
- ;; Search tags
- (setq notmuch-saved-searches
- '((:name "inbox" :query "tag:inbox" :key "i")
- (:name "unread" :query "tag:unread" :key "u")
- (:name "new" :query "tag:new" :key "n")
- (:name "sent" :query "tag:sent" :key "e")
- (:name "drafts" :query "tag:draft" :key "d")
- (:name "all mail" :query "*" :key "a")
- (:name "todo" :query "tag:todo" :key "t")))
- ;; Keybindings
- (define-key notmuch-search-mode-map "D"
- (lambda ()
- "mark message as deleted"
- (interactive)
+ (dired-hide-dotfiles-mode t)
+ :ensure nil)
+
+(use-package dired-hide-dotfiles
+ :config (define-key dired-mode-map (kbd ".") 'dired-hide-dotfiles-mode)
+ :ensure t)
+
+(use-package dired-x
+ :config (setq dired-omit-verbose nil
+ dired-omit-files (concat dired-omit-files "\\|^\\..+$")
+ dired-clean-up-buffers-too t)
+ :ensure nil)
+
+(use-package doc-view :config (setq doc-view-resolution 300) :ensure nil)
+
+(use-package doom-modeline :init (doom-modeline-mode t) :ensure t)
+
+(use-package elisp-mode
+ :config (setq-local indent-tabs-mode nil)
+ :hook (emacs-lisp-mode . eldoc-mode)
+ :ensure nil)
+
+(use-package faces
+ :config (set-face-attribute
+ 'default t
+ :family "DejaVu Sans Mono"
+ :foundry "PfEd"
+ :slant 'normal
+ :weight 'normal
+ :height 160
+ :width 'normal)
+ :custom (face-font-family-alternatives
+ '(("hans" "adobe-source-han-sans-cn-font"))))
+
+(use-package files
+ :config (setq auto-save-file-name-transforms
+ `((".*" ,temporary-file-directory t))
+ auto-save-visited-mode t
+ backup-directory-alist `((".*" .,temporary-file-directory))
+ confirm-kill-emacs 'y-or-n-p)
+ (setq-default require-final-newline t)
+ :ensure nil)
+
+(use-package flycheck :ensure t)
+
+(use-package frame :config (window-divider-mode -1) :ensure nil)
+
+(use-package git-commit
+ :config (setq git-commit-summary-max-length 50)
+ :defer t
+ :ensure t)
+
+(use-package gnutls :config (setq gnutls-verify-error t) :ensure nil)
+
+(use-package go-mode
+ :bind (:map go-mode-map
+ ("C-c C-b" . pop-tag-mark)
+ ("C-c t" . go-tag-add)
+ ("C-c T" . go-tag-remove))
+ :ensure t
+ :hook ((go-mode . lsp)
+ (go-mode . (lambda () (set (make-local-variable 'before-save-hook)
+ '(lsp-organize-imports lsp-format-buffer))))))
+
+(use-package go-playground
+ :config (setq go-playground-ask-file-name nil
+ go-playground-basedir "~/.local/share/go/src/playground/"
+ go-playground-go-command "GO111MODULE=auto go"
+ go-playground-init-command "go mod init")
+ :defer t
+ :ensure t)
+
+(use-package go-tag
+ :config (setq go-tag-args (list "-transform" "camelcase"))
+ :ensure t)
+
+(use-package hl-line
+ :config
+ (global-hl-line-mode t)
+ :ensure nil)
+
+(use-package hydra :ensure t)
+
+(use-package icomplete :init (fido-vertical-mode) :ensure nil)
+
+(use-package ido
+ :config (setq ido-default-buffer-method 'selected-window
+ ido-everywhere t
+ ido-show-dot-for-dired t
+ ido-use-virtual-buffers t
+ ido-enable-flex-matching t)
+ :ensure nil)
+
+(use-package isearch :config (setq isearch-allow-scroll t) :ensure nil)
+
+(use-package ispell
+ :config (setq ispell-program-name "/usr/bin/aspell"
+ ispell-dictionary "en_US"
+ ispell-extra-args '("--sug-mode=ultra" "--lang=en_US")
+ ;; ispell-list-command "--list"
+ ispell-dictionary-alist
+ '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "['‘’]"
+ t ("-d" "en_US") nil utf-8)))
+ :ensure t)
+
+(use-package jka-cmpr-hook :init (auto-compression-mode t) :ensure nil)
+
+(use-package js-mode
+ :config (setq js-indent-level 2)
+ :defines js-indent-level
+ :hook (js-mode . lsp)
+ :ensure nil)
+
+(use-package ledger-mode :ensure t)
+
+(use-package lsp-mode :ensure t)
+
+(use-package magit :bind ("C-x g" . magit-status) :ensure t)
+
+(use-package marginalia :init (marginalia-mode t) :defer t :ensure t)
+
+(use-package markdown-mode :ensure t)
+
+(use-package menu-bar :config (menu-bar-mode -1) :ensure nil)
+
+(use-package message
+ :config (setq message-directory "drafts"
+ message-kill-buffer-on-exit t
+ message-sendmail-envelope-from 'header
+ message-sendmail-f-is-evil nil))
+
+(use-package mule
+ :config
+ (set-terminal-coding-system 'utf-8)
+ (set-keyboard-coding-system 'utf-8)
+ :ensure nil)
+
+(use-package mule-cmds
+ :preface (provide 'mule-cmds)
+ :config
+ (set-language-environment 'UTF-8)
+ :ensure nil)
+
+(use-package mwheel
+ :custom (mouse-wheel-scroll-amount '(1 ((shift) .1)))
+ :ensure nil)
+
+(use-package nerd-icons :ensure t)
+
+(use-package notmuch
+ :bind (("C-x m" . notmuch)
+ :map notmuch-search-mode-map
+ ("D" . (lambda () "mark message as deleted" (interactive)
(notmuch-search-tag (list "-new" "-unread" "-inbox" "+deleted"))
(forward-line)))
- (define-key notmuch-show-mode-map "D"
- (lambda ()
- "mark message as deleted"
- (interactive)
- (notmuch-show-tag (list "-new" "-unread" "-inbox" "+deleted"))))
- (define-key notmuch-search-mode-map "S"
- (lambda ()
- "mark message as spam"
- (interactive)
+ ("S" . (lambda () "mark message as spam" (interactive)
(notmuch-search-tag (list "-new" "-unread" "-inbox" "+spam"))
(forward-line)))
- (define-key notmuch-show-mode-map "S"
- (lambda ()
- "mark message as spam"
- (interactive)
- (notmuch-show-tag (list "-new" "-unread" "-inbox" "+spam"))))
- (define-key notmuch-search-mode-map "N"
- (lambda ()
- "unmark message as new and unread"
- (interactive)
+ ("N" . (lambda () "unmark message as new and unread" (interactive)
(notmuch-search-tag (list "-new" "-unread"))
(forward-line)))
- (define-key notmuch-show-mode-map "N"
- (lambda ()
- "unmark message as new and unread"
- (interactive)
- (notmuch-show-tag (list "-new" "-unread"))))
- (define-key notmuch-show-mode-map "r" 'notmuch-show-reply)
- (define-key notmuch-show-mode-map "R" 'notmuch-show-reply-sender)
- (define-key notmuch-search-mode-map "r" 'notmuch-search-reply-to-thread)
- (define-key notmuch-search-mode-map "R"
- 'notmuch-search-reply-to-thread-sender))
-
-(with-eval-after-load 'novice ())
-
-(with-eval-after-load 'ol
- (require 'ol-notmuch)
+ ("r" . notmuch-search-reply-to-thread)
+ ("R" . notmuch-search-reply-to-thread-sender)
+ :map notmuch-show-mode-map
+ ("D" . (lambda () "mark message as deleted" (interactive)
+ (notmuch-show-tag
+ (list "-new" "-unread" "-inbox" "+deleted"))))
+ ("S" . (lambda () "mark message as spam" (interactive)
+ (notmuch-show-tag (list "-new" "-unread" "-inbox" "+spam"))))
+ ("N" . (lambda () "unmark message as new and unread" (interactive)
+ (notmuch-show-tag (list "-new" "-unread"))))
+ ("r" . notmuch-show-reply)
+ ("R" . notmuch-show-reply-sender))
+ :config (customize-set-variable 'notmuch-search-oldest-first nil)
+ (setq notmuch-address-command 'internal
+ notmuch-address-internal-completion '(sent nil)
+ notmuch-address-save-filename "~/org/contacts/notmuch-contacts"
+ notmuch-address-use-company t
+ notmuch-crypto-process-mime t
+ notmuch-fcc-dirs "sent"
+ notmuch-hello-hide-tags '("spam")
+ notmuch-show-all-tags-list t)
+ (setq notmuch-saved-searches
+ '((:name "inbox" :query "tag:inbox" :key "i")
+ (:name "unread" :query "tag:unread" :key "u")
+ (:name "new" :query "tag:new" :key "n")
+ (:name "sent" :query "tag:sent" :key "e")
+ (:name "drafts" :query "tag:draft" :key "d")
+ (:name "all mail" :query "*" :key "a")
+ (:name "todo" :query "tag:todo" :key "t")))
+ :defines notmuch-search-tag notmuch-show-tag)
+
+(use-package novice :ensure nil) ;; TODO: disable.
+
+(use-package ol
+ :config (require 'ol-notmuch)
(setq org-link-frame-setup
- '((vm . vm-visit-folder-other-frame)
- (vm-imap . vm-visit-imap-folder-other-frame)
- (gnus . org-gnus-no-new-news)
- (file . find-file)
- (wl . wl-other-frame))))
-
-(with-eval-after-load 'org
- (setq org-adapt-indentation nil
- org-export-backends '(ascii html icalendar latex md odt)
- org-catch-invisible-edits 'show
- org-fontify-done-headline t
- org-default-priority 1
- org-enforce-todo-dependencies t
- org-hide-emphasis-markers t
- org-highest-priority 1
- org-image-actual-width '(800)
- org-list-demote-modify-bullet nil
- org-log-into-drawer t
- org-lowest-priority 3
- org-refile-targets '((nil :maxlevel . 8))
- org-src-fontify-natively t
- org-tags-column 0
- org-todo-keywords '((sequence "NEXT(n)"
- "IN-PROGRESS(i)" "RECURRING(r)"
- "WAITING(w)" "|" "SOMEDAY-MAYBE(s)"
- "EVENT(v)" "DELEGATED(e)" "CANCELED(c)"
- "DONE(d)")))
- (add-hook 'org-babel-after-execute-hook
- (lambda () (when org-inline-image-overlays
- (org-redisplay-inline-images))))
- (add-hook 'org-mode-hook (lambda () (electric-indent-local-mode -1)))
- (add-hook 'org-mode-hook 'flyspell-mode)
- (add-hook 'org-mode-hook
- '(lambda () (set (make-local-variable 'company-backends)
- '((company-capf company-yasnippet
- company-files)))))
- (define-key org-mode-map (kbd "<M-right>") nil)
- (define-key org-mode-map (kbd "<M-left>") nil)
+ '((vm . vm-visit-folder-other-frame)
+ (vm-imap . vm-visit-imap-folder-other-frame)
+ (gnus . org-gnus-no-new-news)
+ (file . find-file)
+ (wl . wl-other-frame)))
+ :ensure nil)
+
+(use-package ol-notmuch :ensure t)
+
+(use-package org
+ :bind (:map org-mode-map
+ ("<M-right>" . nil)
+ ("<M-left>" . nil))
+ :config (setq org-adapt-indentation nil
+ org-export-backends '(ascii html icalendar latex md odt)
+ org-fold-catch-invisible-edits 'show
+ org-fontify-done-headline t
+ org-default-priority 1
+ org-enforce-todo-dependencies t
+ org-hide-emphasis-markers t
+ org-highest-priority 1
+ org-image-actual-width '(800)
+ org-list-demote-modify-bullet nil
+ org-log-into-drawer t
+ org-lowest-priority 3
+ org-src-fontify-natively t
+ org-tags-column 0
+ org-todo-keywords '((sequence "NEXT(n)"
+ "IN-PROGRESS(i)" "RECURRING(r)"
+ "WAITING(w)" "|"
+ "SOMEDAY-MAYBE(s)"
+ "EVENT(v)" "DELEGATED(e)"
+ "CANCELED(c)"
+ "DONE(d)")))
(org-babel-do-load-languages
'org-babel-load-languages
'((awk .t ) (calc . t) (C . t) (emacs-lisp . t) (gnuplot . t) (js . t)
(latex . t) (makefile .t )(org . t) (python . t)
- (shell . t) (sed .t) (sql . t) (sqlite . t))))
-
-(with-eval-after-load 'org-agenda
- (setq org-agenda-follow-indirect nil
- org-agenda-include-diary t
- org-agenda-prefix-format '((agenda . " %i %?-12t% s")
- (timeline . " % s")
- (todo . " %i")
- (tags . " %i")
- (search . " %i"))
- org-agenda-span 'month
- org-agenda-tags-column 'auto
- org-agenda-use-time-grid nil
- org-agenda-window-setup 'current-window)
- (cond ((string-equal (system-name) "main.dwrz.net")
- (setq org-agenda-files '("~/org/dwrz.org"
- "~/org/someday-maybe.org"
- "~/projects/career/career.org"
- "~/projects/chimerical/chimerical.org"
- "~/projects/chinese/chinese.org"
- "~/projects/community/community.org"
- "~/projects/finances/finances.org"
- "~/projects/health/health.org"
- "~/projects/home/home.org"
- "~/projects/rz/rz.org"
- "~/projects/src/src.org"
- "~/projects/wish/wish.org")
- org-archive-location
- "~/org/archive.org::"))))
-
-(with-eval-after-load 'org-capture
- (setq org-capture-templates
- '(("e" "log entry" plain
- (file "")
- (file "~/org/templates/log-entry.org")
- :jump-to-captured t)
- ("j" "journal" entry
- (file "")
- (file "~/org/templates/journal.org")
- :prepend t
- :jump-to-captured t
- :empty-lines-before 1
- :empty-lines-after 1)
- ("l" "log" entry
- (file "")
- (file "~/org/templates/log.org")
- :prepend t
- :jump-to-captured t
- :empty-lines-after 1)
- ("n" "note" entry
- (file "")
- (file "~/org/templates/note.org")
- :prepend t
- :jump-to-captured t
- :empty-lines-before 1
- :empty-lines-after 1))))
-
-(with-eval-after-load 'org-faces
- (setq org-priority-faces
- '((?1 . (:foreground "#c82829" :weight 'bold))
- (?2 . (:foreground "#eab700"))
- (?3 . (:foreground "#718c00"))))
+ (shell . t) (sed .t) (sql . t) (sqlite . t)))
+ :functions org-redisplay-inline-images
+ :hook ((org-mode . flyspell-mode)
+ (org-babel-after-execute . (lambda ()
+ (when org-inline-image-overlays
+ (org-redisplay-inline-images)))))
+ :ensure nil)
+
+(use-package org-agenda
+ :config (setq org-agenda-files '("~/org/dwrz.org"
+ "~/org/someday-maybe.org"
+ "~/projects/career/career.org"
+ "~/projects/chimerical/chimerical.org"
+ "~/projects/chinese/chinese.org"
+ "~/projects/community/community.org"
+ "~/projects/finances/finances.org"
+ "~/projects/health/health.org"
+ "~/projects/home/home.org"
+ "~/projects/rz/rz.org"
+ "~/projects/src/src.org"
+ "~/projects/wish/wish.org")
+ org-agenda-follow-indirect nil
+ org-agenda-include-diary t
+ org-agenda-prefix-format '((agenda . " %i %?-12t% s")
+ (timeline . " % s")
+ (todo . " %i")
+ (tags . " %i")
+ (search . " %i"))
+ org-agenda-span 'month
+ org-agenda-tags-column 'auto
+ org-agenda-use-time-grid nil
+ org-agenda-window-setup 'current-window
+ org-archive-location
+ "~/org/archive.org::")
+ :ensure nil)
+
+(use-package org-capture
+ :config (setq org-capture-templates
+ '(("e" "log entry" plain
+ (file "")
+ (file "~/org/templates/log-entry.org")
+ :jump-to-captured t)
+ ("j" "journal" entry
+ (file "")
+ (file "~/org/templates/journal.org")
+ :prepend t
+ :jump-to-captured t
+ :empty-lines-before 1
+ :empty-lines-after 1)
+ ("l" "log" entry
+ (file "")
+ (file "~/org/templates/log.org")
+ :prepend t
+ :jump-to-captured t
+ :empty-lines-after 1)
+ ("n" "note" entry
+ (file "")
+ (file "~/org/templates/note.org")
+ :prepend t
+ :jump-to-captured t
+ :empty-lines-before 1
+ :empty-lines-after 1)))
+ :ensure nil)
+
+(use-package org-faces
+ :config (setq org-priority-faces
+ '((?1 . (:foreground "#c82829"))
+ (?2 . (:foreground "#eab700"))
+ (?3 . (:foreground "#718c00"))))
(setq org-todo-keyword-faces
- '(("NEXT" . "#c82829")
- ("IN-PROGRESS" . "#718c00")
- ("RECURRING" . "#f5871f")
- ("WAITING" . "#eab700")
- ("DONE" . "#4271ae")
+ '(("NEXT" . "#c82829")
+ ("IN-PROGRESS" . "#718c00")
+ ("RECURRING" . "#f5871f")
+ ("WAITING" . "#eab700")
+ ("DONE" . "#4271ae")
("EVENT" . "#3e999f")
- ("DELEGATED" . "#969896")
- ("CANCELED" . "#a3685a")
- ("SOMEDAY-MAYBE" . "#8959a8"))))
-
-(with-eval-after-load 'org-src
- (setq org-src-preserve-indentation t
- org-src-tab-acts-natively t))
-
-(with-eval-after-load 'paragraphs (setq sentence-end-double-space nil))
-
-(with-eval-after-load 'prog-mode
- (add-hook 'prog-mode-hook 'flycheck-mode)
- (add-hook 'prog-mode-hook 'flyspell-prog-mode)
- (add-hook 'prog-mode-hook 'rainbow-mode)
- (add-hook 'prog-mode-hook 'visual-line-mode))
-
-(with-eval-after-load 'register
- (set-register ?c '(file . "~/.config/"))
+ ("DELEGATED" . "#969896")
+ ("CANCELED" . "#a3685a")
+ ("SOMEDAY-MAYBE" . "#8959a8")))
+ :ensure nil)
+
+(use-package org-src
+ :config (setq org-src-preserve-indentation t
+ org-src-tab-acts-natively t)
+ :ensure nil)
+
+(use-package osm :init (with-eval-after-load 'org (require 'osm-ol)) :ensure t)
+
+(use-package paragraphs
+ :config (setq sentence-end-double-space nil)
+ :ensure nil
+ :preface (provide 'paragraphs))
+
+(use-package paren :config (show-paren-mode t) :ensure nil)
+
+(use-package prog-mode
+ :config (font-lock-add-keywords 'emacs-lisp-mode
+ '(("\\<\\(FIX\\|TODO\\|NB\\)" 1
+ font-lock-warning-face t)))
+ :hook ((prog-mode . flycheck-mode)
+ (prog-mode . flyspell-prog-mode)
+ (prog-mode . rainbow-mode)
+ (prog-mode . visual-line-mode))
+ :ensure nil)
+
+(use-package rainbow-mode :ensure t)
+
+(use-package recentf
+ :config (recentf-mode t)
+ :init (setq recentf-max-menu-items 100
+ recentf-max-saved-items 100)
+ :ensure nil)
+
+(use-package register
+ :config (set-register ?c '(file . "~/.config/"))
(set-register ?d '(file . "~/org/diary.org"))
(set-register ?f '(file . "~/projects/finances/finances.org"))
(set-register ?g '(file . "~/org/gtd.org"))
@@ -427,91 +530,88 @@
(set-register ?j '(file . "~/journal/2023/2023.org"))
(set-register ?o '(file . "~/org/dwrz.org")))
-(with-eval-after-load 'select
- (setq select-enable-primary t
- select-enable-clipboard t))
-
-(with-eval-after-load 'sendmail
- (setq mail-specify-envelope-from t
- mail-envelope-from 'header
- mail-specify-envelope-from t
- send-mail-function 'sendmail-send-it))
-
-(with-eval-after-load 'sh-script (setq sh-basic-offset 2))
-
-(with-eval-after-load 'simple
- (setq async-shell-command-buffer "new-buffer"
- backward-delete-char-untabify-method nil
- mail-user-agent 'message-user-agent
- shift-select-mode nil)
- (add-hook 'visual-line-mode-hook 'visual-fill-column-mode))
-
-(with-eval-after-load 'sql-mode
- (add-hook 'sql-mode 'sqlind-minor-mode)
- (setq sqlind-basic-offset 4))
-
-(with-eval-after-load 'subr-x (defalias 'yes-or-no-p 'y-or-n-p))
-
-(with-eval-after-load 'text-mode
- (add-hook 'text-mode-hook 'flyspell-mode)
- (add-hook 'text-mode-hook 'rainbow-mode)
- (add-hook 'text-mode-hook 'visual-line-mode))
-
-(with-eval-after-load 'time (setq display-time-mode nil))
-
-(with-eval-after-load 'visual-fill-column
- (setq split-window-preferred-function
- 'visual-fill-column-split-window-sensibly))
-
-(with-eval-after-load 'web-mode
- (setq web-mode-code-indent-offset 2
- web-mode-css-indent-offset 2
- web-mode-indent-style 2
- web-mode-markup-indent-offset 2)
- (add-hook 'web-mode-hook 'electric-pair-mode))
-
-(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
-(add-to-list 'auto-mode-alist '("\\.gohtml\\'" . web-mode))
-
-(with-eval-after-load 'window
- (setq split-height-threshold nil
- split-width-threshold 160))
-
-;; CUSTOMIZE
-(customize-set-variable 'face-font-family-alternatives
- '(("hans" "adobe-source-han-sans-cn-font")))
-(customize-set-variable 'mouse-wheel-scroll-amount '(1 ((shift) .1)))
-
-;; HOOKS
-(add-hook 'after-init-hook 'doom-modeline-mode)
-(add-hook 'after-init-hook
- #'(lambda ()
- (setq base16-theme-256-color-source 'colors)
- (load-theme 'base16-tomorrow t)
- (set-face-attribute 'fringe t :background "#ffffff")
- (setq base16-distinct-fringe-background nil)
- (when (fboundp 'menu-bar-mode)(menu-bar-mode -1))
- (when (fboundp 'scroll-bar-mode)(scroll-bar-mode -1))
- (when (fboundp 'tool-bar-mode)(tool-bar-mode -1))
- (when (fboundp 'window-divider-mode)(window-divider-mode -1))))
-(add-hook 'before-save-hook 'delete-trailing-whitespace)
-
-;; PACKAGE ENABLE
-(auto-compression-mode)
-(column-number-mode)
-(company-quickhelp-mode)
-(delete-selection-mode)
-(fido-vertical-mode)
-(global-auto-revert-mode)
-(global-company-mode)
-(global-hl-line-mode)
-(global-subword-mode)
-(marginalia-mode)
-(savehist-mode)
-(show-paren-mode)
-(size-indication-mode)
-
-;; HYDRAS
+(use-package scroll-bar :config (scroll-bar-mode -1) :ensure nil)
+
+(use-package select
+ :config (setq select-enable-primary t
+ select-enable-clipboard t)
+ :ensure nil)
+
+(use-package savehist :init (savehist-mode t) :ensure nil)
+
+(use-package sendmail
+ :config (setq mail-specify-envelope-from t
+ mail-envelope-from 'header
+ mail-specify-envelope-from t
+ send-mail-function 'sendmail-send-it)
+ :ensure nil)
+
+(use-package sh-script :config (setq sh-basic-offset 2) :ensure nil)
+
+(use-package simple
+ :config (setq async-shell-command-buffer "new-buffer"
+ backward-delete-char-untabify-method nil
+ mail-user-agent 'message-user-agent
+ shift-select-mode nil)
+ (setq-default indent-tabs-mode t)
+ (column-number-mode t)
+ (size-indication-mode t)
+ :ensure nil)
+
+(use-package sql-mode :hook (sql-mode . sqlind-minor-mode) :ensure nil)
+
+;; TODO: see if this can be replaced with sql-linter-program.
+(use-package sql-indent :config (setq sqlind-basic-offset 4) :ensure t)
+
+(use-package subword :init (global-subword-mode t) :ensure nil)
+
+(use-package subr
+ :hook (before-save . delete-trailing-whitespace)
+ :ensure nil)
+
+(use-package subr-x :init (defalias 'yes-or-no-p 'y-or-n-p) :ensure nil)
+
+(use-package text-mode
+ :hook ((text-mode . flyspell-mode)
+ (text-mode . rainbow-mode)
+ (text-mode . visual-line-mode))
+ :ensure nil)
+
+(use-package textsize
+ :config (setq textsize-default-points 19)
+ :ensure t
+ :init (textsize-mode t))
+
+(use-package time :init (setq display-time-mode nil) :ensure nil)
+
+(use-package toc-org :ensure t)
+
+(use-package tool-bar :config (tool-bar-mode -1) :ensure nil)
+
+(use-package visual-fill-column
+ :config (setq split-window-preferred-function
+ 'visual-fill-column-split-window-sensibly)
+ :ensure t
+ :hook (visual-line-mode . visual-fill-column-mode))
+
+(use-package web-mode
+ :config (setq web-mode-code-indent-offset 2
+ web-mode-css-indent-offset 2
+ web-mode-indent-style 2
+ web-mode-markup-indent-offset 2)
+ :mode (("\\.html?\\'" . web-mode)
+ ("\\.gohtml\\'" . web-mode))
+ :ensure t)
+
+(use-package wgrep :ensure t)
+
+(use-package window
+ :config (setq split-height-threshold nil
+ split-width-threshold 160)
+ :ensure nil)
+
+;; Hydras
+;; TODO: add, clean.
(defhydra hydra-highlight (:color blue)
("q" nil "quit" :column "highlight")
("s" highlight-symbol-at-point "symbol" :color blue :column "do")
@@ -564,15 +664,13 @@
(global-set-key (kbd "C-c d") nil)
(global-set-key (kbd "C-c e") 'execute-extended-command)
(global-set-key (kbd "C-c f") nil)
-(global-set-key (kbd "C-c g") 'avy-goto-line)
(global-set-key (kbd "C-c h") 'hippie-expand)
(global-set-key (kbd "C-c i") nil)
(global-set-key (kbd "C-c j") 'jump-to-register)
(global-set-key (kbd "C-c k") nil)
(global-set-key (kbd "C-c l") 'org-store-link)
-(global-set-key (kbd "C-c m") 'hydra-map-hydra/body)
+(global-set-key (kbd "C-c m") nil)
(global-set-key (kbd "C-c n") 'hydra-meta-hydra/body)
-(global-set-key (kbd "C-c o") 'avy-goto-char)
(global-set-key (kbd "C-c p") 'hydra-point/body)
(global-set-key (kbd "C-c q") nil)
(global-set-key (kbd "C-c r") 'hydra-region/body)
@@ -588,6 +686,5 @@
(global-set-key (kbd "C-r") 'rgrep)
(global-set-key (kbd "C-x 9") 'dwrz-split-window-two-thirds)
(global-set-key (kbd "C-x C-b") 'ibuffer)
-(global-set-key (kbd "C-x g") 'magit-status)
-(global-set-key (kbd "C-x m") 'notmuch)
(global-set-key (kbd "C-x t") 'dwrz-shell-in-current-directory)
+;;; init.el ends here