How can I press C-g to quit the search bar?

I can press escape to quit the search bar, but I don’t know what command should I bind to C-g to make it quit the search bar as well. Any ideas? Thanks.

Hi @casouri and welcome to the forum!

This is just a guess, but you could try (toolbar-search-end)

I found a reference to it here:

Thanks! I tried to bind

("search C-s" (search-next-match #t))
("search C-r" (search-next-match #f))
("search C-g" (toolbar-search-end))

but it doesn’t seem to have any effect. Judging from the definition of search-toolbar-keypress, it seems that any keypress not mentioned in that function are ignored? The else clause calls (cancel-alt-selection "alternate") which I’m not sure the meaning of.

I tried binding to "C-g" (instead of "search C-g", as I suspect that “search” does not refer to any key) and I also do not obtain any effect.

Perhaps your hint about (cancel-alt-selection "alternate") being invoked for any key not listed in the definition of search-toolbar-keypress is correct; cancel_alt_selection, with underscores, is defined here src/Edit/Replace/edit_select.cpp, and then connected to cancel-alt-selection using the “glue”.

For the "search" in "search C-g" I do not know where and how “keys defined with a name” are defined, perhaps here:

github.com

It is Texmacs/Server/tm_config.cpp in the source of TeXmacs—I am not able to interpret the code, and I do not find the word “search”: so perhaps it is not a recognized name for a key??

I tried binding to "C-g" (instead of "search C-g" , as I suspect that “search” does not refer to any key) and I also do not obtain any effect.

I assume it is referred here:

I still do not understand to which key it refers.