.emacs.d

the most bloated Emacs config on this planet
git clone https://git.trogloxene.org/.emacs.d.git
Log | Files | Refs

commit 2be4817ec4ddafed297afdc3cdb30158be982bfd
parent c4083e2bb4b099894f2e4a5ad88ade1ab9933c91
Author: andsy10 <andsy1016@gmail.com>
Date:   Sat, 22 Aug 2026 00:44:58 +0800

Cleanup and remove unused configuration

Diffstat:
Mlisp/init-completion.el | 14+++++++++-----
Mlisp/init-elpa.el | 1+
Mlisp/init-kbd-func.el | 40+++++++++++++++++++++++++++++++++++-----
Mlisp/init-kbd.el | 24+++++++++++++++++++-----
Mlisp/init-org.el | 51+++++++++++++++++++++++++++++----------------------
Mlisp/init-package.el | 9++-------
Mlisp/init-prog.el | 6------
Mlisp/init-startup.el | 2+-
Mlisp/init-terminal.el | 10+++++-----
Mlisp/my-dark-theme.el | 3+--
Mlisp/my-light-theme.el | 4++--
11 files changed, 104 insertions(+), 60 deletions(-)

diff --git a/lisp/init-completion.el b/lisp/init-completion.el @@ -167,11 +167,11 @@ targets." (add-hook 'org-mode-hook (lambda () (setq-local corfu-auto nil)))) -(if (not (and (display-graphic-p) - (>= emacs-major-version 31))) - (use-package corfu-terminal - :hook - (after-init . corfu-terminal-mode))) +(unless (or (display-graphic-p) + (>= emacs-major-version 31)) + (use-package corfu-terminal + :hook + (after-init . corfu-terminal-mode))) ;; cape (use-package cape @@ -195,6 +195,10 @@ targets." (add-hook 'completion-at-point-functions #'cape-elisp-symbol nil t)) (add-hook 'org-mode-hook #'my-org-completion-setup) + (defun my-minibuffer-completion-setup () + (setq-local completion-at-point-functions nil)) + (add-hook 'minibuffer-mode-hook 'my-minibuffer-completion-setup) + :config (setf (alist-get 'org-mode cape-elisp-symbol-wrapper) '(?= ?=))) diff --git a/lisp/init-elpa.el b/lisp/init-elpa.el @@ -34,6 +34,7 @@ (setq use-package-always-defer t use-package-expand-minimally t use-package-verbose nil + use-package-compute-statistics t straight-use-package-version t straight-use-package-by-default t) diff --git a/lisp/init-kbd-func.el b/lisp/init-kbd-func.el @@ -31,6 +31,22 @@ (interactive) (message (format-time-string "%Y-%m-%d %H:%M UTC" nil t))) +(defun my-display-init-time () + (interactive) + (message "Emacs loaded in %s." (emacs-init-time))) + + +(defun my-straight-packages-count () + "Count how many straight.el package are currently installed." + (interactive) + (message (format "%s packages installed" (hash-table-count straight--profile-cache)))) + +(defun my-insert-straight-packages-as-org-list () + "Insert straight.el packages as org-mode list." + (interactive) + (dolist (item (hash-table-keys straight--profile-cache)) + (insert (format "- %s\n" item)))) + (defun my-elfeed-search-show-entry-other-window () "Like `elfeed-search-show-entry' but show the elfeed entry buffer in another window." (interactive) @@ -45,7 +61,7 @@ (let ((display-buffer-alist '(("\\*elfeed-entry\\*" (display-buffer-reuse-window display-buffer-pop-up-window)))) - (current-prefix-arg t)) + (current-prefix-arg '(4))) (call-interactively #'elfeed-search-show-entry))) (defun my-jinx-smart-toggle () @@ -142,8 +158,22 @@ otherwise toggle global-jinx-mode." (defun my-denote-find-file () "Find file use denote-file-prompt." (interactive) - (let ((denote-excluded-files-regexp "=journal\\|=archive")) - (find-file (denote-file-prompt)))) + (let* ((denote-excluded-files-regexp "=journal\\|=archive") + (file (denote-file-prompt))) + (find-file file))) + +(defun my-blog-find-file () + "Find blog file use denote-file-prompt." + (interactive) + (let* ((denote-directory my-blog-directory) + (denote-excluded-files-regexp "_about") + (file (denote-file-prompt))) + (find-file file))) + +(defun my-blog-grep () + "Run `consult-grep' in `my-blog-directory'." + (interactive) + (consult-grep my-blog-directory)) (defun my-denote-find-backlink-with-location () "Like `denote-find-backlink-with-location' but with consult preview." @@ -198,9 +228,9 @@ otherwise toggle global-jinx-mode." (my-push-with-timestamp "~/org/my-org-note/")) (defun my-org-publish () - "Git add/commit/push in `~/org/blog/posts/'." + "Git add/commit/push in `my-blog-directory'." (interactive) - (my-push-with-timestamp "~/org/blog/posts/")) + (my-push-with-timestamp my-blog-directory)) (defun my-org-tree-slide-start () "Start `org-tree-slide'." diff --git a/lisp/init-kbd.el b/lisp/init-kbd.el @@ -47,7 +47,7 @@ "l" #'global-tab-line-mode "d" #'disable-theme "R" #'rainbow-mode - "b" #'indent-bars-mode + "i" #'indent-bars-mode "t" #'consult-theme "c" #'consult-colors-emacs "f" #'describe-face @@ -55,6 +55,13 @@ "k" #'keycast-header-line-mode "w" #'global-whitespace-mode) +;; w for whitespace +(general-def + :prefix "C-c w" + "f" #'fixup-whitespace + "r" #'whitespace-report + "o" #'global-whitespace-toggle-options) + ;; f for find and consult command (general-def :prefix "C-c f" @@ -106,7 +113,9 @@ (general-def :prefix "C-c o" "f" #'my-denote-find-file + "F" #'my-blog-find-file "g" #'consult-denote-grep + "G" #'my-blog-grep "s" #'consult-org-agenda "C" #'calendar "c" #'org-capture @@ -162,6 +171,12 @@ "f" #'elfeed "k" #'pass) +;; C-d for document +(general-def (emacs-lisp-mode-map lisp-interaction-mode-map) + :prefix "C-c C-d" + "C-d" #'helpful-at-point + "C-a" #'apropos) + ;; scratch buffer (if *is-mac* (general-def "C-c <f12>" #'scratch-buffer) @@ -169,6 +184,7 @@ ;; dired (general-def (dired-mode-map dirvish-mode-map) + "TAB" #'dirvish-subtree-toggle "s" #'dirvish-quicksort "h" #'dirvish-history-menu "M-," #'scroll-other-window-down @@ -183,7 +199,7 @@ "C-/" #'dired-undo "<SPC>" #'my-dirvish-layout-toggle "C-c C-r" #'dired-rsync - "e" #'dired-do-eww) + "e" #'ediff) (general-def (dired-mode-map dirvish-mode-map) :prefix "C-c d" @@ -351,7 +367,7 @@ "C-c e" #'er/expand-region "C-c c" #'hydra-multiple-cursors/body "C-S-<mouse-1>" #'mc/add-cursor-on-click - "C-x :" #'comment-kill + "C-c k" #'comment-kill "M-z" #'avy-zap-to-char-dwim "M-Z" #'avy-zap-up-to-char-dwim @@ -361,8 +377,6 @@ "C-x u" #'vundo ;; navigate - "C-c v" #'scroll-other-window - "C-c M-v" #'scroll-other-window-down "M-p" #'backward-paragraph "M-n" #'forward-paragraph "<mouse-2>" #'xref-find-definitions-at-mouse diff --git a/lisp/init-org.el b/lisp/init-org.el @@ -18,14 +18,34 @@ (*is-linux* "~/org/my-org-note") (*is-android* "~/storage/shared/my-org-note"))) + (defvar my-blog-directory + (cond + (*is-windows* "h:/emacs/blog/posts") + (*is-mac* "~/org/blog/posts/") + (*is-linux* "~/org/blog/posts/") + (*is-android* "~/org/blog/posts/"))) + :config - (defun my-org-tab-complete-on-keyword-line () - (when (save-excursion - (beginning-of-line) - (looking-at-p "[ \t]*#\\+")) - (let ((completion-at-point-functions '(pcomplete-completions-at-point t))) - (completion-at-point)))) - (add-hook 'org-cycle-tab-first-hook #'my-org-tab-complete-on-keyword-line) + (defun my-org-tab-complete () + (cond ((or (save-excursion + (beginning-of-line) + (looking-at-p "[ \t]*#\\+")) + (looking-back "\\[\\[\\*" 3)) + (let ((completion-at-point-functions '(pcomplete-completions-at-point t))) + (completion-at-point))) + ((or (org-at-heading-p) + (org-in-src-block-p)) + nil) + ((or (save-excursion + (backward-sexp) + (looking-at-p "=")) + (save-excursion + (backward-sexp) + (looking-at-p "~"))) + (let ((completion-at-point-functions '(cape-elisp-symbol cape-file t))) + (completion-at-point))) + (t nil))) + (add-hook 'org-cycle-tab-first-hook #'my-org-tab-complete) (defvar org-hide-space-keywords '(("\\cc\\( \\)[*/_=~+]\\cc.*?[*/_=~+]" @@ -38,9 +58,6 @@ (add-to-list 'org-src-lang-modes '("json" . json-ts)) (add-to-list 'org-src-lang-modes '("toml" . toml-ts)) - (if *is-windows* - (add-hook 'org-mode-hook 'font-lock-update)) - ;; show inline images (setq org-startup-with-inline-images 'inlineimages) @@ -76,17 +93,6 @@ :init (setq org-startup-truncated nil)) -;; org-babel scheme -(use-package ob-scheme - :demand t - :after org - :straight nil - :config - (add-to-list 'org-babel-load-languages '(scheme . t)) - (org-babel-do-load-languages - 'org-babel-load-languages - org-babel-load-languages)) - ;; denote (use-package denote :hook @@ -213,9 +219,10 @@ ;; capture (use-package org-capture :straight nil - :config + :init (setq my-org-capture-file (concat org-directory "/20260509T232442==agenda--all-my-todos.org")) (setq my-org-capture-game-file (concat org-directory "/20260810T233455==agenda--all-about-game__game.org")) + :config (setq org-capture-templates `(("t" "TODO" entry (file+headline ,my-org-capture-file "Something to do") diff --git a/lisp/init-package.el b/lisp/init-package.el @@ -174,10 +174,6 @@ _a_ : all dwim ([remap describe-variable] . helpful-variable) ([remap describe-key] . helpful-key) ([remap describe-symbol] . helpful-symbol) - :map emacs-lisp-mode-map - ("C-c C-d C-d" . helpful-at-point) - :map lisp-interaction-mode-map - ("C-c C-d C-d" . helpful-at-point) :map helpful-mode-map ("C-x K" . helpful-kill-buffers) ("r" . remove-hook-at-point))) @@ -248,8 +244,7 @@ _a_ : all dwim (lambda (field value) (interactive (let* ((f (completing-read "Field: " my-pass-meta-fields)) - (v (read-string (format "%s: " f) - (when (equal f "url") (current-kill 0 t))))) + (v (read-string (format "%s: " f)))) (list f v))) (my-password-store-append-field entry field value))))) @@ -294,7 +289,7 @@ _a_ : all dwim (gt-translator :engines (gt-youdao-dict-engine) :taker (gt-taker :text 'word :langs '(en zh)) - :render (gt-buffer-render)))) + :render (gt-buffer-render)))) (provide 'init-package) ;;; init-package.el ends here diff --git a/lisp/init-prog.el b/lisp/init-prog.el @@ -31,8 +31,6 @@ ;; tree-sitter (use-package treesit-auto - :hook - (after-init . global-treesit-auto-mode) :config (setq treesit-auto-install 'prompt) (setq treesit-font-lock-level 4) @@ -50,10 +48,6 @@ :config (setq sly-lisp-implementations nil)) -(use-package lisp-extra-font-lock - :hook - (lisp-mode . lisp-extra-font-lock-mode)) - ;; markdown (use-package markdown-mode :bind diff --git a/lisp/init-startup.el b/lisp/init-startup.el @@ -97,7 +97,7 @@ (when *is-mac* (setq mac-command-modifier 'meta) (setq mac-option-modifier 'super) - (setq mac-pass-control-to-system nil) + (setq mac-pass-control-to-system t) (setq mac-pass-command-to-system nil)) (provide 'init-startup) diff --git a/lisp/init-terminal.el b/lisp/init-terminal.el @@ -30,6 +30,7 @@ (setq auto-save-file-name-transforms `((".*" ,(expand-file-name "auto-save-list/" user-emacs-directory) t))) +(put 'narrow-to-region 'disabled nil) (put 'scroll-left 'disabled nil) (setq create-lockfiles nil) @@ -199,6 +200,10 @@ (interactive) (find-file "~/.emacs.d/init.el")) +(defun my-display-init-time () + (interactive) + (message "Emacs loaded in %s." (emacs-init-time))) + (defun crux-get-positions-of-line-or-region () "Return positions (beg . end) of the current line or region." (let (beg end) @@ -299,10 +304,5 @@ there's a region, all lines that region covers will be duplicated." ;; other (keymap-global-set "C-c f r" #'recentf) -(add-to-list 'save-some-buffers-action-alist - (list "d" - (lambda (buffer) (diff-buffer-with-file (buffer-file-name buffer))) - "show diff between the buffer and its file")) - (provide 'init-terminal) ;;; init-terminal.el ends here diff --git a/lisp/my-dark-theme.el b/lisp/my-dark-theme.el @@ -22,6 +22,7 @@ `(font-lock-keyword-face ((,class (:foreground ,cyan :weight bold)))) `(font-lock-doc-face ((,class (:foreground ,green :slant normal)))) `(font-lock-string-face ((,class (:foreground ,green)))) + `(font-lock-regexp-grouping-backslash ((,class (:foreground ,cyan :weight bold)))) `(italic ((,class (:slant italic)))) `(line-number ((,class (:foreground ,base01 :weight light)))) @@ -113,8 +114,6 @@ `(geiser-font-lock-doc-link ((,class (:foreground ,blue :underline t)))) `(geiser-font-lock-error-link ((,class (:foreground ,orange :underline t)))) - `(lisp-extra-font-lock-backquote ((,class (:inherit font-lock-type-face)))) - `(vundo-saved ((,class (:foreground ,green)))) `(vundo-last-saved ((,class (:foreground ,green :weight bold)))) `(vundo-highlight ((,class (:foreground ,cyan :weight bold)))) diff --git a/lisp/my-light-theme.el b/lisp/my-light-theme.el @@ -22,6 +22,7 @@ `(font-lock-keyword-face ((,class (:foreground ,cyan :weight bold)))) `(font-lock-doc-face ((,class (:foreground ,green :slant normal)))) `(font-lock-string-face ((,class (:foreground ,green)))) + `(font-lock-regexp-grouping-backslash ((,class (:foreground ,cyan :weight bold)))) `(italic ((,class (:slant italic)))) `(line-number ((,class (:foreground ,base01 :weight light)))) @@ -81,6 +82,7 @@ `(md-ts-heading-5 ((,class (:inherit outline-5)))) `(md-ts-heading-6 ((,class (:inherit outline-6)))) `(md-ts-code ((,class (:foreground ,base01)))) + `(dashboard-footer-face ((,class (:foreground ,blue)))) `(dashboard-text-banner ((,class (:foreground ,green)))) `(dashboard-heading ((,class (:foreground ,green :weight bold)))) @@ -112,8 +114,6 @@ `(geiser-font-lock-doc-link ((,class (:foreground ,blue :underline t)))) `(geiser-font-lock-error-link ((,class (:foreground ,orange :underline t)))) - `(lisp-extra-font-lock-backquote ((,class (:inherit font-lock-type-face)))) - `(vundo-saved ((,class (:foreground ,green)))) `(vundo-last-saved ((,class (:foreground ,green :weight bold)))) `(vundo-highlight ((,class (:foreground ,cyan :weight bold))))