branch: elpa/gptel commit 7076b364bb16ad132baffe2879387dbda0de2d89 Author: Cash Prokop-Weaver <56796112+cas...@users.noreply.github.com> Commit: GitHub <nore...@github.com>
gptel: substitute-command-keys in context buffer (#589) gptel-context.el (gptel-context--buffer-setup): Use `substitue-command-keys' to show available keybindings in the header in the context inspection buffer. Co-authored-by: Cash Prokop-Weaver <c...@cashpw.com> --- gptel-context.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/gptel-context.el b/gptel-context.el index 47af2cadf8..d9db08a2bc 100644 --- a/gptel-context.el +++ b/gptel-context.el @@ -166,7 +166,7 @@ context chunk. This is accessible as, for example: ;;;###autoload (autoload 'gptel-add "gptel-context" "Add/remove regions or buffers from gptel's context." t) (defalias 'gptel-add #'gptel-context-add) - + (defun gptel--file-binary-p (path) "Check if file at PATH is readable and binary." (condition-case nil @@ -330,7 +330,7 @@ START and END signify the region delimiters." "Return the context overlay at point, if any." (cl-find-if (lambda (ov) (overlay-get ov 'gptel-context)) (overlays-at (point)))) - + ;;;###autoload (defun gptel-context--collect () "Get the list of all active context overlays." @@ -437,13 +437,14 @@ context overlays, see `gptel-context--alist'." (let ((inhibit-read-only t)) (erase-buffer) (setq header-line-format - (concat - (propertize "d" 'face 'help-key-binding) ": Mark/unmark deletion, " - (propertize "n" 'face 'help-key-binding) "/" - (propertize "p" 'face 'help-key-binding) ": jump to next/previous, " - (propertize "C-c C-c" 'face 'help-key-binding) ": apply, " - (propertize "C-c C-k" 'face 'help-key-binding) ": cancel, " - (propertize "q" 'face 'help-key-binding) ": quit")) + (substitute-command-keys + (concat + "\\[gptel-context-flag-deletion]: Mark/unmark deletion, " + "\\[gptel-context-next]/\\[gptel-context-previous]: next/previous, " + "\\[gptel-context-visit]: visit, " + "\\[gptel-context-confirm]: apply, " + "\\[gptel-context-quit]: cancel, " + "\\[quit-window]: quit"))) (save-excursion (let ((contexts gptel-context--alist)) (if (length> contexts 0)