NeoMutt  2020-04-24
Teaching an old dog new tricks
DOXYGEN
keymap.h
Go to the documentation of this file.
1 
23 #ifndef MUTT_KEYMAP_H
24 #define MUTT_KEYMAP_H
25 
26 #include "config.h"
27 #include <stddef.h>
28 #include "mutt/lib.h"
29 #include "mutt_commands.h"
30 
31 #define MUTT_UNBIND 1<<0
32 #define MUTT_UNMACRO 1<<1
33 /* maximal length of a key binding sequence used for buffer in km_bindkey */
34 #define MAX_SEQ 8
35 
36 /* type for key storage, the rest of neomutt works fine with int type */
37 typedef short keycode_t;
38 
39 void init_extended_keys(void);
40 
46 struct Keymap
47 {
48  char *macro;
49  char *desc;
50  struct Keymap *next;
51  short op;
52  short eq;
53  short len;
55 };
56 
60 struct KeyEvent
61 {
62  int ch;
63  int op;
64 };
65 
70 {
83 #ifdef CRYPT_BACKEND_GPGME
86 #endif
87 #ifdef MIXMASTER
89 #endif
90 #ifdef USE_AUTOCRYPT
92 #endif
94 };
95 
96 int km_expand_key(char *s, size_t len, struct Keymap *map);
97 struct Keymap *km_find_func(enum MenuType menu, int func);
98 void km_init(void);
99 void km_error_key(enum MenuType menu);
100 void mutt_what_key(void);
101 void mutt_init_abort_key(void);
103 
104 enum CommandResult km_bind(char *s, enum MenuType menu, int op, char *macro, char *desc);
105 int km_dokey(enum MenuType menu);
106 
107 extern struct Keymap *Keymaps[];
108 
109 extern int LastKey;
110 extern keycode_t AbortKey;
111 
112 extern const struct Mapping Menus[];
113 
117 struct Binding
118 {
119  const char *name;
120  int op;
121  const char *seq;
122 };
123 
124 const struct Binding *km_get_table(enum MenuType menu);
125 const char *mutt_get_func(const struct Binding *bindings, int op);
126 
127 void mutt_keys_free(void);
128 
129 enum CommandResult mutt_parse_bind(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
130 enum CommandResult mutt_parse_exec(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
131 enum CommandResult mutt_parse_macro(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
132 enum CommandResult mutt_parse_push(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
133 enum CommandResult mutt_parse_unbind(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
134 enum CommandResult mutt_parse_unmacro(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
135 
136 #endif /* MUTT_KEYMAP_H */
short eq
number of leading keys equal to next entry
Definition: keymap.h:52
PGP encryption menu.
Definition: keymap.h:81
CommandResult
Error codes for command_t parse functions.
Definition: mutt_commands.h:33
Data passed to a notification function.
Definition: observer.h:39
MenuType
Types of GUI selections.
Definition: keymap.h:69
void init_extended_keys(void)
Initialise map of ncurses extended keys.
Definition: keymap.c:939
int op
function id number
Definition: keymap.h:120
enum CommandResult mutt_parse_exec(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;exec&#39; command - Implements Command::parse()
Definition: keymap.c:1574
keycode_t * keys
key sequence
Definition: keymap.h:54
enum CommandResult mutt_parse_push(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;push&#39; command - Implements Command::parse()
Definition: keymap.c:1151
enum CommandResult mutt_parse_unmacro(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
General file/mailbox browser.
Definition: keymap.h:75
String manipulation buffer.
Definition: buffer.h:33
Compose an email.
Definition: keymap.h:73
int op
function op
Definition: keymap.h:63
int ch
raw key pressed
Definition: keymap.h:62
Index panel (list of emails)
Definition: keymap.h:77
void mutt_what_key(void)
Ask the user to press a key.
Definition: keymap.c:1621
int LastKey
Last real key pressed, recorded by dokey()
Definition: keymap.c:146
enum CommandResult mutt_parse_bind(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;bind&#39; command - Implements Command::parse()
Definition: keymap.c:1314
enum CommandResult mutt_parse_unbind(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unbind&#39; command - Implements Command::parse()
Definition: keymap.c:1455
const char * mutt_get_func(const struct Binding *bindings, int op)
Get the name of a function.
Definition: keymap.c:501
SMIME encryption menu.
Definition: keymap.h:82
Pager pager (email viewer)
Definition: keymap.h:78
void mutt_init_abort_key(void)
Parse the abort_key config string.
Definition: keymap.c:825
Select from results of external query.
Definition: keymap.h:80
const char * name
name of the function
Definition: keymap.h:119
short op
operation to perform
Definition: keymap.h:51
keycode_t AbortKey
key to abort edits etc, normally Ctrl-G
Definition: keymap.c:147
void km_init(void)
Initialise all the menu keybindings.
Definition: keymap.c:968
void km_error_key(enum MenuType menu)
Handle an unbound key sequence.
Definition: keymap.c:1095
void mutt_keys_free(void)
Free the key maps.
Definition: keymap.c:1643
struct Keymap * next
next key in map
Definition: keymap.h:50
int mutt_abort_key_config_observer(struct NotifyCallback *nc)
Listen for abort_key config changes - Implements observer_t.
Definition: keymap.c:846
Select an attachment.
Definition: keymap.h:72
char * macro
macro expansion (op == OP_MACRO)
Definition: keymap.h:48
Select a PGP key.
Definition: keymap.h:84
int km_dokey(enum MenuType menu)
Determine what a keypress should do.
Definition: keymap.c:619
Definitions of NeoMutt commands.
An event such as a keypress.
Definition: keymap.h:60
short keycode_t
Definition: keymap.h:37
char * desc
description of a macro for the help menu
Definition: keymap.h:49
Select an email address by its alias.
Definition: keymap.h:71
A keyboard mapping.
Definition: keymap.h:46
struct Keymap * km_find_func(enum MenuType menu, int func)
Find a function&#39;s mapping in a Menu.
Definition: keymap.c:898
short len
length of key sequence (unit: sizeof (keycode_t))
Definition: keymap.h:53
const struct Mapping Menus[]
Menu name lookup table.
Definition: keymap.c:61
const struct Binding * km_get_table(enum MenuType menu)
Lookup a menu&#39;s keybindings.
Definition: keymap.c:1264
enum CommandResult mutt_parse_macro(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;macro&#39; command - Implements Command::parse()
Definition: keymap.c:1520
enum CommandResult km_bind(char *s, enum MenuType menu, int op, char *macro, char *desc)
Bind a key to a macro.
Definition: keymap.c:440
Create/edit a Mixmaster chain.
Definition: keymap.h:88
const char * seq
default key binding
Definition: keymap.h:121
Select a SMIME key.
Definition: keymap.h:85
Mapping between user-readable string and a constant.
Definition: mapping.h:29
Text entry area.
Definition: keymap.h:74
Convenience wrapper for the library headers.
Mapping between a user key and a function.
Definition: keymap.h:117
Select a postponed email.
Definition: keymap.h:79
int km_expand_key(char *s, size_t len, struct Keymap *map)
Get the key string bound to a Keymap.
Definition: keymap.c:870
Generic selection list.
Definition: keymap.h:76