commit 61d77f04f7692b36d4db02c61bb0fd7f0f554e5e
parent 10dba191acb22ab1d472ca9931d8c603bc090dd0
Author: andsy10 <andsy1016@gmail.com>
Date: Sat, 29 Aug 2026 02:30:41 +0800
Add pi-coding-agent session deletion
Diffstat:
3 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/lisp/init-completion.el b/lisp/init-completion.el
@@ -111,7 +111,10 @@ value of the selected COLOR."
"\\*Messages\\*"
"\\*Chinese-word-segmentation\\*"
"\\*gptel-reasoning\\*"
- "\\*gptel-log\\*")
+ "\\*gptel-log\\*"
+ "\\*pi-coding-agent-input:"
+ "\\*pi-coding-agent-sessions:"
+ "\\*pi-coding-agent-tree:")
:test 'equal)))
;; right-click
diff --git a/lisp/init-gptel.el b/lisp/init-gptel.el
@@ -1,6 +1,7 @@
;;; init-gptel.el --- ai -*- lexical-binding: t -*-
;;; Commentary:
+;; I vibe coded this entire part.
;;; Code:
@@ -151,7 +152,43 @@ explanations, no quotes, no punctuation, no file extension."
(interactive)
(when-let* ((proj (project-current t))
(default-directory (project-root proj)))
- (pi-coding-agent))))
+ (pi-coding-agent)))
+
+ (setq pi-coding-agent-thinking-display 'hidden)
+
+ :config
+ (defun pi-coding-agent-session-browser-delete ()
+ "Delete the session file at point, closing any buffers that hold it open."
+ (interactive)
+ (let ((section (magit-current-section)))
+ (if (not (and section (eq (oref section type) 'session)))
+ (message "Pi: No session at point")
+ (let* ((path (oref section value))
+ (holders
+ (cl-remove-if-not
+ (lambda (buf)
+ (and (buffer-live-p buf)
+ (with-current-buffer buf
+ (and (derived-mode-p 'pi-coding-agent-chat-mode)
+ (pi-coding-agent--browse-session-file-matches-p
+ buf path)))))
+ (buffer-list))))
+ (when (y-or-n-p (if holders
+ (format "Delete session and close %d buffer(s)? %s "
+ (length holders) path)
+ (format "Delete session? %s " path)))
+ (let ((pi-coding-agent-quit-without-confirmation t))
+ (dolist (buf holders)
+ (kill-buffer buf)))
+ (delete-file path t)
+ (pi-coding-agent--session-browser-fetch-and-render)
+ (message "Pi: Deleted %s" path))))))
+
+ (keymap-set pi-coding-agent-session-browser-mode-map
+ "D" #'pi-coding-agent-session-browser-delete)
+
+ (transient-insert-suffix 'pi-coding-agent-session-browser-dispatch '(0 0 -1)
+ '("D" "delete" pi-coding-agent-session-browser-delete)))
(provide 'init-gptel)
;;; init-gptel.el ends here
diff --git a/lisp/init-kbd.el b/lisp/init-kbd.el
@@ -33,7 +33,9 @@
;; pi
(general-def (pi-coding-agent-input-mode-map
pi-coding-agent-chat-mode-map)
- "C-c C-q" #'pi-coding-agent-quit)
+ "C-c C-q" #'pi-coding-agent-quit
+ "C-c TAB" #'pi-coding-agent-open-input
+ "C-c C-t" #'pi-coding-agent-tree-browser)
;; elfeed
(general-def elfeed-search-mode-map