mu4e: handle xapian single-threaded operation
Provide user feedback when we need to wait for the indexing to finish. Suffix the version with "-st" when this is the case.
This commit is contained in:
@ -16,6 +16,11 @@
|
||||
|
||||
|
||||
# generate some build data for use in mu4e
|
||||
version_extra=''
|
||||
if get_option('xapian-single-threaded')
|
||||
version_extra='-st'
|
||||
endif
|
||||
|
||||
mu4e_meta = configure_file(
|
||||
input: 'mu4e-config.el.in',
|
||||
output: 'mu4e-config.el',
|
||||
@ -23,6 +28,7 @@ mu4e_meta = configure_file(
|
||||
install_dir: mu4e_lispdir,
|
||||
configuration: {
|
||||
'VERSION' : meson.project_version(),
|
||||
'MU_VERSION_EXTRA' : version_extra,
|
||||
'MU_DOC_DIR' : join_paths(datadir, 'doc', 'mu'),
|
||||
})
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
;;; mu4e-main.el --- The Main interface for mu4e -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2011-2023 Dirk-Jan C. Binnema
|
||||
;; Copyright (C) 2011-2024 Dirk-Jan C. Binnema
|
||||
|
||||
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
@ -299,7 +299,9 @@ Otherwise, do nothing."
|
||||
"* "
|
||||
(propertize "mu4e" 'face 'mu4e-header-key-face)
|
||||
(propertize " - mu for emacs version " 'face 'mu4e-title-face)
|
||||
(propertize mu4e-mu-version 'face 'mu4e-header-key-face)
|
||||
(propertize (concat mu4e-mu-version
|
||||
(if (mu4e--server-xapian-single-threaded-p) "-st" ""))
|
||||
'face 'mu4e-header-key-face)
|
||||
"\n\n"
|
||||
(propertize " Basics\n\n" 'face 'mu4e-title-face)
|
||||
(mu4e--main-action
|
||||
|
||||
@ -188,6 +188,11 @@ for bookmarks and maildirs.")
|
||||
"Get the latest server query items."
|
||||
mu4e--server-query-items)
|
||||
|
||||
;; temporary
|
||||
(defun mu4e--server-xapian-single-threaded-p()
|
||||
"Are we using Xapian in single-threaded mode?"
|
||||
(plist-get mu4e--server-props :xapian-single-threaded))
|
||||
|
||||
|
||||
;;; Handling raw server data
|
||||
|
||||
@ -210,6 +215,9 @@ for bookmarks and maildirs.")
|
||||
mu4e--server-cookie-post)
|
||||
"Regular expression matching the length cookie.
|
||||
Match 1 will be the length (in hex).")
|
||||
|
||||
(defvar mu4e--server-indexing nil "Currently indexing?")
|
||||
|
||||
|
||||
(defun mu4e-running-p ()
|
||||
"Whether mu4e is running.
|
||||
@ -383,6 +391,11 @@ The server output is as follows:
|
||||
|
||||
;; get some info
|
||||
((plist-get sexp :info)
|
||||
;; when indexing is finished, remove the block
|
||||
(when (and (eq (plist-get sexp :info) 'index)
|
||||
(eq (plist-get sexp :status) 'complete))
|
||||
(setq mu4e--server-indexing nil))
|
||||
|
||||
(funcall mu4e-info-func sexp))
|
||||
|
||||
;; get some data
|
||||
@ -486,6 +499,7 @@ You cannot run the repl when mu4e is running (or vice-versa)."
|
||||
(proc (and (buffer-live-p buf) (get-buffer-process buf))))
|
||||
(when proc
|
||||
(mu4e-message "shutting down")
|
||||
(setq mu4e--server-indexing nil)
|
||||
(set-process-filter mu4e--server-process nil)
|
||||
(set-process-sentinel mu4e--server-process nil)
|
||||
(let ((delete-exited-processes t))
|
||||
@ -526,7 +540,11 @@ You cannot run the repl when mu4e is running (or vice-versa)."
|
||||
|
||||
(defun mu4e--server-call-mu (form)
|
||||
"Call the mu server with some command FORM."
|
||||
(unless (mu4e-running-p) (mu4e--server-start))
|
||||
(unless (mu4e-running-p)
|
||||
(mu4e--server-start))
|
||||
;; in single-threaded mode, mu can't accept our command right now.
|
||||
(when (and (mu4e--server-xapian-single-threaded-p) mu4e--server-indexing)
|
||||
(mu4e-warn "Cannot handle command while indexing, please retry later."))
|
||||
(let* ((print-length nil) (print-level nil)
|
||||
(cmd (format "%S" form)))
|
||||
(mu4e-log 'to-server "%s" cmd)
|
||||
@ -600,7 +618,8 @@ added or removed), since merely editing a message does not update
|
||||
the directory time stamp."
|
||||
(mu4e--server-call-mu
|
||||
`(index :cleanup ,(and cleanup t)
|
||||
:lazy-check ,(and lazy-check t))))
|
||||
:lazy-check ,(and lazy-check t)))
|
||||
(setq mu4e--server-indexing t)) ;; remember we're indexing.
|
||||
|
||||
(defun mu4e--server-mkdir (path &optional update)
|
||||
"Create a new maildir-directory at filesystem PATH.
|
||||
|
||||
Reference in New Issue
Block a user