refactor(config): Update Emacs configuration across multiple modules

- Prefix gptel backend names with "gptel-" for consistency
- Add denote-org-backlinks-for-heading keybinding
- Refine recentf exclusions for org journal files
- Remove org-default-priority setting
- Add gptel and denote backlink buffer rules to ibuffer
- Enable markdown-ts-mode for Emacs 31+ with truncate lines
- Add electric-pair support for equals sign
- Update popper and window management regexes for new buffer names
This commit is contained in:
User
2026-05-27 04:06:12 +08:00
parent ea8d9945fa
commit 61d09a4625
7 changed files with 31 additions and 22 deletions

View File

@@ -28,7 +28,7 @@
:description "the name of the buffer whose contents are to be retrieved")) :description "the name of the buffer whose contents are to be retrieved"))
:category "emacs") ; An arbitrary label for grouping :category "emacs") ; An arbitrary label for grouping
(gptel-make-openai "Kimi-Code" (gptel-make-openai "gptel-Kimi-Code"
:host "api.kimi.com" :host "api.kimi.com"
:endpoint "/coding/v1/chat/completions" :endpoint "/coding/v1/chat/completions"
:protocol "https" :protocol "https"
@@ -44,7 +44,7 @@
("Authorization" . ,(concat "Bearer " key)))))) ("Authorization" . ,(concat "Bearer " key))))))
(setq gptel-model 'kimi-for-coding (setq gptel-model 'kimi-for-coding
gptel-backend (gptel-get-backend "Kimi-Code")) gptel-backend (gptel-get-backend "gptel-Kimi-Code"))
(defun my-gptel--sanitize-filename (name) (defun my-gptel--sanitize-filename (name)
"Clean NAME into a safe kebab-case filename string." "Clean NAME into a safe kebab-case filename string."
@@ -124,7 +124,7 @@ from the last 1500 characters of the buffer."
:init :init
(with-eval-after-load 'gptel (with-eval-after-load 'gptel
(gptel-make-openai "Kimi-Code-magit" (gptel-make-openai "gptel-Kimi-Code-magit"
:host "api.kimi.com" :host "api.kimi.com"
:endpoint "/coding/v1/chat/completions" :endpoint "/coding/v1/chat/completions"
:protocol "https" :protocol "https"
@@ -141,7 +141,7 @@ from the last 1500 characters of the buffer."
("Authorization" . ,(concat "Bearer " key)))))) ("Authorization" . ,(concat "Bearer " key))))))
(setq gptel-magit-model 'kimi-for-coding (setq gptel-magit-model 'kimi-for-coding
gptel-magit-backend (gptel-get-backend "Kimi-Code-magit")))) gptel-magit-backend (gptel-get-backend "gptel-Kimi-Code-magit"))))
(provide 'init-gptel) (provide 'init-gptel)

View File

