fix(ai): unset CLAUDECODE to allow nested sessions + add justl.el

This commit is contained in:
2026-03-21 12:23:07 +08:00
parent 4be0e63fac
commit 0c061e37ab
3 changed files with 28 additions and 18 deletions
+20 -18
View File
@@ -9,7 +9,7 @@
:defer t :defer t
:config :config
;; Default backend: OpenRouter ;; Default backend: OpenRouter
(setq gptel-model 'google/gemini-2.5-flash (setq gptel-model 'google/gemini-3.flash-preview
gptel-backend gptel-backend
(gptel-make-openai "OpenRouter" (gptel-make-openai "OpenRouter"
:host "openrouter.ai" :host "openrouter.ai"
@@ -48,32 +48,32 @@
(after! gptel (after! gptel
;; Coding assistant preset ;; Coding assistant preset
(gptel-make-preset 'coder (gptel-make-preset 'coder
:description "Expert coding assistant" :description "Expert coding assistant"
:backend "OpenRouter" :backend "OpenRouter"
:model 'anthropic/claude-sonnet-4.5 :model 'anthropic/claude-sonnet-4.5
:system "You are an expert coding assistant. Provide high-quality code solutions, refactorings, and explanations. Be concise but thorough. Include error handling and follow best practices.") :system "You are an expert coding assistant. Provide high-quality code solutions, refactorings, and explanations. Be concise but thorough. Include error handling and follow best practices.")
;; Code explainer preset ;; Code explainer preset
(gptel-make-preset 'explain (gptel-make-preset 'explain
:description "Explain code to beginners" :description "Explain code to beginners"
:system "Explain this code to a novice programmer. Use simple language and break down complex concepts.") :system "Explain this code to a novice programmer. Use simple language and break down complex concepts.")
;; Refactoring preset ;; Refactoring preset
(gptel-make-preset 'refactor (gptel-make-preset 'refactor
:description "Code refactoring expert" :description "Code refactoring expert"
:model 'anthropic/claude-sonnet-4.5 :model 'anthropic/claude-sonnet-4.5
:system "You are a code refactoring expert. Improve code quality, readability, and performance while maintaining functionality. Explain your changes.") :system "You are a code refactoring expert. Improve code quality, readability, and performance while maintaining functionality. Explain your changes.")
;; Quick answers preset ;; Quick answers preset
(gptel-make-preset 'quick (gptel-make-preset 'quick
:description "Quick, concise answers" :description "Quick, concise answers"
:model 'google/gemini-2.5-flash :model 'google/gemini-2.5-flash
:system "Provide quick, concise answers. Be direct and to the point.") :system "Provide quick, concise answers. Be direct and to the point.")
;; Documentation writer preset ;; Documentation writer preset
(gptel-make-preset 'docs (gptel-make-preset 'docs
:description "Documentation writer" :description "Documentation writer"
:system "Write clear, comprehensive documentation. Include examples and explain edge cases.")) :system "Write clear, comprehensive documentation. Include examples and explain edge cases."))
;;; ============================================================================ ;;; ============================================================================
;;; gptel-quick - Quick lookups and explanations ;;; gptel-quick - Quick lookups and explanations
@@ -161,9 +161,9 @@
(when (use-region-p) (when (use-region-p)
(let ((code (buffer-substring-no-properties (region-beginning) (region-end)))) (let ((code (buffer-substring-no-properties (region-beginning) (region-end))))
(gptel-request code (gptel-request code
:system "Explain this code concisely in 2-3 sentences." :system "Explain this code concisely in 2-3 sentences."
:callback (lambda (response info) :callback (lambda (response info)
(message "Explanation: %s" response)))))) (message "Explanation: %s" response))))))
(defun my/gptel-proofread-region () (defun my/gptel-proofread-region ()
"Proofread and improve selected text." "Proofread and improve selected text."
@@ -183,6 +183,8 @@
(use-package! claude-code (use-package! claude-code
:defer t :defer t
:config :config
;; Unset CLAUDECODE to allow running Claude Code inside Emacs sub-processes
(setenv "CLAUDECODE" nil)
(setq claude-code-program "ccr" (setq claude-code-program "ccr"
claude-code-program-switches '("code" "--dangerously-skip-permissions")) claude-code-program-switches '("code" "--dangerously-skip-permissions"))
+5
View File
@@ -144,3 +144,8 @@
(setq lsp-clients-clangd-executable "clangd") (setq lsp-clients-clangd-executable "clangd")
(setq lsp-clients--clangd-default-executable "clangd") (setq lsp-clients--clangd-default-executable "clangd")
(setq lsp-clangd-binary-path "clangd")) (setq lsp-clangd-binary-path "clangd"))
;; Justfile mode (psibi/justl.el)
(use-package! justl
:config
(map! :n "e" 'justl-exec-recipe))
+3
View File
@@ -64,6 +64,9 @@
("integration" "integration/*") ("integration" "integration/*")
(:exclude ".dir-locals.el" "*-tests.el")))) (:exclude ".dir-locals.el" "*-tests.el"))))
;; Justfile mode
(package! justl :recipe (:host github :repo "psibi/justl.el"))
;; Usage metrics and key tracking ;; Usage metrics and key tracking
(package! keyfreq) (package! keyfreq)
(package! command-log-mode) (package! command-log-mode)