[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gptel 149261ee79 211/273: gptel-transient: Avoid clashes w
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gptel 149261ee79 211/273: gptel-transient: Avoid clashes with the custom directive key (#219) |
Date: |
Wed, 1 May 2024 10:02:25 -0400 (EDT) |
branch: elpa/gptel
commit 149261ee79502284d8886a9f5133e4f6be0ba5ca
Author: Marten Lienen <marten.lienen@gmail.com>
Commit: GitHub <noreply@github.com>
gptel-transient: Avoid clashes with the custom directive key (#219)
gptel-transient (gptel--system-prompt-setup): When assigning keys
to directives, avoid clashes with the system-message edit key
(`h`), and use an arbitrary unused key if no mnemonic key
assignments are possible.
---
gptel-transient.el | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/gptel-transient.el b/gptel-transient.el
index 00ae53b970..39810a0256 100644
--- a/gptel-transient.el
+++ b/gptel-transient.el
@@ -185,22 +185,18 @@ which see."
(transient-parse-suffixes
'gptel-system-prompt
(cl-loop for (type . prompt) in gptel-directives
- with taken
+ ;; Avoid clashes with the custom directive key
+ with unused-keys = (delete ?h (number-sequence ?a ?z))
with width = (window-width)
for name = (symbol-name type)
- for key =
- (let ((idx 0) pos)
- (while (or (not pos) (member pos taken))
- (setq pos (substring name idx (1+ idx)))
- (cl-incf idx))
- (push pos taken)
- pos)
+ for key = (seq-find (lambda (k) (member k unused-keys)) name (seq-first
unused-keys))
+ do (setq unused-keys (delete key unused-keys))
;; The explicit declaration ":transient transient--do-return" here
;; appears to be required for Transient v0.5 and up. Without it, these
;; are treated as suffixes when invoking `gptel-system-prompt' directly,
;; and infixes when going through `gptel-menu'.
;; TODO: Raise an issue with Transient.
- collect (list (key-description key)
+ collect (list (key-description (list key))
(concat (capitalize name) " "
(propertize " " 'display '(space :align-to 20))
(propertize
- [nongnu] elpa/gptel 66d2bafad6 132/273: gptel-ollama: Fix buffer parsing, (continued)
- [nongnu] elpa/gptel 66d2bafad6 132/273: gptel-ollama: Fix buffer parsing, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel e105a52541 142/273: gptel: Update docstrings for prompt/response prefixes, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel c9d362a3e9 153/273: gptel-transient: Set model when redirecting to new buffer, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 9126bed43f 159/273: gptel: Set window when doing auto-scrolling, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 85bd47cb4c 164/273: README: Add support for llama.cpp, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 4d01dddf7d 155/273: gptel, gptel-curl: Address checkdoc warnings, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel e5357383ce 166/273: gptel: Appease byte-compiler and linter, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel d5b10c3d6d 169/273: gptel: gptel-model can be an arbitrary string, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel d6ef79f621 177/273: gptel-transient: Show descriptions of directives, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 0690c8b6a9 161/273: gptel-transient: Exit transient when writing directive, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 149261ee79 211/273: gptel-transient: Avoid clashes with the custom directive key (#219),
ELPA Syncer <=
- [nongnu] elpa/gptel dd5833eef3 023/273: gptel: Improve gptel-mode setup, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 3d0df72bd3 027/273: gptel-transient: linting for MELPA, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 2982ede17d 255/273: gptel-org: Add gptel-org, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 9bc54bed9c 244/273: gptel-transient: Remove "-ts" suffix from major mode (#259), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 9a5a4a60d5 248/273: README: Mention wiki entry on saving transient flags, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 8dbcbbb908 256/273: gptel-org: Move session save/restore code for Org, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 1b47235e25 071/273: README: Add section on gptel-request, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel bb8b37d8c0 100/273: gptel, gptel-curl: Fix byte-compile warnings, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 219e163dc7 091/273: gptel-curl: Add gptel-abort, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel a660e13a8b 106/273: gptel, gptel-transient: Fix read temperature from minibuffer (#85), ELPA Syncer, 2024/05/01