Show the default directory in the header-line.
Examples (see code below for my current implementation):
why?
This comes from how I am using gptel-agent and its extensions. I create gptel-buffers and run agent related functionality. Many of the presets I use have elements that are computed based on default-directory (e.g., AGENT.md). Sometimes I go back to a conversation buffer and don't remember where I had created it from, and I end up inspecting default-directory. The proposed design stems from this.
Describe the solution you'd like
The implementation for the above, which just amends the header-line after gptel:
(defun amsha/gptel-use-header-set-dir ()
"Add the default directory to header."
(setq header-line-format
(append
`((:eval
(concat (propertize " " 'display '(space :align-to 0))
"{In: "
(propertize
(pcase-let ((`(,prefix ,project-name ,rel-path ,base)
(shrink-path-file-mixed
(project-root (project-current))
(file-name-directory (directory-file-name default-directory))
(file-name-nondirectory (directory-file-name default-directory)))))
(if (string-equal project-name base)
(concat prefix project-name)
(concat prefix project-name (shrink-path--dirs-internal rel-path 'truncate-all) base)))
'face 'dired-directory)
"} ")))
header-line-format)))
(advice-add 'gptel-use-header-line :after #'amsha/gptel-use-header-set-dir)
Describe alternatives you've considered
I dont use gptel-agent command directly for 2 reasons: (1) I don't want the agent to run from the root always (2) I have other agent definitions I use more than the one shipped with gptel-agent. Most of the time I use inline presets to invoke an agent. I did consider adding the name to the buffer-name, I felt the mode-lines is more easier for me to keep track of that info.
Show the default directory in the header-line.
Examples (see code below for my current implementation):
why?
This comes from how I am using gptel-agent and its extensions. I create gptel-buffers and run agent related functionality. Many of the presets I use have elements that are computed based on default-directory (e.g., AGENT.md). Sometimes I go back to a conversation buffer and don't remember where I had created it from, and I end up inspecting
default-directory. The proposed design stems from this.Describe the solution you'd like
The implementation for the above, which just amends the header-line after gptel:
Describe alternatives you've considered
I dont use
gptel-agentcommand directly for 2 reasons: (1) I don't want the agent to run from the root always (2) I have other agent definitions I use more than the one shipped with gptel-agent. Most of the time I use inline presets to invoke an agent. I did consider adding the name to the buffer-name, I felt the mode-lines is more easier for me to keep track of that info.