karthink / gptel

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

The suggested default key binding confliction with auctex. #34

Closed hongyi-zhao closed 1 year ago

hongyi-zhao commented 1 year ago

I'm using auctex, which has bound the following short key, conflicted with the suggested one used by this package:

C-c RET (translated from C-c <return>) runs the command
TeX-insert-macro (found in LaTeX-mode-map), which is an interactive
byte-compiled Lisp function in ‘tex.el’.

It is bound to C-c RET.

(TeX-insert-macro SYMBOL)

Insert TeX macro SYMBOL with completion.

AUCTeX knows of some macros and may query for extra arguments, depending on
the value of ‘TeX-insert-macro-default-style’ and whether ‘TeX-insert-macro’
is called with C-u.

[back]

Considering that auctex is a very popular tool with a long history, I don't want to change its default key binding convention. So, I ask you for an alternative key binding convention in your package.

Regards, Zhao

karthink commented 1 year ago

I don't see where the conflict is. gptel-send is not bound to any key unless you're in a special buffer you create with M-x gptel -- in which case you're not in latex-mode.

hongyi-zhao commented 1 year ago

Say, I'm in AUCTeX buffer, C-c RET will not trigger gptel-send, and as an alternative, now I rebound it to F2.

karthink commented 1 year ago

Say, I'm in AUCTeX buffer, C-c RET will not trigger gptel-send, and as an alternative, now I rebound it to F2.

Sorry, I don't follow. gptel-send is not bound to any key, so you're free to bind it as you please, or just call M-x gptel-send. So where is the conflict?

hongyi-zhao commented 1 year ago

If so, why do you give the following description: image

karthink commented 1 year ago

It's bound to C-c RET in dedicated gptel buffers, i.e. one created using M-x gptel. But this is a markdown or org buffer (depending on the value of gptel-default-mode), not an AuCTeX buffer.

Of the two ways of using gptel (in a dedicated chat buffer vs queries in any buffer), may I ask how you use or would like to use gptel?

hongyi-zhao commented 1 year ago

Of the two ways of using gptel (in a dedicated chat buffer vs queries in any buffer), may I ask how you use or would like to use gptel?

Both. They have their own advantages and disadvantages. Therefore, I am seeking a unified shortcut key convention.

karthink commented 1 year ago

I see. Do you have a suggestion for a keybinding that works in both contexts?

hongyi-zhao commented 1 year ago

<f2> is already globally bound in Emacs, though.

Both. They have their own advantages and disadvantages. Therefore, I am seeking a unified shortcut key convention.

I've found that C-c C-RET is unbound in most major modes I've tried, that could be a viable option for you too.

In any case, I'm not going to bind gptel-send in the global map, so the user is free to choose whatever key they would like. When gptel-mode is active (in text, markdown or org-mode buffers) C-c RET takes precedence and is simpler than C-c C-RET, so I'm going to stick with that.

I'm closing this issue now, feel free to reopen if you think of a better keybinding.