NeoMutt  2023-05-17-33-gce4425
Teaching an old dog new tricks
mutt_history.c File Reference

Read/write command history from/to a file. More...

#include "config.h"
#include <stdio.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "mutt_history.h"
#include "history/lib.h"
+ Include dependency graph for mutt_history.c:

Go to the source code of this file.


void mutt_hist_complete (char *buf, size_t buflen, enum HistoryClass hclass)
 Complete a string from a history list. More...
int main_hist_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...

Detailed Description

Read/write command history from/to a file.

  • Michael R. Elkins

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

Definition in file mutt_history.c.

Function Documentation

◆ mutt_hist_complete()

void mutt_hist_complete ( char *  buf,
size_t  buflen,
enum HistoryClass  hclass 

Complete a string from a history list.

bufBuffer in which to save string
buflenBuffer length
hclassHistory list to use

Definition at line 43 of file mutt_history.c.

45 const short c_history = cs_subset_number(NeoMutt->sub, "history");
46 char **matches = mutt_mem_calloc(c_history, sizeof(char *));
47 int match_count = mutt_hist_search(buf, hclass, matches);
48 if (match_count)
49 {
50 if (match_count == 1)
51 mutt_str_copy(buf, matches[0], buflen);
52 else
53 dlg_select_history(buf, buflen, matches, match_count);
54 }
55 FREE(&matches);
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
Definition: helpers.c:169
void dlg_select_history(char *buf, size_t buflen, char **matches, int match_count)
Select an item from a history list.
Definition: dlg_history.c:127
int mutt_hist_search(const char *search_buf, enum HistoryClass hclass, char **matches)
Find matches in a history list.
Definition: history.c:411
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
#define FREE(x)
Definition: memory.h:43
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:653
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function: