Skip to content

Awkward behavior due to openai-completion-select-insert calling (forward-paragraph) #20

@rommeswi

Description

@rommeswi

If you use openai-completion-select-insert on a selected paragraph, then the response will be inserted after the following paragraph instead of directly after the paragraph.

This happens because openai-completion-select-insert calls (forward-paragraph) before insertion.
Of course it is equally awkward if after selecting only part of a paragraph and sending it to openai, the result appears in the middle of the paragraph, so just removing (forward-paragraph) would not be good.

I do not know an elegant solution to this issue. Perhaps it is possible to pass an optional argument to openai-completion-select-insert not to skip to the next paragraph? Similar issues may arise due to newline characters being added (in some use cases these might not be desirable). If one could pass optional arguments such as "prefix", "suffix" (which default to "\n") and "position" (which defaults to "(goto-char end) (forward-paragraph)"), then this would allow users to use for example advice-add to fine-tune the placement of the response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions