[PATCH] test: sort the output of the "prefix" test in T610-message-property as needed

2020-04-17 Thread Olivier Taïbi
the "prefix" test in T610-message-property extracts values from a
(key,value) map where multiple entries can have the same key, and the
entries are sorted by key, but not by value.  The test incorrectly
assumes that the values will be sorted as well, so correct this by
splitting the output using head and tail and sorting each chunk using
sort.
NB: the relevant key/values are as follows.
testkey1: alice, testvalue1, testvalue2, bob
testkey3: alice3, bob3, testvalue3
---
 test/T610-message-property.sh | 5 +
 1 file changed, 5 insertions(+)

diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh
index 53a0be3b..e1be2fc3 100755
--- a/test/T610-message-property.sh
+++ b/test/T610-message-property.sh
@@ -186,6 +186,11 @@ EXPECT0(notmuch_message_add_property (message, "testkey3", 
"testvalue3"));
 EXPECT0(notmuch_message_add_property (message, "testkey3", "alice3"));
 print_properties (message, "testkey", FALSE);
 EOF
+mv OUTPUT unsorted_OUTPUT
+head -n 5 unsorted_OUTPUT | sort >OUTPUT
+tail -n +6 unsorted_OUTPUT | head -n 3 | sort >>OUTPUT
+tail -n +9 unsorted_OUTPUT >>OUTPUT
+rm unsorted_OUTPUT
 cat <<'EOF' >EXPECTED
 == stdout ==
 alice
-- 
2.26.0

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Emacs sending email via gmailieer

2020-04-17 Thread Mark Gardner
I am so close to getting my ideal email setup working...

Instead of offlineimap or mbsync, I use gmailieer to pull down emails. It
is quite fast and works with notmuch to map Gmail labels to notmuch tags.
Much cleaner than the awkward way of accessing Gmail through IMAP. Where I
am stuck is in sending the email.

I could set up smtpmail as described in
https://notmuchmail.org/emacstips/#index12h2 but gmailieer recently (v1.1)
gained the capability to send mail. I would like to use that if I can so.

Gmailieer sends a draft through Gmail without a problem (once I create a
draft using message mode in emacs). Both sending a file and sending from
stdin work:
$ gmi send -C path/to/mailbox 1586809748.A123456Z12345.test\:2\,D
$ cat 1586809748.A123456Z12345.test\:2\,D | gmi send -C path/to/mailbox

But I am stuck configuring emacs to use gmailieer instead of sendmail or
smtpmail.el. According to the emacs manual, the variable send-mail-function
can be set but none of the choices looks appropriate for gmailieer:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Mail-Sending.html

Anyone have an idea how to configure emacs to use gmailieer to send emails?

mkg
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Use `cl-lib' instead of deprecated `cl'

2020-04-17 Thread Jonas Bernoulli
David Bremner  writes:

> A quick git grep suggests there are still cl-isms in the test-harness.

I've fixed that now, see v2.

> I get 3 test failures

I am having issues running the tests.  Currently
notmuch-mua-send-and-exit in emacs_deliver_message from test-lib.sh
just hangs for me.  I haven't investigated further yet.  So I am
afraid you'll have to run the tests for me again.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2] emacs: Use `cl-lib' instead of deprecated `cl'

2020-04-17 Thread Jonas Bernoulli
Starting with Emacs 27 the old `cl' implementation is finally
considered obsolete.  Previously its use was strongly discouraged
at run-time but one was still allowed to use it at compile-time.

For the most part the transition is very simple and boils down to
adding the "cl-" prefix to some symbols.  A few replacements do not
follow that simple pattern; e.g. `first' is replaced with `car',
even though the alias `cl-first' exists, because the latter is not
idiomatic emacs-lisp.

In a few cases we start using `pcase-let' or `pcase-lambda' instead
of renaming e.g. `first' to `car'.  That way we can remind the reader
of the meaning of the various parts of the data that is being
deconstructed.

An obsolete `lexical-let' and a `lexical-let*' are replaced with their
regular variants `let' and `let*' even though we do not at the same
time enable `lexical-binding' for that file.  That is the right thing
to do because it does not actually make a difference in those cases
whether lexical bindings are used or not, and because this should be
enabled in a separate commit.

We need to explicitly depend on the `cl-lib' package because Emacs
24.1 and 24.2 lack that library.  When using these releases we end
up using the backport from GNU Elpa.

We need to explicitly require the `pcase' library because
`pcase-dolist' was not autoloaded until Emacs 25.1.
---
 emacs/notmuch-company.el |   5 +-
 emacs/notmuch-draft.el   |   2 +-
 emacs/notmuch-hello.el   | 147 ++-
 emacs/notmuch-jump.el|  45 +--
 emacs/notmuch-lib.el |  18 ++---
 emacs/notmuch-maildir-fcc.el |  35 +
 emacs/notmuch-mua.el |  76 +-
 emacs/notmuch-parser.el  |  18 ++---
 emacs/notmuch-pkg.el.tmpl|   3 +-
 emacs/notmuch-show.el| 103 
 emacs/notmuch-tag.el |  45 ++-
 emacs/notmuch-tree.el|  20 ++---
 emacs/notmuch.el |  62 +++
 test/test-lib.el |  18 ++---
 14 files changed, 300 insertions(+), 297 deletions(-)

diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el
index 3e12e7a9..ac998f9b 100644
--- a/emacs/notmuch-company.el
+++ b/emacs/notmuch-company.el
@@ -27,7 +27,8 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
+
 (require 'notmuch-lib)
 
 (defvar notmuch-company-last-prefix nil)
@@ -65,7 +66,7 @@ (defun notmuch-company (command  arg  _ignore)
   (require 'company)
   (let ((case-fold-search t)
(completion-ignore-case t))
-(case command
+(cl-case command
   (interactive (company-begin-backend 'notmuch-company))
   (prefix (and (derived-mode-p 'message-mode)
   (looking-back (concat 
notmuch-address-completion-headers-regexp ".*")
diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el
index e22e0d16..504b33be 100644
--- a/emacs/notmuch-draft.el
+++ b/emacs/notmuch-draft.el
@@ -152,7 +152,7 @@ (defun notmuch-draft--query-encryption ()
   "Checks if we should save a message that should be encrypted.
 
 `notmuch-draft-save-plaintext' controls the behaviour."
-  (case notmuch-draft-save-plaintext
+  (cl-case notmuch-draft-save-plaintext
((ask)
 (unless (yes-or-no-p "(Customize `notmuch-draft-save-plaintext' to 
avoid this warning)
 This message contains mml tags that suggest it is intended to be encrypted.
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index ab6ee798..bdf584e6 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -21,7 +21,8 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
+
 (require 'widget)
 (require 'wid-edit) ; For `widget-forward'.
 
@@ -47,17 +48,19 @@ (defun notmuch-saved-search-get (saved-search field)
((keywordp (car saved-search))
 (plist-get saved-search field))
;; It is not a plist so it is an old-style entry.
-   ((consp (cdr saved-search)) ;; It is a list (NAME QUERY COUNT-QUERY)
-(case field
-  (:name (first saved-search))
-  (:query (second saved-search))
-  (:count-query (third saved-search))
-  (t nil)))
-   (t  ;; It is a cons-cell (NAME . QUERY)
-(case field
-  (:name (car saved-search))
-  (:query (cdr saved-search))
-  (t nil)
+   ((consp (cdr saved-search))
+(pcase-let ((`(,name ,query ,count-query) saved-search))
+  (cl-case field
+   (:name name)
+   (:query query)
+   (:count-query count-query)
+   (t nil
+   (t
+(pcase-let ((`(,name . ,query) saved-search))
+  (cl-case field
+   (:name name)
+   (:query query)
+   (t nil))
 
 (defun notmuch-hello-saved-search-to-plist (saved-search)
   "Return a copy of SAVED-SEARCH in plist form.
@@ -66,7 +69,7 @@ (defun notmuch-hello-saved-search-to-plist (saved-search)
 cases, for backwards compatibility, convert to plist form and
 return that."
   (if (keywordp (car saved-search))
-  (copy-seq 

Re: [lieer] Release v1.1

2020-04-17 Thread Gaute Hope
On Fri, Apr 17, 2020 at 1:58 PM Thomas Schneider  wrote:

> Hi Gaute,
>
> Gaute Hope  writes:
>
> > lieer v1.1 has been released with a bunch of minor fixes, and also the
> > ability to (experimentally) send e-mail as a primitive sendmail stand-in.
> >
> >   https://github.com/gauteh/lieer
>
> That’s nice to hear.  I see the release on GitHub, but are you going to
> upload it to PyPI as well?  My Gentoo ebuild[0] gets the source from
> there, so I noticed it’s not (yet) present on PyPI.
>
>
Hi,

I am not maintaining the PyPI package. Not sure exactly who it is at the
moment, but I think the contact details are on the pypi page.

Regards, Gaute
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [lieer] Release v1.1

2020-04-17 Thread Thomas Schneider
Hi Gaute,

Gaute Hope  writes:

> lieer v1.1 has been released with a bunch of minor fixes, and also the
> ability to (experimentally) send e-mail as a primitive sendmail stand-in.
>
>   https://github.com/gauteh/lieer

That’s nice to hear.  I see the release on GitHub, but are you going to
upload it to PyPI as well?  My Gentoo ebuild[0] gets the source from
there, so I noticed it’s not (yet) present on PyPI.

Thanks,
Thomas

[0]: https://github.com/qsuscs/gentoo-overlay/tree/main/net-mail/lieer


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Use `cl-lib' instead of deprecated `cl'

2020-04-17 Thread David Bremner
William Casarin  writes:

> From: Jonas Bernoulli 
>
> Starting with Emacs 27 the old `cl' implementation is finally
> considered obsolete.  Previously its use was strongly discouraged
> at run-time but one was still allowed to use it at compile-time.
>
> For the most part the transition is very simple and boils down to
> adding the "cl-" prefix to some symbols.  A few replacements do not
> follow that simple pattern; e.g. `first' is replaced with `car',
> even though the alias `cl-first' exists, because the latter is not
> idiomatic emacs-lisp.

I get 3 test failures

T310-emacs "Incremental parsing of search results"
   not sure what the error is here, it just reports nil
   
T450-emacs-show "Show handles subprocess errors"
  *ERROR*: Symbol’s function definition is void: second

T720-emacs-attachment-warnings: "  notmuch-test-attachment-warning part 1
  *ERROR*: Symbol’s function definition is void: loop

A quick git grep suggests there are still cl-isms in the test-harness.

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch