diff options
| -rw-r--r-- | NEWS.org | 3 | ||||
| -rw-r--r-- | scm/mu-scm-test.scm | 3 | ||||
| -rw-r--r-- | scm/mu-scm.scm | 21 | ||||
| -rw-r--r-- | scm/mu-scm.texi | 8 |
4 files changed, 30 insertions, 5 deletions
@@ -331,6 +331,9 @@ nicer to return an empty list instead, which what we now do. Technically a breaking change, but justified while we are still 'experimental'. + - 1.12.14: new convenience methods ~root-maildir~ and ~personal-addresses~ for + store objects. See the reference manual for details. + *** Contributors Thanks to our contributors - code committers belows, but also to everyone diff --git a/scm/mu-scm-test.scm b/scm/mu-scm-test.scm index 3c9b72f..3ecfb36 100644 --- a/scm/mu-scm-test.scm +++ b/scm/mu-scm-test.scm @@ -13,6 +13,9 @@ (test-assert (personal? "user@example.com")) (test-assert (not (personal? "user@anotherexample.com"))) + (test-equal (root-maildir) (string-append (getenv "MU_TESTDATADIR") "/testdir")) + (test-equal (personal-addresses) '("user@example.com")) + (let ((info (store->alist))) (test-equal 50000 (assoc-ref info 'batch-size)) (test-equal 100000000 (assoc-ref info 'max-message-size))) diff --git a/scm/mu-scm.scm b/scm/mu-scm.scm index d09e218..360809e 100644 --- a/scm/mu-scm.scm +++ b/scm/mu-scm.scm @@ -93,8 +93,9 @@ cfind labels personal? + root-maildir + personal-addresses store->alist - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Other @@ -563,8 +564,24 @@ The pattern is mandatory; the other (keyword) arguments are optional. #:max-results max. number of matches. Default: false (unlimited))." (cc-store-cfind (cc-store store) pattern personal? after max-results)) +(define-method (root-maildir (store <store>)) + ;; "Get the root-maildir for the messages in STORE." + (assoc-ref (store->alist store) 'root-maildir)) + +(define-method (root-maildir) + "Get the root-maildir for the messages in the default-store." + (root-maildir %default-store)) + +(define-method (personal-addresses (store <store>)) + ;; "Get the list of personal addresses in STORE." + (or (assoc-ref (store->alist store) 'personal-addresses) '())) + +(define-method (personal-addresses) + "Get the list of personal addresses in the default-store." + (personal-addresses %default-store)) + (define-method (mcount (store <store>)) - ;; "Get the number of messages in STORE." + ;; "Get the number of messages in STORE." (cc-store-mcount (cc-store store))) (define-method (mcount) diff --git a/scm/mu-scm.texi b/scm/mu-scm.texi index a6dcbfd..489247f 100644 --- a/scm/mu-scm.texi +++ b/scm/mu-scm.texi @@ -393,7 +393,8 @@ implicit. The store currently only exposes a few methods, described below. -@deffn {Scheme Procedure} mfind query [#:related? #f] [#:skip-dups? #f] [#:sort-field 'date] +@deffn {Scheme Procedure} mfind query [#:related? #f] [#:skip-dups? #f] + [#:sort-field 'date] [#:reverse? #f] [#:max-results #f] @end deffn @@ -491,8 +492,9 @@ This is equivalent to @code{(assoc-ref (store->alist) 'root-maildir)}. Get the list of personal-addresses as defined in the @code{mu} database, which may be empty. -This is equivalent to @code{(assoc-ref (store->alist) 'personal-addresses)}. Any -element in this list is either a plain e-mail address, or a PCRE-compatible +This is equivalent to @code{(or (assoc-ref (store->alist) 'personal-addresses) '())}, + +Any element in this list is either a plain e-mail address, or a PCRE-compatible regular expression when the first and last characters are @t{/} (forward-slash); see @t{pcre(3)} for further details. |
