From 6b4857b189d251411638da3236a3b2b5e1d5fb10 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sun, 29 Jan 2023 12:02:25 +0200 Subject: [PATCH] mu-scanner: ignore some more unusable files --- lib/index/mu-scanner.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/index/mu-scanner.cc b/lib/index/mu-scanner.cc index df768c43..30157c0d 100644 --- a/lib/index/mu-scanner.cc +++ b/lib/index/mu-scanner.cc @@ -70,10 +70,18 @@ is_dotdir(const char *d_name) } static bool -is_ignoredir(const char *d_name) +do_ignore(const char *d_name) { - /* gnus? */ - if (d_name[0] == '.' && g_strcmp0(d_name + 1, "nnmaildir") == 0) + if (d_name[0] == '.') { + if (d_name[1] == '#') /* emacs? */ + return true; + if (g_strcmp0(d_name + 1, "nnmaildir") == 0) /* gnus? */ + return true; + if (g_strcmp0(d_name + 1, "notmuch") == 0) /* notmuch? */ + return true; + } + + if (g_strcmp0(d_name, "hcache.db") == 0) /* mutt cache? */ return true; return false; @@ -87,8 +95,8 @@ Scanner::Private::process_dentry(const std::string& path, struct dirent *dentry, if (is_dotdir(d_name) || std::strcmp(d_name, "tmp") == 0) return true; // ignore. - if (is_ignoredir(d_name)) { - g_debug("skip %s/%s (ignore-dir)", path.c_str(), d_name); + if (do_ignore(d_name)) { + g_debug("skip %s/%s (ignore)", path.c_str(), d_name); return true; // ignore }