[main]Notes on TeXmacs
Following up from this forum post, let us see how to write a keyboard shortcut for a command available from a menu item.
The forum post asks how to define a keyboard shortcut for inserting a
footnote, which can be done through the menu item
To do so, we need to find out which Scheme command is associated to the menu item and then write a keyboard shortcut for that command in my-init-texmacs.scm (see Section 12.4 of the TeXmacs manual for the definition of personal keyboard shortcuts).
I don't think a list of commands associated to menu items exists and I am not aware of an automatic way for generating it (id est, if one wants such an automatic way, one needs to write a program that does that :-)).
Listing these commands by hand takes time and patience and if the files where the menus are defined change from release to release the list becomes outdated when there are new releases.
Here is what I do: I do a search on the TeXmacs GitHub repository using as search key the menu item name (in this case “footnote”), in the search results I select only the Scheme files and I go through them looking for the menu item.
For “footnote” I found in the file
(kbd-map ("A-e f" (make 'footnote)))
in
Forum member @jeroen uses ack for searching through the TeXmacs Scheme files on the local disk, perhaps you like that more than the GitHub search I do. Here are the advantages and disadvantages of the two search methods as I see them.
Searching on GitHub is intuitive; enter the search term into the search box when at the repository one wants to search in, one is offered the option to search “In this repository” and clicking on the option starts the search. One can then filter the search results by file type, for example one can choose only Scheme files.
One can also limit the search to a path by means of the
footnote path:texmacs/progs
On the other search is not case sensitive and “(a)t most, search results can show two fragments from the same file, but there may be more results within the file” (from GitHub code search online manual, and here is the main page for the GitHub search as well); if one does not see the code lines they are looking for in the search results, they have to open each file GitHub has found and repeat the search in there (maybe with the browser's search facility).
With
ack Footnote
(case sensitive: it helps, because the menu item we are looking for is
uppercase) from the terminal when in the