Skip to content

Instantly share code, notes, and snippets.

View flatcap's full-sized avatar
🥾
Hiking in Scotland

Richard Russon flatcap

🥾
Hiking in Scotland
View GitHub Profile

Fixing NeoMutt's Browser

Discussions

I suggest we try, as much as possible to focus our work on browser.c/h and not altering the code of any other file. This way, we can work in a specific branch and have a specific architecture in the file that will merge more efficiently. Then, when we merge, we can split the content of the file into many smaller files if that is relevant, of course.

Yes, or a separate file completely. New file, new history.

@flatcap
flatcap / stats.sh
Created March 6, 2018 15:37
Translation Statistics
#!/bin/bash
# -c = --check
# = --check-format --check-header --check-domain
[ $# = 0 ] && ARGS="*.po" || ARGS="$@"
for i in $ARGS; do
echo -ne "${i%.po}:\t"
msgfmt --statistics -c -o /dev/null $i 2>&1
@flatcap
flatcap / menu.md
Last active September 17, 2018 20:54
Medium Tasks

Style Menu Options

Looking for something easier? (try these)

Description

When NeoMutt asks a question, the menu options are usually given with parenthesised letters or "number-colon", e.g.

  • (R)eject, accept (O)nce, (A)ccept always, (S)kip
@flatcap
flatcap / dirname.c
Last active September 17, 2018 20:55
dirname
char *mutt_file_dirname(const char *path)
{
char *copy = mutt_str_strdup(path);
char *dir = dirname(copy);
if (dir != copy)
{
FREE(&copy);
dir = strdup(dir);
}
return dir;
@flatcap
flatcap / test-dirname.c
Created May 3, 2018 11:28
Test dirname wrapper
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <libgen.h>
#define mutt_array_size(x) (sizeof(x) / sizeof((x)[0]))
void *mutt_mem_malloc(size_t size)
{
void *p = NULL;
@flatcap
flatcap / apple.c
Last active September 17, 2018 20:54
STAILQ objects
#include <stdio.h>
#include "mutt/queue.h"
struct Apple
{
int payload;
};
struct AppleNode
{
@flatcap
flatcap / context.cocci
Created July 2, 2018 20:59
Transform struct Context members
@@
struct Context *c;
@@
- c->tagged
+ c->nr_tagged
@flatcap
flatcap / buffy.md
Created August 4, 2018 08:56
Killing Buffy
Before After
MUTT_BUFFY MUTT_MAILBOX
MUTT_BUFFY_CHECK_FORCE MUTT_MAILBOX_CHECK_FORCE
MUTT_BUFFY_CHECK_FORCE_STATS MUTT_MAILBOX_CHECK_FORCE_STATS
MUTT_SEL_BUFFY MUTT_SEL_MAILBOX
OP_BUFFY_LIST OP_BUFFY_LIST
OP_EDITOR_BUFFY_CYCLE OP_EDITOR_BUFFY_CYCLE
buffy_check mailbox_check
OK, I've got it (I'm not sure I entirely understand, but...) I have individually coloured tags
it's all to do with the tag transforms -- it's a little complicated...
have a look at the 'tag-transforms' and 'tag-formats' in the config file: https://www.neomutt.org/feature/custom-tags#neomuttrc
imagine you have emails notmuch-tagged/labelled with 'inbox', 'invites', 'replied'
this command allows you to abbreviate/iconise the tags: tag-transforms inbox i invites CAL replied ↻
this command allows you to create expandos (%-things) for *individual* tags: tag-formats inbox GI invites Gi replied GR
you can now use %GI %Gi %GR in your index_format string
finally, you can colour *these* expandos using: color index_tag, e.g.
color index_tag red default inbox
color index_tag cyan default invites
@flatcap
flatcap / nftw1.c
Last active October 17, 2022 21:48
Directory Traversal
/* We want POSIX.1-2008 + XSI, i.e. SuSv4, features */
#define _XOPEN_SOURCE 700
/* Added on 2017-06-25:
If the C library can support 64-bit file sizes
and offsets, using the standard names,
these defines tell the C library to do so. */
#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64