Closed karthink closed 3 months ago
If anyone has ideas for how to store multi-line strings as org properties or file-local variables I'd be happy to get your input.
Please note that we don't want to use an auxiliary file to store this data -- the Org or markdown file should be fully portable and self-contained. gptel will try its best to stay backwards compatible.
What about replacing the newline character with "\n"
and then revert that change on load?
@martenlienen That's the idea for now, but there are a few concerns to be addressed.
org-property-separators
, which was introduced in Org 9.6-something. This fix will not work for Emacs 27 and some Emacs 28 users.EDIT: See also this bug report I filed with Emacs (and subsequently retracted) about newline handling for local variable storage.
@martenlienen Should be "fixed" in that your Org files won't break any more, but the "\n" -> "\n" replacement solution is a hack with the above problems.
I'll keep this issue open until I can find better solutions for both saving chats in both Org and other modes.
Closing since the makeshift solution is working well, but with a comment that a better solution would be welcome.
If the system message string used in a chat has newlines, it is not stored correctly either as a file-local variable or an Org property. Trying to resume this chat causes an error.
One possible fix is to replace newlines with an unused ASCII char when storing it in the buffer. Example: one of the ASCII chars TAB, C-l, C-g or the null character.