diff --git a/README.org b/README.org index 765c53c..09bac9a 100644 --- a/README.org +++ b/README.org @@ -272,6 +272,10 @@ The full changelog can be found in README.org. - Full support for markdown syntax returned by FastGPT, by using the [[https://github.com/jrblevin/markdown-mode][markdown-mode]] package. - 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 f84f77b..d235729 100644 --- a/kagi.el +++ b/kagi.el @@ -229,7 +229,7 @@ returns a bullet list." value))) (defun kagi--format-references (references) - "Format the REFRENCES as a string. + "Format the REFERENCES as a string. The REFERENCES is a part of the JSON response, see https://help.kagi.com/kagi/api/fastgpt.html for more information." @@ -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 a9eba57..0756f99 100644 Binary files a/kagi.info and b/kagi.info differ