You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gptel-context: add file path expansion to prevent duplicates
This prevents issues where the same file might be added multiple times
due to different path representations (e.g., relative vs absolute
paths, or paths with . and .. components).
This resolves an issue where the following gptel-context-move-to-tail
function would add the same file multiple times when the
buffer-file-name and the file path in gptel-context differed due to
path normalization.
;; Add hook to refile the modified files at the tail of context
(defun gptel-context-move-to-tail ()
"Move the current buffer's file to the head of the context after saving."
(when (and gptel-context
(member (buffer-file-name) (apply #'append gptel-context)))
(gptel-context-remove (buffer-file-name))
(gptel-add-file (buffer-file-name))))
(add-hook 'after-save-hook #'gptel-context-move-to-tail)
(add-hook 'after-revert-hook #'gptel-context-move-to-tail)
0 commit comments