karthink / gptel

A simple LLM client for Emacs
GNU General Public License v3.0
1.63k stars 151 forks source link

Clear Highlighting on Context Region #449

Closed lkirkwood closed 2 weeks ago

lkirkwood commented 3 weeks ago

Briefly describe what you are trying to do

Loving this package, but when I add a buffer to the context using the -b option in gptel-menu, the added buffer/region is highlighted. The output is then generated and highlighted, but the output highlight clears after pressing any key. Is there a way to clear the context highlighting as well? Currently I have to close the buffer and reopen it. Thanks!

Additional context Emacs version: 29.4 + latest DOOM Operating system: Linux, Ubuntu + Sway

karthink commented 3 weeks ago

The output is then generated and highlighted, but the output highlight clears after pressing any key. Is there a way to clear the context highlighting as well?

Can you be more specific? The output shouldn't be highlighted at all, and I don't understand what's happening when the "output highlight clears after pressing any key".

Loving this package, but when I add a buffer to the context using the -b option in gptel-menu, the added buffer/region is highlighted.

You can control this by setting gptel-context-highlight-face.

lkirkwood commented 3 weeks ago

image Apologies for the vague description. In the screenshot you can see the response from the LLM, highlighted in yellow. You can also see the context (all the text in the buffer) is highlighted in darker grey. The yellow highlighting disappears when I press a key, but the dark grey highlighting on the context does not. Is there a way to clear this highlighting without killing and reopening the buffer?

You can control this by setting gptel-context-highlight-face.

This could be what I'm after, I wouldn't mind just doing away with the highlighting entirely. Should I set this to my default face? How would I go about doing that?

Thanks for your time

karthink commented 3 weeks ago

In the screenshot you can see the response from the LLM, highlighted in yellow.

Are you using Emacs in a terminal?

You can also see the context (all the text in the buffer) is highlighted in darker grey.

Yes, this is from adding the buffer to the context. I think there is some confusion here about what the context commands are for.

In the example you show above, it is unnecessary to add the current buffer to the context. gptel always includes the current buffer up to the cursor with requests. The context commands are for adding other buffers or regions in other buffers. If you add the current buffer to the context it will be sent twice.

The yellow highlighting disappears when I press a key, but the dark grey highlighting on the context does not.

Why do you want to clear this highlighting?

lkirkwood commented 2 weeks ago

In the example you show above, it is unnecessary to add the current buffer to the context. gptel always includes the current buffer up to the cursor with requests. The context commands are for adding other buffers or regions in other buffers. If you add the current buffer to the context it will be sent twice.

I see. This makes sense, thank you. Closing this because obviously this is the expected behaviour and I just misunderstood.