summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2019-07-21 12:30:44 +0200
committerRicardo Wurmus <rekado@elephly.net>2019-07-21 13:11:39 +0200
commit64bf6d70099c59ea442bf1641caaab8ad03ce9cd (patch)
tree7704da71442805deb0c0657fcee36c938d324a86
parentcaa127d37e9e682a461b0d628b58eb80e074c792 (diff)
scripts: Regularly index the mail directory.
* configure.ac: Detect mu. * guix.scm: Add "mu" to the environment. * mumi/config.scm.in (%config)[mu-executable]: Add it. * scripts/mumi.in: Spawn "mu index" regularly.
-rw-r--r--configure.ac2
-rw-r--r--guix.scm3
-rw-r--r--mumi/config.scm.in1
-rw-r--r--scripts/mumi.in17
4 files changed, 22 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index f24c741..8b66861 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,6 +31,8 @@ if test "x$have_fibers" != "xyes"; then
AC_MSG_ERROR([Guile fibers is missing; please install it.])
fi
+AC_PATH_PROG([MU], [mu])
+
guilemoduledir="${datarootdir}/guile/site/${GUILE_EFFECTIVE_VERSION}"
AC_SUBST([guilemoduledir])
AC_SUBST([GUILE_EFFECTIVE_VERSION])
diff --git a/guix.scm b/guix.scm
index 03535c2..dfda6cd 100644
--- a/guix.scm
+++ b/guix.scm
@@ -73,7 +73,8 @@
("guile-json" ,guile-json)
("guile-fibers" ,guile-fibers)
("guile-syntax-highlight" ,guile-syntax-highlight)
- ("guile" ,guile-2.2)))
+ ("guile" ,guile-2.2)
+ ("mu" ,mu)))
(native-inputs
`(("autoconf" ,autoconf)
("automake" ,automake)
diff --git a/mumi/config.scm.in b/mumi/config.scm.in
index 098e2e8..9d8a9c3 100644
--- a/mumi/config.scm.in
+++ b/mumi/config.scm.in
@@ -46,6 +46,7 @@
(submission-bug-email-address . "bug-guix@gnu.org")
(lists . ("guix-patches@gnu.org" "bug-guix@gnu.org"))
(packages . ("guix-patches" "guix"))
+ (mu-executable . "@MU@")
(debbugs . ,%gnu)
(debbugs-domain . "debbugs.gnu.org"))))
(lambda (key)
diff --git a/scripts/mumi.in b/scripts/mumi.in
index 2abfd51..3bd34f4 100644
--- a/scripts/mumi.in
+++ b/scripts/mumi.in
@@ -94,4 +94,21 @@
(when repl-port
(spawn-server (make-tcp-server-socket #:port repl-port)))))))
+;; Keep indexing the mail directory
+(define %mu-index-interval 30)
+(define mu-index
+ (let ((mu (%config 'mu-executable)))
+ (lambda _
+ (let* ((maildir (%config 'mail-dir))
+ (args (list "index"
+ "--quiet"
+ (format #f "--muhome=~a" maildir)
+ (format #f "--maildir=~a" maildir))))
+ (unless (zero? (apply system* mu args))
+ (format (current-error-port)
+ "Failed to run `~a'~%" command))
+ (alarm %mu-index-interval)))))
+(sigaction SIGALRM mu-index 0)
+(mu-index)
+
(start-mumi-web-server 1234)