Commit 6425e48b5bd3
Changed files (1)
dots
config
emacs
dots/config/emacs/init.el
@@ -3310,6 +3310,19 @@ With \\[universal-argument] \\[universal-argument]: always prompt with completio
;; extensions) by default — frontend equivalent of --approve (v2.5.0).
(pi-coding-agent-project-trust-policy 'approve)
:config
+ ;; Shorten buffer names (and thus the Emacs frame/window title) from
+ ;; "*pi-coding-agent-input:~/src/home*" to "*pi:input:~/src/home*".
+ (declare-function pi-coding-agent--buffer-name "pi-coding-agent-ui")
+ (defun vde/pi-coding-agent-buffer-name (type dir &optional session)
+ "Shorter buffer name for pi-coding-agent TYPE in DIR with SESSION."
+ (let ((type-str (pcase type (:chat "chat") (:input "input")))
+ (abbrev-dir (abbreviate-file-name dir)))
+ (if (and session (not (string-empty-p session)))
+ (format "*pi:%s:%s<%s>*" type-str abbrev-dir session)
+ (format "*pi:%s:%s*" type-str abbrev-dir))))
+ (advice-add 'pi-coding-agent--buffer-name :override
+ #'vde/pi-coding-agent-buffer-name)
+
;; NOTE: thinking blocks are visible by default since v2.5.0, which also
;; batches history replay and avoids the O(n²) re-render that previously
;; forced us to hide thinking. Re-enable the advice below only if long