commit befb687d687d18eb11e9c70c0cf5c3561823e7d5
parent b7bd71015414260f967a500fb06da97f6f43220d
Author: andsy10 <andsy1016@gmail.com>
Date: Mon, 12 Oct 2026 03:57:57 +0800
Add custom groups and optimize configurations
Diffstat:
7 files changed, 73 insertions(+), 52 deletions(-)
diff --git a/lisp/init-base.el b/lisp/init-base.el
@@ -115,7 +115,7 @@
("Scratch" (or
(name . "^*scratch")))
("Text" (or
- (predicate (lambda () (and (hsys-org-mode-p)
+ (predicate (lambda () (and (derived-mode-p 'org-mode)
(not (memq 'gptel-mode local-minor-modes)))))
(mode . markdown-mode)
(mode . rst-mode)
@@ -167,8 +167,8 @@
("Shell" (or
(mode . shell-mode)
(mode . eshell-mode)
- (mode . ghostel-mode)
- (mode . vterm-mode)))
+ (mode . term-mode)
+ (mode . ghostel-mode)))
("Tramp"(or
(name . "^\\*tramp")))
("VC" (or
@@ -194,8 +194,6 @@
("Feeds" (or
(name . "\\*elfeed-")))
("AI" (or
- (name . "^\\*OpenCode")
- (name . "\\*opencode-serve\\*")
(predicate (lambda () (memq 'gptel-mode local-minor-modes)))
(name . "^\\*pilish")))
("Calc" (or
@@ -208,7 +206,6 @@
(mode . Man-mode))) ;`Man' too
("Grep" (or
(mode . grep-mode)
- (mode . rg-mode)
(mode . xref--xref-buffer-mode)
(mode . xref-edit-mode)
(mode . occur-mode)
@@ -326,7 +323,8 @@
(defface my-isearch-count
'((t (:inherit font-lock-type-face :weight bold)))
- "Face for the isearch match count in the mode-line.")
+ "Face for the isearch match count in the mode-line."
+ :group 'isearch)
(defconst my-isearch-count--mode-line-construct
'(:eval (my-isearch-count-format)))
diff --git a/lisp/init-completion.el b/lisp/init-completion.el
@@ -27,9 +27,17 @@
;; search and navigation
(my-use-package consult
- :commands my-consult-git-grep-project consult-directory-externally
+ :commands my-consult-org-agenda my-consult-git-grep-project consult-directory-externally
:commands consult-directory-externally my-open-current-directory my-consult-fd-home
:config
+ (defun my-consult-org-agenda (arg)
+ "Jump to an active Org agenda heading.
+With prefix ARG, search for all agenda headings."
+ (interactive "P")
+ (if arg
+ (consult-org-heading t 'agenda)
+ (consult-org-heading "/!" 'agenda)))
+
(defun my-consult-git-grep-project ()
"Run `consult-git-grep' in current project's root."
(interactive)
@@ -186,7 +194,6 @@ targets."
;; corfu
(my-use-package corfu
- :autoload corfu-quit consult-completion-in-region
:bind
(:map corfu-map
("M-d" . corfu-popupinfo-documentation)
@@ -196,26 +203,23 @@ targets."
(after-init . corfu-popupinfo-mode)
(after-init . corfu-history-mode)
:config
- (setopt corfu-auto t
- corfu-auto-prefix 2
- corfu-count 12
- corfu-preview-current nil
- corfu-on-exact-match nil
- corfu-auto-delay 0.2
- corfu-popupinfo-delay '(0.4 . 0.2)
- global-corfu-modes '((not erc-mode
- circe-mode
- help-mode
- gud-mode
- vterm-mode)
- t))
- (add-hook 'before-save-hook #'corfu-quit)
- (add-hook 'eshell-mode-hook
- (lambda ()
- (setq-local corfu-auto nil)
- (local-set-key (kbd "TAB") #'completion-at-point)))
- (add-hook 'org-mode-hook
- (lambda () (setq-local corfu-auto nil))))
+ (setq corfu-auto t
+ corfu-auto-prefix 2
+ corfu-count 12
+ corfu-preview-current nil
+ corfu-on-exact-match nil
+ corfu-auto-delay 0.2
+ corfu-popupinfo-delay '(0.4 . 0.2)
+ global-corfu-modes '((not erc-mode
+ circe-mode
+ help-mode
+ gud-mode
+ vterm-mode)
+ t))
+ (add-hook 'eshell-mode-hook #'my-disable-corfu-auto)
+ (add-hook 'org-mode-hook #'my-disable-corfu-auto)
+ (defun my-disable-corfu-auto ()
+ (setq-local corfu-auto nil)))
;; cape
(my-use-package cape
diff --git a/lisp/init-custom.el b/lisp/init-custom.el
@@ -4,57 +4,71 @@
;;; Code:
+(defgroup trogloxene nil
+ "My customize settings.")
+
(defcustom my-enable-guix nil
"Enable `guix' or not."
- :type 'boolean)
+ :type 'boolean
+ :group 'trogloxene)
(defcustom my-enable-exwm nil
"Enable `exwm' or not."
- :type 'boolean)
+ :type 'boolean
+ :group 'trogloxene)
(defcustom my-enable-dashboard nil
"Enable `dashboard' or not."
- :type 'boolean)
+ :type 'boolean
+ :group 'trogloxene)
(defcustom my-enable-unessentials nil
"Enable some unessential packages."
- :type 'boolean)
+ :type 'boolean
+ :group 'trogloxene)
(defcustom my-blog-directory
(if *is-windows* "h:/emacs/blog/posts/" "~/org/blog/posts/")
"My blog directory"
- :type 'string)
+ :type 'string
+ :group 'trogloxene)
(with-eval-after-load 'org
(defcustom my-org-capture-file
(concat org-directory "/20260509T232442==agenda--all-my-todos.org")
"File used to capture todos."
- :type 'string)
+ :type 'string
+ :group 'trogloxene)
(defcustom my-org-capture-game-file
(concat org-directory "/20260810T233455==agenda--all-about-game__game.org")
"File used to capture games"
- :type 'string))
+ :type 'string
+ :group 'trogloxene))
(defcustom my-frame-parameter 'fullscreen
"Frame parameter on startup."
:type '(choice (const :tag "Fullscreen" fullscreen)
- (const :tag "Maximized" maximized)))
+ (const :tag "Maximized" maximized))
+ :group 'trogloxene)
(defcustom my-cns-dir
(if *is-windows*
"h:/emacs/emacs-chinese-word-segmentation/"
"~/emacs-stuff/emacs-chinese-word-segmentation/")
"Directory for cns."
- :type 'string)
+ :type 'string
+ :group 'trogloxene)
(defcustom my-proxy "127.0.0.1:7890"
"Proxy."
- :type 'string)
+ :type 'string
+ :group 'trogloxene)
(defcustom my-load-proxy nil
"Load proxy config or not."
- :type 'boolean)
+ :type 'boolean
+ :group 'trogloxene)
(provide 'init-custom)
;;; init-custom.el ends here
diff --git a/lisp/init-kbd.el b/lisp/init-kbd.el
@@ -246,6 +246,10 @@
(general-def minibuffer-local-map
"C-c C-e" #'embark-export)
+;; org-agenda
+(general-def org-agenda-mode-map
+ "C-/" #'org-agenda-undo)
+
;; org-mode
(general-def org-mode-map
"C-<tab>" #'org-cycle-parent-subtree
@@ -398,12 +402,12 @@
"F" #'my-blog-find-file
"g" #'consult-denote-grep
"G" #'my-blog-grep
- "s" #'consult-org-agenda
+ "s" #'my-consult-org-agenda
"C" #'calendar
"c" #'org-capture
"d" #'denote
"D" #'denote-date
- "r" #'denote-rename-file-date
+ "r" #'denote-rename-file-identifier
"b" #'my-denote-find-backlink-with-location
"R" #'denote-rename-file
"m" #'my-denote-open-metanote
diff --git a/lisp/init-package.el b/lisp/init-package.el
@@ -87,8 +87,8 @@ Like normal Emacs `C-k'. Kill to end of line and put content in kill-ring."
;; environment sync
(my-use-package exec-path-from-shell
- :init
- (exec-path-from-shell-initialize))
+ :hook
+ (after-init . exec-path-from-shell-initialize))
;; workspace
(my-use-package perspective
@@ -254,6 +254,7 @@ against its previous revision."
;; project
(my-use-package project
:straight nil
+ :autoload project-root
:config
(setq project-switch-commands (assq-delete-all 'project-vc-dir project-switch-commands))
(setq project-switch-commands
@@ -286,7 +287,7 @@ against its previous revision."
(my-use-package tokei my-enable-unessentials)
;; helpful
-(my-use-package helpful
+(my-use-package helpful my-enable-unessentials
:straight
(helpful :fork (:type git :host nil :repo "https://git.trogloxene.org/helpful.git"))
:bind
diff --git a/lisp/init-ui.el b/lisp/init-ui.el
@@ -127,13 +127,12 @@ from `readable-foreground-color'."
;; whitespace
(my-use-package whitespace
:straight nil
- :init
+ :hook
+ ((prog-mode text-mode conf-mode) . my-show-trailing-whitespace)
+ :config
(defun my-show-trailing-whitespace ()
"Enable display of trailing whitespace in this buffer."
- (setq-local show-trailing-whitespace t))
-
- (dolist (hook '(prog-mode-hook text-mode-hook conf-mode-hook))
- (add-hook hook 'my-show-trailing-whitespace)))
+ (setq-local show-trailing-whitespace t)))
;; resize margins
(my-use-package olivetti
diff --git a/lisp/my-theme.el b/lisp/my-theme.el
@@ -27,7 +27,7 @@
`(mode-line-inactive ((,class (:foreground ,base01 :background ,base03))))
`(display-time-date-and-time ((,class (:foreground ,base1 :bold t))))
- `(comint-highlight-prompt ((,class (:foreground ,green))))
+ `(comint-highlight-prompt ((,class (:foreground ,yellow :weight bold))))
`(comint-highlight-input ((,class (:inherit bold))))
`(eshell-ls-readonly ((,class (:inherit error))))
@@ -131,7 +131,8 @@
`(transient-value ((,class (:foreground ,green))))
`(transient-argument ((,class (:foreground ,green :inherit transient-key))))
- `(geiser-font-lock-repl-output ((,class (:foreground ,green))))
+ `(geiser-font-lock-repl-output ((,class (:foreground ,blue))))
+ `(geiser-font-lock-repl-prompt ((,class (:inherit comint-highlight-prompt))))
`(geiser-font-lock-doc-link ((,class (:foreground ,blue :underline t))))
`(geiser-font-lock-error-link ((,class (:foreground ,orange :underline t))))
`(geiser-font-lock-xref-link ((,class (:inherit link))))