From 97d0a4a3e41a81c2675f9d3477be39fa5166593f Mon Sep 17 00:00:00 2001 From: User Date: Tue, 30 Jun 2026 22:10:17 +0800 Subject: [PATCH] refactor: Reorganize package configurations and fix bindings --- lisp/init-base.el | 5 ----- lisp/init-gptel.el | 15 ++++++++++----- lisp/init-org.el | 18 +++++++++--------- lisp/init-prog.el | 6 +++++- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/lisp/init-base.el b/lisp/init-base.el index 07340f0..8cd09c0 100644 --- a/lisp/init-base.el +++ b/lisp/init-base.el @@ -238,11 +238,6 @@ :config (setq eww-auto-rename-buffer t)) -;; shr -(use-package shr - :config - (setq shr-inhibit-images nil)) - (provide 'init-base) ;;; init-base.el ends here diff --git a/lisp/init-gptel.el b/lisp/init-gptel.el index 4f9bb8f..08d99ec 100644 --- a/lisp/init-gptel.el +++ b/lisp/init-gptel.el @@ -35,7 +35,7 @@ :stream t :models '(kimi-for-coding) :header (lambda (_) - (when-let ((key (gptel--get-api-key))) + (when-let* ((key (gptel--get-api-key))) `(("User-Agent" . "RooCode/3.30.3") ("HTTP-Referer" . "https://github.com/RooVetGit/Roo-Cline") ("X-Title" . "Roo Code") @@ -53,7 +53,8 @@ (string-trim clean))) (defun my-gptel-save-session () - "Save current gptel session to ~/gptel/sessions/ with AI-generated filename. + "Save current gptel session to ~/gptel/sessions/ with AI-generated +filename. The filename is prefixed with a YYYYMMDD-HHmmss timestamp and generated from the last 1500 characters of the buffer." (interactive) @@ -63,11 +64,15 @@ from the last 1500 characters of the buffer." (content (with-current-buffer buf (buffer-substring-no-properties (point-min) (point-max)))) (tail (substring content (max 0 (- (length content) 1500)))) - (prompt-text (format "Based on the following conversation, generate a short kebab-case filename (3 to 5 lowercase English words, hyphen-separated, no file extension). Output ONLY the filename, nothing else.\n\n%s" + (prompt-text (format "Based on the following conversation, generate a short kebab-case +filename (3 to 5 lowercase English words, hyphen-separated, no file +extension). Output ONLY the filename, nothing else.\n\n%s" tail))) (message "Generating filename with AI...") (let ((fsm (gptel-request prompt-text - :system "You are a filename generator. Output ONLY a short kebab-case filename (3-5 lowercase English words separated by hyphens). No explanations, no quotes, no punctuation, no file extension." + :system "You are a filename generator. Output ONLY a short kebab-case +filename (3-5 lowercase English words separated by hyphens). No +explanations, no quotes, no punctuation, no file extension." :stream nil :callback (lambda (response info) @@ -132,7 +137,7 @@ from the last 1500 characters of the buffer." :models '((kimi-for-coding)) :request-params '(:temperature 0.6 :thinking (:type "disabled")) :header (lambda (_) - (when-let ((key (gptel--get-api-key))) + (when-let* ((key (gptel--get-api-key))) `(("User-Agent" . "RooCode/3.30.3") ("HTTP-Referer" . "https://github.com/RooVetGit/Roo-Cline") ("X-Title" . "Roo Code") diff --git a/lisp/init-org.el b/lisp/init-org.el index bbf08b0..3a98971 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -75,7 +75,7 @@ :hook (after-init . denote-rename-buffer-mode) (dired-mode . denote-dired-mode) - :config + :init (cond (*is-android* (setq denote-directory "~/storage/shared/my-org-note/")) @@ -83,14 +83,14 @@ (setq denote-directory "H:/emacs/my-org-note/")) (t (setq denote-directory "~/org/my-org-note/"))) - :init - (setq denote-prompts '(title signature keywords)) - (setq denote-title-history nil) - (setq denote-signature-history - '("note" "project" "fun" "wisdom" "article" "data" "metanote" "agenda" "journal" "archive")) - (setq denote-known-keywords - '("emacs")) - (setq denote-title-history nil)) + (setq denote-org-store-link-to-heading 'context + denote-prompts '(title signature keywords)) + (setq denote-title-history nil + denote-signature-history + '("note" "project" "fun" "wisdom" "article" "data" "metanote" "agenda" "journal" "archive") + denote-known-keywords + '("emacs") + denote-title-history nil)) ;; denote-org (use-package denote-org) diff --git a/lisp/init-prog.el b/lisp/init-prog.el index f2d99fc..caf996b 100644 --- a/lisp/init-prog.el +++ b/lisp/init-prog.el @@ -59,7 +59,7 @@ (:map markdown-mode-map ("C-c C-e" . markdown-do)) :hook - (markdown-mode . toggle-truncate-lines) + (markdown-mode . visual-line-mode) :init (setq markdown-command "multimarkdown" markdown-fontify-code-blocks-natively t)) @@ -67,6 +67,10 @@ (use-package edit-indirect) ;; html +(use-package shr + :config + (setq shr-inhibit-images nil)) + (use-package htmlize) (provide 'init-prog)