NeoMutt  2025-12-11-980-ge38c27
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
module.c File Reference

Definition of the Key Module. More...

#include "config.h"
#include <stdbool.h>
#include <stddef.h>
#include "mutt/lib.h"
#include "core/lib.h"
#include "init.h"
#include "module_data.h"
+ Include dependency graph for module.c:

Go to the source code of this file.

Functions

static bool key_init (struct NeoMutt *n)
 Initialise a Module - Implements Module::init()
 
static bool key_commands_register (struct NeoMutt *n, struct CommandArray *ca)
 Register NeoMutt Commands - Implements Module::commands_register()
 
static bool key_cleanup (struct NeoMutt *n, void *data)
 Clean up a Module - Implements Module::cleanup()
 
static bool key_gui_init (struct NeoMutt *n)
 Initialise the GUI - Implements Module::gui_init()
 
static void key_gui_cleanup (struct NeoMutt *n)
 Clean up the GUI - Implements Module::gui_cleanup()
 

Variables

const struct Command KeyCommands []
 All the registered Menus - moved to KeyModuleData All the registered SubMenus - moved to KeyModuleData AbortKey - moved to KeyModuleData.
 
const struct Module ModuleKey
 Module for the Key library.
 

Detailed Description

Definition of the Key Module.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file module.c.

Function Documentation

◆ key_init()

static bool key_init ( struct NeoMutt * n)
static

Initialise a Module - Implements Module::init()

Definition at line 42 of file module.c.

43{
44 struct KeyModuleData *mod_data = MUTT_MEM_CALLOC(1, struct KeyModuleData);
46
47 mod_data->notify = notify_new();
48 notify_set_parent(mod_data->notify, n->notify);
49
50 km_init(mod_data);
51
52 return true;
53}
void km_init(struct KeyModuleData *mod_data)
Initialise all the menu keybindings.
Definition init.c:172
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_KEY
ModuleKey, Key mappings
Definition module_api.h:74
struct Notify * notify_new(void)
Create a new notifications handler.
Definition notify.c:62
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition notify.c:95
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:680
Key private Module data.
Definition module_data.h:34
struct Notify * notify
Notifications.
Definition module_data.h:35
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
+ Here is the call graph for this function:

◆ key_commands_register()

static bool key_commands_register ( struct NeoMutt * n,
struct CommandArray * ca )
static

Register NeoMutt Commands - Implements Module::commands_register()

Definition at line 58 of file module.c.

59{
61}
bool commands_register(struct CommandArray *ca, const struct Command *cmds)
Add commands to Commands array.
Definition command.c:51
const struct Command KeyCommands[]
All the registered Menus - moved to KeyModuleData All the registered SubMenus - moved to KeyModuleDat...
Definition init.c:49
+ Here is the call graph for this function:

◆ key_cleanup()

static bool key_cleanup ( struct NeoMutt * n,
void * data )
static

Clean up a Module - Implements Module::cleanup()

Definition at line 66 of file module.c.

67{
68 struct KeyModuleData *mod_data = data;
69
70 notify_free(&mod_data->notify);
71
72 FREE(&mod_data);
73 return true;
74}
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition notify.c:75
+ Here is the call graph for this function:

◆ key_gui_init()

static bool key_gui_init ( struct NeoMutt * n)
static

Initialise the GUI - Implements Module::gui_init()

Definition at line 79 of file module.c.

80{
82 km_set_abort_key(&mod_data->abort_key);
83 return true;
84}
void km_set_abort_key(keycode_t *abort_key)
Parse the abort_key config string.
Definition init.c:234
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:666
keycode_t abort_key
Key to abort prompts, normally Ctrl-G.
Definition module_data.h:38
+ Here is the call graph for this function:

◆ key_gui_cleanup()

static void key_gui_cleanup ( struct NeoMutt * n)
static

Clean up the GUI - Implements Module::gui_cleanup()

Definition at line 89 of file module.c.

90{
92 km_cleanup(mod_data);
93}
void km_cleanup(struct KeyModuleData *mod_data)
Free the key maps.
Definition init.c:205
+ Here is the call graph for this function:

Variable Documentation

◆ KeyCommands

const struct Command KeyCommands[]
extern

All the registered Menus - moved to KeyModuleData All the registered SubMenus - moved to KeyModuleData AbortKey - moved to KeyModuleData.

Key Binding Commands

Definition at line 49 of file init.c.

49 {
50 // clang-format off
51 { "bind", CMD_BIND, parse_bind,
52 N_("Bind a key to a function"),
53 N_("bind <map>[,<map> ... ] <key> <function>"),
54 "configuration.html#bind" },
55 { "exec", CMD_EXEC, parse_exec,
56 N_("Execute a function"),
57 N_("exec <function> [ <function> ... ]"),
58 "configuration.html#exec" },
59 { "macro", CMD_MACRO, parse_macro,
60 N_("Define a keyboard macro"),
61 N_("macro <map>[,<map> ... ] <key> <sequence> [ <description> ]"),
62 "configuration.html#macro" },
63 { "push", CMD_PUSH, parse_push,
64 N_("Push a string into NeoMutt's input queue (simulate typing)"),
65 N_("push <string>"),
66 "configuration.html#push" },
67 { "unbind", CMD_UNBIND, parse_unbind,
68 N_("Remove a key binding"),
69 N_("unbind { * | <map>[,<map> ... ] } [ <key> ]"),
70 "configuration.html#unbind" },
71 { "unmacro", CMD_UNMACRO, parse_unbind,
72 N_("Remove a keyboard `macro`"),
73 N_("unmacro { * | <map>[,<map> ... ] } [ <key> ]"),
74 "configuration.html#unmacro" },
75
76 { NULL, CMD_NONE, NULL, NULL, NULL, NULL, CF_NONE },
77 // clang-format on
78};
@ CF_NONE
No flags are set.
Definition command.h:49
@ CMD_EXEC
:exec
Definition command.h:77
@ CMD_UNMACRO
:unmacro
Definition command.h:138
@ CMD_MACRO
:macro
Definition command.h:93
@ CMD_PUSH
:push
Definition command.h:104
@ CMD_NONE
No Command.
Definition command.h:62
@ CMD_BIND
:bind
Definition command.h:70
@ CMD_UNBIND
:unbind
Definition command.h:131
enum CommandResult parse_bind(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'bind' command - Implements Command::parse() -.
Definition commands.c:242
enum CommandResult parse_exec(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'exec' command - Implements Command::parse() -.
Definition commands.c:810
enum CommandResult parse_macro(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'macro' command - Implements Command::parse() -.
Definition commands.c:703
enum CommandResult parse_push(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'push' command - Implements Command::parse() -.
Definition commands.c:205
enum CommandResult parse_unbind(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'unbind' and 'unmacro' commands - Implements Command::parse() -.
Definition commands.c:676
#define N_(a)
Definition message.h:32

◆ ModuleKey

const struct Module ModuleKey
Initial value:
= {
"key",
NULL,
NULL,
}
static bool key_gui_init(struct NeoMutt *n)
Initialise the GUI - Implements Module::gui_init()
Definition module.c:79
static bool key_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register()
Definition module.c:58
static void key_gui_cleanup(struct NeoMutt *n)
Clean up the GUI - Implements Module::gui_cleanup()
Definition module.c:89
static bool key_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:42
static bool key_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:66

Module for the Key library.

Definition at line 98 of file module.c.

98 {
100 "key",
101 key_init,
102 NULL, // config_define_types
103 NULL, // config_define_variables
108};