#include "config.h"
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "icommands.h"
#include "pager/lib.h"
#include "functions.h"
#include "init.h"
#include "keymap.h"
#include "muttlib.h"
#include "opcodes.h"
#include "version.h"
Go to the source code of this file.
|
static enum CommandResult | icmd_bind (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err) |
| Parse 'bind' and 'macro' commands - Implements ICommand::parse() More...
|
|
static enum CommandResult | icmd_set (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err) |
| Parse 'set' command to display config - Implements ICommand::parse() More...
|
|
static enum CommandResult | icmd_version (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err) |
| Parse 'version' command - Implements ICommand::parse() More...
|
|
enum CommandResult | mutt_parse_icommand (char *line, struct Buffer *err) |
| Parse an informational command. More...
|
|
static void | dump_bind (struct Buffer *buf, struct Mapping *menu, struct Keymap *map) |
| Dump a bind map to a buffer. More...
|
|
static void | dump_macro (struct Buffer *buf, struct Mapping *menu, struct Keymap *map) |
| Dump a macro map to a buffer. More...
|
|
static bool | dump_menu (struct Buffer *buf, struct Mapping *menu, bool bind) |
| Dumps all the binds or macros maps of a menu into a buffer. More...
|
|
static void | dump_all_menus (struct Buffer *buf, bool bind) |
| Dumps all the binds or macros inside every menu. More...
|
|
Information commands
- Authors
- Christopher John Czettel
- Richard Russon
- Victor Fernandes
- Copyright
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
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 icommands.c.
◆ icmd_bind()
Parse 'bind' and 'macro' commands - Implements ICommand::parse()
Definition at line 230 of file icommands.c.
235 bool dump_all =
false, bind = (
data == 0);
257 if (menu_index == -1)
273 mutt_buffer_printf(err, bind ?
_(
"%s: no binds for this menu") :
_(
"%s: no macros for this menu"),
274 dump_all ?
"all" : buf->
data);
288 fputs(filebuf.
data, fp_out);
◆ icmd_set()
◆ icmd_version()
◆ mutt_parse_icommand()
Parse an informational command.
- Parameters
-
- Return values
-
Definition at line 78 of file icommands.c.
80 if (!line || (*line ==
'\0') || !err)
◆ dump_bind()
Dump a bind map to a buffer.
- Parameters
-
buf | Output buffer |
menu | Map menu |
map | Bind keymap |
Definition at line 118 of file icommands.c.
120 char key_binding[32];
121 const char *fn_name = NULL;
124 if (map->
op == OP_NULL)
◆ dump_macro()
Dump a macro map to a buffer.
- Parameters
-
buf | Output buffer |
menu | Map menu |
map | Macro keymap |
Definition at line 157 of file icommands.c.
◆ dump_menu()
static bool dump_menu |
( |
struct Buffer * |
buf, |
|
|
struct Mapping * |
menu, |
|
|
bool |
bind |
|
) |
| |
|
static |
Dumps all the binds or macros maps of a menu into a buffer.
- Parameters
-
buf | Output buffer |
menu | Menu to dump |
bind | If true it's :bind, else :macro |
- Return values
-
bool | true if menu is empty, false if not |
Definition at line 185 of file icommands.c.
188 struct Keymap *map = NULL;
192 if (bind && (map->
op != OP_MACRO))
197 else if (!bind && (map->
op == OP_MACRO))
◆ dump_all_menus()
static void dump_all_menus |
( |
struct Buffer * |
buf, |
|
|
bool |
bind |
|
) |
| |
|
static |
Dumps all the binds or macros inside every menu.
- Parameters
-
buf | Output buffer |
bind | If true it's :bind, else :macro |
Definition at line 212 of file icommands.c.
217 struct Mapping menu = { menu_name, i };
219 const bool empty =
dump_menu(buf, &menu, bind);
◆ ICommandList
Initial value:
All available informational commands.
- Note
- These commands take precedence over conventional NeoMutt rc-lines
Definition at line 59 of file icommands.c.
@ MENU_GENERIC
Generic selection list.
static enum CommandResult icmd_version(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse 'version' command - Implements ICommand::parse()
char * macro
macro expansion (op == OP_MACRO)
Mapping between a user key and a function.
struct KeymapList Keymaps[MENU_MAX]
Array of Keymap keybindings, one for each Menu.
String manipulation buffer.
void mutt_buffer_seek(struct Buffer *buf, size_t offset)
set current read/write position to offset from beginning
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
const struct Binding * km_get_table(enum MenuType menu)
Lookup a menu's keybindings.
int mutt_buffer_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
#define MUTT_TOKEN_NO_FLAGS
No flags are set.
short op
operation to perform
char * dptr
Current read/write position.
#define CS_DUMP_ONLY_CHANGED
Only show config that the user has changed.
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
#define STAILQ_FOREACH(var, head, field)
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
#define CS_DUMP_NO_FLAGS
No flags are set.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Mapping between user-readable string and a constant.
char * name
Name of the command.
size_t escape_string(struct Buffer *buf, const char *src)
Write a string to a buffer, escaping special characters.
int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags)
Extract one token from a string.
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
int mutt_do_pager(const char *banner, const char *tempfile, PagerFlags do_color, struct Pager *info)
Display some page-able text to the user.
bool dump_config(struct ConfigSet *cs, ConfigDumpFlags flags, FILE *fp)
Write all the config to a file.
struct ConfigSet * cs
Parent ConfigSet.
static void dump_macro(struct Buffer *buf, struct Mapping *menu, struct Keymap *map)
Dump a macro map to a buffer.
static enum CommandResult icmd_bind(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse 'bind' and 'macro' commands - Implements ICommand::parse()
const char * mutt_get_func(const struct Binding *bindings, int op)
Get the name of a function.
int km_expand_key(char *s, size_t len, struct Keymap *map)
Get the key string bound to a Keymap.
const struct Mapping Menus[]
Menu name lookup table.
@ MUTT_CMD_SUCCESS
Success: Command worked.
@ MUTT_CMD_ERROR
Error: Can't help the user.
CommandResult
Error codes for command_t parse functions.
static enum CommandResult icmd_set(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse 'set' command to display config - Implements ICommand::parse()
#define mutt_mktemp(buf, buflen)
Container for Accounts, Notifications.
static void dump_all_menus(struct Buffer *buf, bool bind)
Dumps all the binds or macros inside every menu.
int mutt_map_get_value(const char *name, const struct Mapping *map)
Lookup the constant for a string.
@ MENU_EDITOR
Text entry area.
char * desc
description of a macro for the help menu
struct ConfigSubset * sub
Inherited config items.
const struct ICommand ICommandList[]
All available informational commands.
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
void print_version(FILE *fp)
Print system and compile info to a file.
char * data
Pointer to data.
const struct Binding OpGeneric[]
Key bindings for the generic menu.
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
static void dump_bind(struct Buffer *buf, struct Mapping *menu, struct Keymap *map)
Dump a bind map to a buffer.
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
static bool dump_menu(struct Buffer *buf, struct Mapping *menu, bool bind)
Dumps all the binds or macros maps of a menu into a buffer.
@ MENU_PAGER
Pager pager (email viewer)
enum CommandResult(* parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Function to parse information commands.