;;; mu4e-update.el --- Update the mu4e message store -*- lexical-binding: t -*- ;; Copyright (C) 2011-2023 Dirk-Jan C. Binnema ;; Author: Dirk-Jan C. Binnema ;; Maintainer: Dirk-Jan C. Binnema ;; This file is not part of GNU Emacs. ;; mu4e is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; mu4e 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 mu4e. If not, see . ;;; Commentary: ;; Updating the mu4e message store: calling a mail retrieval program and ;; re-running the index. ;;; Code: (require 'mu4e-helpers) (require 'mu4e-server) ;;; Customization (defcustom mu4e-get-mail-command "true" "Shell command for retrieving new mail. Common values are \"offlineimap\", \"fetchmail\" or \"mbsync\", but arbitrary shell-commands can be used. When set to the literal string \"true\" (the default), the command simply finishes successfully (running the \"true\" command) without retrieving any mail. This can be useful when mail is already retrieved in another way, such as a local MDA." :type 'string :group 'mu4e :safe 'stringp) (defcustom mu4e-index-update-error-warning t "Whether to display warnings during the retrieval process. This depends on the `mu4e-get-mail-command' exit code." :type 'boolean :group 'mu4e :safe 'booleanp) (defcustom mu4e-index-update-error-continue t "Whether to continue with indexing after an error during retrieval." :type 'boolean :group 'mu4e :safe 'booleanp) (defcustom mu4e-index-update-in-background t "Whether to retrieve mail in the background." :type 'boolean :group 'mu4e :safe 'booleanp) (defcustom mu4e-index-cleanup t "Whether to run a cleanup phase after indexing. That is, validate that each message in the message store has a corresponding message file in the filesystem. Having this option as t ensures that no non-existing messages are shown but can slow with large message stores on slow file-systems." :type 'boolean :group 'mu4e :safe 'booleanp) (defcustom mu4e-index-lazy-check nil "Whether to only use a \"lazy\" check during reindexing. This influences how we decide whether a message needs (re)indexing or not. When this is set to non-nil, mu only uses the directory timestamps to decide whether it needs to check the messages beneath it. This makes indexing much faster, but might miss some changes. For this, you might want to occasionally call `mu4e-update-index-nonlazy'; `mu4e-update-pre-hook' can be used to automate this." :type 'boolean :group 'mu4e :safe 'booleanp) (defcustom mu4e-update-interval nil "Number of seconds between mail retrieval/indexing. If nil, don't update automatically. Note, changes in `mu4e-update-interval' only take effect after restarting mu4e. Important, the automatic update *only* works when `mu4e' is running." :type '(choice (const :tag "No automatic update" nil) (integer :tag "Seconds")) :group 'mu4e :safe 'integerp) (defvar mu4e-update-pre-hook nil "Hook run just *before* the mail-retrieval / database updating process starts. You can use this hook for example to `mu4e-get-mail-command' with some specific setting.") (defcustom mu4e-hide-index-messages nil "Whether to hide the \"Indexing...\" and contacts messages." :type 'boolean :group 'mu4e) (defvar mu4e-index-updated-hook nil "Hook run when the indexing process has completed. The variable `mu4e-index-update-status' can be used to get information about what changed.") (defvar mu4e-message-changed-hook nil "Hook run when there is a message changed in the data store. For new messages, it depends on `mu4e-index-updated-hook'. This can be used as a simple way to invoke some action when a message changed") (defvar mu4e-index-update-status nil "Last-seen completed update status, based on server status messages. If non-nil, this is a plist of the form: \( :checked (checked whether up-to-date) :updated