Skip to content

Commit

Permalink
mu4e-query-items: improve documentation
Browse files Browse the repository at this point in the history
Possibly useful for #2741.
  • Loading branch information
djcb committed Aug 16, 2024
1 parent e04d1cf commit 806033f
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions mu4e/mu4e-query-items.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;; mu4e-query-items.el --- Manage query results -*- lexical-binding: t -*-

;; Copyright (C) 2023 Dirk-Jan C. Binnema
;; Copyright (C) 2023-2024 Dirk-Jan C. Binnema

;; Author: Dirk-Jan C. Binnema <[email protected]>
;; Maintainer: Dirk-Jan C. Binnema <[email protected]>
Expand Down Expand Up @@ -94,8 +94,8 @@ If ITEMS does not yet have a favorite item, pick the first."
(defvar mu4e--bookmark-items-cached nil "Cached bookmarks query items.")
(defvar mu4e--maildir-items-cached nil "Cached maildirs query items.")

(declare-function mu4e-bookmarks "mu4e-bookmarks")
(declare-function mu4e-maildir-shortcuts "mu4e-folders")
(declare-function mu4e-bookmarks "mu4e-bookmarks")
(declare-function mu4e-maildir-shortcuts "mu4e-folders")

(defun mu4e--query-item-display-counts (item)
"Get the count display string for some query-data ITEM."
Expand Down Expand Up @@ -222,18 +222,32 @@ bookmark or maildir."
data))

(defun mu4e-query-items (&optional type)
"Grab query items of TYPE.
"Grab cached information about query items of some TYPE.
TYPE is symbol; either bookmarks or maildirs, or nil for both.
TYPE is a symbol; either `bookmarks' or `maildirs', or nil for
both, and returns a list of plists. The information is based on
the last (cached) information known by mu4e.
This combines:
- the latest queries data (i.e., `(mu4e-server-query-items)')
- baseline queries data (i.e. `mu4e-baseline')
with the combined queries for `(mu4e-bookmarks)' and
`(mu4e-maildir-shortcuts)' in bookmarks-compatible plists.
This packages the aggregated information in a format that is convenient
for use in various places."
- the latest queries data (i.e., `(mu4e-server-query-items)')
- baseline queries data (i.e. `mu4e-baseline') with the combined
queries for `mu4e-bookmarks' and `mu4e-maildir-shortcuts' in
bookmarks-compatible plists.
Currently, the plist contains the following fields:
- `:name' - the name of the bookmark or query
- `:query' - the associated (unprocessed) query
- `:count' - number of matches for the query
- `:unread' - number of unread messages for the query
- `:delta-count' - change in count since baseline
- `:delta-unread' - change in unread count since baseline
- `:favorite' - non-nil if this is the favorite query
There are some other fields for internal mu4e use, better not use
those externally.
For the various nuances with the unread count and baseline,
please refer to info node `(mu4e) Bookmarks and Maildirs'."
(cond
((equal type 'bookmarks)
(or mu4e--bookmark-items-cached
Expand Down

0 comments on commit 806033f

Please sign in to comment.