NeoMutt  2025-12-11-911-gd8d604
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 "extended.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 43 of file module.c.

44{
45 struct KeyModuleData *mod_data = MUTT_MEM_CALLOC(1, struct KeyModuleData);
47
48 mod_data->notify = notify_new();
49 notify_set_parent(mod_data->notify, n->notify);
50
51 km_init(mod_data);
52
53 return true;
54}
void km_init(struct KeyModuleData *mod_data)
Initialise all the menu keybindings.
Definition init.c:170
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_KEY
ModuleKey, Key mappings
Definition module_api.h:73
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:677
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 59 of file module.c.

60{
62}
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:48
+ 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 67 of file module.c.

68{
69 struct KeyModuleData *mod_data = data;
70
71 notify_free(&mod_data->notify);
72
73 FREE(&mod_data);
74 return true;
75}
#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 80 of file module.c.

81{
83 km_set_abort_key(&mod_data->abort_key);
84 return true;
85}
void km_set_abort_key(keycode_t *abort_key)
Parse the abort_key config string.
Definition init.c:236
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
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 90 of file module.c.

91{
93 km_cleanup(mod_data);
94}
void km_cleanup(struct KeyModuleData *mod_data)
Free the key maps.
Definition init.c:203
+ 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 48 of file init.c.

48 {
49 // clang-format off
50 { "bind", CMD_BIND, parse_bind,
51 N_("Bind a key to a function"),
52 N_("bind <map>[,<map> ... ] <key> <function>"),
53 "configuration.html#bind" },
54 { "exec", CMD_EXEC, parse_exec,
55 N_("Execute a function"),
56 N_("exec <function> [ <function> ... ]"),
57 "configuration.html#exec" },
58 { "macro", CMD_MACRO, parse_macro,
59 N_("Define a keyboard macro"),
60 N_("macro <map>[,<map> ... ] <key> <sequence> [ <description> ]"),
61 "configuration.html#macro" },
62 { "push", CMD_PUSH, parse_push,
63 N_("Push a string into NeoMutt's input queue (simulate typing)"),
64 N_("push <string>"),
65 "configuration.html#push" },
66 { "unbind", CMD_UNBIND, parse_unbind,
67 N_("Remove a key binding"),
68 N_("unbind { * | <map>[,<map> ... ] } [ <key> ]"),
69 "configuration.html#unbind" },
70 { "unmacro", CMD_UNMACRO, parse_unbind,
71 N_("Remove a keyboard `macro`"),
72 N_("unmacro { * | <map>[,<map> ... ] } [ <key> ]"),
73 "configuration.html#unmacro" },
74
75 { NULL, CMD_NONE, NULL, NULL, NULL, NULL, CF_NONE },
76 // clang-format on
77};
@ 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:241
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:788
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:681
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:204
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:654
#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:80
static bool key_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register()
Definition module.c:59
static void key_gui_cleanup(struct NeoMutt *n)
Clean up the GUI - Implements Module::gui_cleanup()
Definition module.c:90
static bool key_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:43
static bool key_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:67

Module for the Key library.

Definition at line 99 of file module.c.

99 {
101 "key",
102 key_init,
103 NULL, // config_define_types
104 NULL, // config_define_variables
109};