@@ -194,7 +194,8 @@
"C-," 'duplicate-and-move-to-next-line "C-," 'duplicate-and-move-to-next-line
"C-c o l" 'denote-link "C-c o l" 'denote-link
"C-c o L" 'denote-org-link-to-heading "C-c o L" 'denote-org-link-to-heading
"C-c o b" 'denote-backlinks) "C-c o b" 'denote-backlinks
"C-c o B" 'denote-org-backlinks-for-heading)
;; hs-hide-mode ;; hs-hide-mode
(general-def hs-minor-mode-map (general-def hs-minor-mode-map

View File

@@ -31,7 +31,10 @@
;; agenda相关 ;; agenda相关
(with-eval-after-load 'recentf (with-eval-after-load 'recentf
(add-to-list 'recentf-exclude (if *is-android* "~/storage/shared/my-org-note/.*\\.org\\'" "~/org/.*\\.org\\'"))) (if *is-android*
(add-to-list 'recentf-exclude "~/storage/shared/my-org-note/journal/.*\\.org\\'")
(add-to-list 'recentf-exclude "~/org/my-org-note/journal/.*\\.org\\'")
(add-to-list 'recentf-exclude "~/org/my-org-note/20260509T232442==agenda--all-my-todos__org\\.org")))
(cond (cond
(*is-windows* (*is-windows*
@@ -45,7 +48,6 @@
(setq org-agenda-files '("~/storage/shared/my-org-note/20260509T232442==agenda--all-my-todos__org.org")))) (setq org-agenda-files '("~/storage/shared/my-org-note/20260509T232442==agenda--all-my-todos__org.org"))))
(setq org-agenda-span 'day) (setq org-agenda-span 'day)
(setq org-default-priority ?C)
(setq org-agenda-skip-function-global (setq org-agenda-skip-function-global
'(org-agenda-skip-entry-if 'todo '("COMMENT"))) '(org-agenda-skip-entry-if 'todo '("COMMENT")))

View File

@@ -228,26 +228,27 @@ targets."
("Scheme" (or ("Scheme" (or
(mode . scheme-mode) (mode . scheme-mode)
(name . "^*Geiser"))) (name . "^*Geiser")))
("gptel" (or
(name . "^\\*gptel")))
("Text" (or ("Text" (or
(mode . org-mode) (mode . org-mode)
(mode . markdown-mode))) (mode . markdown-mode)
(name . "^\\*\\[D\\] FILE backlinks for")))
("Emacs" (or ("Emacs" (or
(name . "^\\*Help\\*$") (name . "^\\*Help\\*$")
(name . "^\\*Custom.*") (name . "^\\*Custom.*")
(name . "^\\*Org Agenda\\*$")
(name . "^\\*info\\*$") (name . "^\\*info\\*$")
(name . "^\\*Backtrace\\*$")
(name . "^\\*Messages\\*$") (name . "^\\*Messages\\*$")
(name . "*Chinese-word-segmentation*") (name . "*Chinese-word-segmentation*")
(name . "^*Buffer List*") (name . "^*Buffer List*")))
(name . "*Calendar*")))
("Magit" (or ("Magit" (or
(mode . magit-blame-mode) (mode . magit-blame-mode)
(mode . magit-cherry-mode) (mode . magit-cherry-mode)
(mode . magit-diff-mode) (mode . magit-diff-mode)
(mode . magit-log-mode) (mode . magit-log-mode)
(mode . magit-process-mode) (mode . magit-process-mode)
(mode . magit-status-mode))) (mode . magit-status-mode)
(mode . magit-revision-mode)))
("Directories" (or ("Directories" (or
(mode . dired-mode) (mode . dired-mode)
(name . "^*dirvish"))) (name . "^*dirvish")))

View File

@@ -35,14 +35,17 @@
;; markdown ;; markdown
(use-package markdown-mode (use-package markdown-mode
:mode
("README\\.md\\'" . gfm-mode)
:init
(setq markdown-command "multimarkdown")
:bind :bind
(:map markdown-mode-map (:map markdown-mode-map
("C-c C-e" . markdown-do))) ("C-c C-e" . markdown-do))
:hook
(markdown-mode . toggle-truncate-lines)
:init
(setq markdown-command "multimarkdown")
(when (>= emacs-major-version 31)
(add-to-list 'major-mode-remap-alist
'(markdown-mode . markdown-ts-mode))
(add-hook 'markdown-ts-mode-hook #'toggle-truncate-lines)))
(provide 'init-prog) (provide 'init-prog)

View File

@@ -82,7 +82,7 @@
;; electirc-pair-mode ;; electirc-pair-mode
(add-hook 'org-mode-hook 'electric-pair-local-mode) (add-hook 'org-mode-hook 'electric-pair-local-mode)
(with-eval-after-load 'elec-pair (with-eval-after-load 'elec-pair
(add-to-list 'electric-pair-pairs '(?\~ . ?\~))) (setq electric-pair-pairs (append '((?\~ . ?\~) (?\= . ?\=)) electric-pair-pairs)))
;; 关闭native compile警告 ;; 关闭native compile警告
(setq native-comp-async-warnings-errors-kind 'silent) (setq native-comp-async-warnings-errors-kind 'silent)

View File

@@ -35,7 +35,7 @@
"\\*Ibuffer\\*" "\\*Ibuffer\\*"
"Buffers\\*$" "Buffers\\*$"
"\\*Geiser Debug\\*" "\\*Geiser Debug\\*"
"\\*Kimi-Code\\*" "\\*gptel-Kimi-Code\\*"
"\\*gptel-agent:.*\\*" "\\*gptel-agent:.*\\*"
"^magit" "^magit"
bookmark-bmenu-mode bookmark-bmenu-mode
@@ -81,7 +81,9 @@
"\\*docker-containers\\*" "\\*docker-images\\*" "\\*docker-networks\\*" "\\*docker-volumes\\*" "\\*docker-containers\\*" "\\*docker-images\\*" "\\*docker-networks\\*" "\\*docker-volumes\\*"
"\\*prolog\\*" inferior-python-mode inf-ruby-mode swift-repl-mode "\\*prolog\\*" inferior-python-mode inf-ruby-mode swift-repl-mode
"\\*rustfmt\\*$" rustic-compilation-mode rustic-cargo-clippy-mode "\\*rustfmt\\*$" rustic-compilation-mode rustic-cargo-clippy-mode
rustic-cargo-outdated-mode rustic-cargo-test-mode)) rustic-cargo-outdated-mode rustic-cargo-test-mode
"^\\*\\[D\\] FILE backlinks for" "^\\*Denote HEADING backlinks for"))
(when (display-grayscale-p) (when (display-grayscale-p)
(setq popper-mode-line (setq popper-mode-line