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"))
:category "emacs") ; An arbitrary label for grouping
(gptel-make-openai "Kimi-Code"
(gptel-make-openai "gptel-Kimi-Code"
:host "api.kimi.com"
:endpoint "/coding/v1/chat/completions"
:protocol "https"
@@ -44,7 +44,7 @@
("Authorization" . ,(concat "Bearer " key))))))
(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)
"Clean NAME into a safe kebab-case filename string."
@@ -124,7 +124,7 @@ from the last 1500 characters of the buffer."
:init
(with-eval-after-load 'gptel
(gptel-make-openai "Kimi-Code-magit"
(gptel-make-openai "gptel-Kimi-Code-magit"
:host "api.kimi.com"
:endpoint "/coding/v1/chat/completions"
:protocol "https"
@@ -141,7 +141,7 @@ from the last 1500 characters of the buffer."
("Authorization" . ,(concat "Bearer " key))))))
(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)

View File

@@ -194,7 +194,8 @@
"C-," 'duplicate-and-move-to-next-line
"C-c o l" 'denote-link
"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
(general-def hs-minor-mode-map

View File

@@ -31,7 +31,10 @@
;; agenda相关
(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
(*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-span 'day)
(setq org-default-priority ?C)
(setq org-agenda-skip-function-global
'(org-agenda-skip-entry-if 'todo '("COMMENT")))

View File

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

View File

@@ -35,14 +35,17 @@
;; markdown
(use-package markdown-mode
:mode
("README\\.md\\'" . gfm-mode)
:init
(setq markdown-command "multimarkdown")
:bind
(: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)

View File

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

View File

@@ -35,7 +35,7 @@
"\\*Ibuffer\\*"
"Buffers\\*$"
"\\*Geiser Debug\\*"
"\\*Kimi-Code\\*"
"\\*gptel-Kimi-Code\\*"
"\\*gptel-agent:.*\\*"
"^magit"
bookmark-bmenu-mode
@@ -81,7 +81,9 @@
"\\*docker-containers\\*" "\\*docker-images\\*" "\\*docker-networks\\*" "\\*docker-volumes\\*"
"\\*prolog\\*" inferior-python-mode inf-ruby-mode swift-repl-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)
(setq popper-mode-line