diff --git a/README.org b/README.org index 07c8915..d6f69db 100644 --- a/README.org +++ b/README.org @@ -268,6 +268,10 @@ The full changelog can be found in README.org. - Show a welcome message when starting the FastGPT shell (=kagi-fastgpt-shell=). This can be customized with =kagi-fastgpt-welcome-function=, a variable with a function that returns a welcome string. +*** Fixes + +- Prompts defined with =define-kagi-fastgpt-prompt= wouldn't always work when expanding =%s= placeholders (possibly resulting in =Lisp error: (args-out-of-range 0 7)=). + *** Misc - Minor refactoring in the code calling the FastGPT API. diff --git a/kagi.el b/kagi.el index 0e98f4a..e39d96f 100644 --- a/kagi.el +++ b/kagi.el @@ -465,7 +465,9 @@ user input." (lambda (match) (pcase match ("%%" "%") - ("%s" (or user-text (setq user-text (funcall text-function)))) + ("%s" (or user-text + (setq user-text (save-match-data + (funcall text-function))))) (_ match))) prompt t t))) diff --git a/kagi.info b/kagi.info index 7f9725f..08e0d2a 100644 Binary files a/kagi.info and b/kagi.info differ