[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gptel de6d8089cd 136/273: gptel-transient: Fix system-mess
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gptel de6d8089cd 136/273: gptel-transient: Fix system-message setting function |
Date: |
Wed, 1 May 2024 10:02:15 -0400 (EDT) |
branch: elpa/gptel
commit de6d8089cdf68732a3942ef729f774322120175e
Author: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
gptel-transient: Fix system-message setting function
gptel-transient.el (gptel--suffix-system-message): Removing the
`(setf (buffer-local-value ...))` construct (as instructed to by
the byte compiler) introduced a bug where custom system message
were set from the wrong buffer. Handle this correctly to fix #138
and possibly #140.
---
gptel-transient.el | 36 ++++++++++++++++++++++--------------
1 file changed, 22 insertions(+), 14 deletions(-)
diff --git a/gptel-transient.el b/gptel-transient.el
index ec18779635..7f22de9725 100644
--- a/gptel-transient.el
+++ b/gptel-transient.el
@@ -525,7 +525,9 @@ This uses the prompts in the variable
(insert
"# Insert your system message below and press "
(propertize "C-c C-c" 'face 'help-key-binding)
- " when ready.\n"
+ " when ready, or "
+ (propertize "C-c C-k" 'face 'help-key-binding)
+ " to abort.\n"
"# Example: You are a helpful assistant. Answer as concisely as
possible.\n"
"# Example: Reply only with shell commands and no prose.\n"
"# Example: You are a poet. Reply only in verse.\n\n")
@@ -540,19 +542,25 @@ This uses the prompts in the variable
`((display-buffer-below-selected)
(body-function . ,#'select-window)
(window-height . ,#'fit-window-to-buffer)))
- (local-set-key (kbd "C-c C-c")
- (lambda ()
- (interactive)
- (with-current-buffer orig-buf
- (setq gptel--system-message
- (buffer-substring msg-start (point-max))))
- (quit-window)
- (display-buffer
- orig-buf
- `((display-buffer-reuse-window
- display-buffer-use-some-window)
- (body-function . ,#'select-window)))
- (call-interactively #'gptel-menu))))))
+ (let ((quit-to-menu
+ (lambda ()
+ (interactive)
+ (quit-window)
+ (display-buffer
+ orig-buf
+ `((display-buffer-reuse-window
+ display-buffer-use-some-window)
+ (body-function . ,#'select-window)))
+ (call-interactively #'gptel-menu))))
+ (local-set-key (kbd "C-c C-c")
+ (lambda ()
+ (interactive)
+ (let ((system-message
+ (buffer-substring msg-start (point-max))))
+ (with-current-buffer orig-buf
+ (setq gptel--system-message system-message)))
+ (funcall quit-to-menu)))
+ (local-set-key (kbd "C-c C-k") quit-to-menu)))))
;; ** Suffixes for rewriting/refactoring
- [nongnu] elpa/gptel 42d53b25e5 041/273: gptel: Handle insufficient quota and other errors, (continued)
- [nongnu] elpa/gptel 42d53b25e5 041/273: gptel: Handle insufficient quota and other errors, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 18222818dc 070/273: gptel: Add gptel-request, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 36051b15d5 068/273: gptel: Unify error descriptions, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 20af9a8b99 095/273: gptel: curl proxy support (#69), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel c29e1cd673 079/273: gptel-transient: Minor formatting changes., ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel e0a7898645 108/273: gptel: Add pre-response-hook, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel b2a01b8d65 111/273: README: Explain saving/restoring sessions better, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 6e4d95a70a 112/273: README: Add drawers to installation instructions, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 62a6020302 117/273: gptel, gptel-curl: Allow protocol (https) to be set separately, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 0109d0d1c0 134/273: gptel: API agnostic response error handling, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel de6d8089cd 136/273: gptel-transient: Fix system-message setting function,
ELPA Syncer <=
- [nongnu] elpa/gptel 6af89254b7 124/273: README: Document breaking changes (mainly `gptel-host` deprecation), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 84cd7bf5a4 144/273: gptel-gemini: Add Gemini support, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 38095eaed5 146/273: gptel: Fix prompt collection bug + linting, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 4775ade6e0 150/273: gptel: add custom gptel-update-destination, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 7271d0e408 154/273: gptel: Try to save/restore gptel-backend in files, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 7b19cdf117 188/273: Sanitize gpt-model value just in time, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 89decb4201 192/273: README: Mention transient menu option saving, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel c41a53f526 194/273: gptel: save/restore multi-line directives (#180), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel e2eccd8b08 205/273: gptel: Remove references to gptel--debug (fix #205), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel ef8b9093d2 206/273: gptel-gemini: Use permissive API safety settings, ELPA Syncer, 2024/05/01