Re: nmbug in the Debian packages?

2016-02-08 Thread David Bremner
David Edmondson  writes:

> I'd like to use nmbug without having to grovel around in the notmuch git
> repository. Could it be added to the Debian package, please?
>
> (I can try to prepare a patch, but figured that it merited discussion
> first.)

I see two options with my debian packager hat on. We can include it in
/usr/bin along and install a proper man page, or just copy it into
/usr/share/doc/notmuch/examples.

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


Re: nmbug in the Debian packages?

2016-02-08 Thread David Edmondson
On Mon, Feb 08 2016, David Bremner  wrote:
> David Edmondson  writes:
>
>> I'd like to use nmbug without having to grovel around in the notmuch git
>> repository. Could it be added to the Debian package, please?
>>
>> (I can try to prepare a patch, but figured that it merited discussion
>> first.)
>
> I see two options with my debian packager hat on. We can include it in
> /usr/bin along and install a proper man page, or just copy it into
> /usr/share/doc/notmuch/examples.

The first would obviously be easier to use, but I could just make
symlink in ~/bin to make the second work out fine.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v3 1/2] emacs: Add `notmuch-show-forward-open-messages'.

2016-02-08 Thread David Edmondson
Add a function to forward all open messages in the current view of a
thread. Bind this to "F".
---
 emacs/notmuch-mua.el  | 48 
 emacs/notmuch-show.el | 11 +++
 2 files changed, 59 insertions(+)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 5462f54..4d50d25 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -425,6 +425,54 @@ the From: address first."
 (message-hide-headers)
 (set-buffer-modified-p nil)))
 
+(defun notmuch-mua-new-forward-messages (messages  prompt-for-sender)
+  "Compose a new message forwarding MESSAGES.
+
+If PROMPT-FOR-SENDER is non-nil, the user will be prompteed for
+the From: address."
+  (let* ((other-headers
+ (when (or prompt-for-sender notmuch-always-prompt-for-sender)
+   (list (cons 'From (notmuch-mua-prompt-for-sender)
+forward-subject) ;; Comes from the first message and is
+ ;; applied later.
+
+;; Generate the template for the outgoing message.
+(notmuch-mua-mail nil "" other-headers nil 
(notmuch-mua-get-switch-function))
+
+(save-excursion
+  ;; Insert all of the forwarded messages.
+  (mapc (lambda (id)
+ (let ((temp-buffer (get-buffer-create
+ (concat "*notmuch-fwd-raw-" id "*"
+   ;; Get the raw version of this message in the buffer.
+   (with-current-buffer temp-buffer
+ (erase-buffer)
+ (let ((coding-system-for-read 'no-conversion))
+   (call-process notmuch-command nil t nil "show" 
"--format=raw" id))
+ ;; Because we process the messages in reverse order,
+ ;; always generate a forwarded subject, then use the
+ ;; last (i.e. first) one.
+ (setq forward-subject (message-make-forward-subject)))
+   ;; Make a copy ready to be forwarded in the
+   ;; composition buffer.
+   (message-forward-make-body temp-buffer)
+   ;; Kill the temporary buffer.
+   (kill-buffer temp-buffer)))
+   ;; `message-forward-make-body' always puts the message at
+   ;; the top, so do them in reverse order.
+   (reverse messages))
+
+  ;; Add in the appropriate subject.
+  (save-restriction
+   (message-narrow-to-headers)
+   (message-remove-header "Subject")
+   (message-add-header (concat "Subject: " forward-subject)))
+
+  ;; `message-forward-make-body' shows the User-agent header.  Hide
+  ;; it again.
+  (message-hide-headers)
+  (set-buffer-modified-p nil
+
 (defun notmuch-mua-new-reply (query-string  prompt-for-sender 
reply-all)
   "Compose a reply to the message identified by QUERY-STRING.
 
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 3345878..a8c6f1e 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1371,6 +1371,7 @@ reset based on the original query."
 (define-key map (kbd "") 'notmuch-show-previous-button)
 (define-key map (kbd "TAB") 'notmuch-show-next-button)
 (define-key map "f" 'notmuch-show-forward-message)
+(define-key map "F" 'notmuch-show-forward-open-messages)
 (define-key map "l" 'notmuch-show-filter-thread)
 (define-key map "r" 'notmuch-show-reply-sender)
 (define-key map "R" 'notmuch-show-reply)
@@ -1798,6 +1799,16 @@ any effects from previous calls to
   (with-current-notmuch-show-message
(notmuch-mua-new-forward-message prompt-for-sender)))
 
+(put 'notmuch-show-forward-open-messages 'notmuch-prefix-doc
+ "... and prompt for sender")
+(defun notmuch-show-forward-open-messages ( prompt-for-sender)
+  "Forward the currently open messages."
+  (interactive "P")
+  (let ((open-messages (notmuch-show-get-message-ids-for-open-messages)))
+(unless open-messages
+  (error "No open messages to forward."))
+(notmuch-mua-new-forward-messages open-messages prompt-for-sender)))
+
 (defun notmuch-show-next-message ( pop-at-end)
   "Show the next message.
 
-- 
2.1.4

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


[PATCH v3 0/2] Allow forwarding of all open messages in the current view.

2016-02-08 Thread David Edmondson

Allow forwarding of all open messages in the current view.

In response to id:"87fvyhb40x@alice.fifthhorseman.net".

v2:
- Use multiple message forwarding to implement single message
  forwarding.

v3:
- Fix silly error.


David Edmondson (2):
  emacs: Add `notmuch-show-forward-open-messages'.
  emacs: `notmuch-show-forward-message' can use
`notmuch-mua-new-forward-messages'

 emacs/notmuch-mua.el  | 62 +--
 emacs/notmuch-show.el | 15 +++--
 2 files changed, 58 insertions(+), 19 deletions(-)

-- 
2.1.4

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


[PATCH v3 2/2] emacs: `notmuch-show-forward-message' can use `notmuch-mua-new-forward-messages'

2016-02-08 Thread David Edmondson
Which allows `notmuch-mua-new-forward-message' to be removed.
---
 emacs/notmuch-mua.el  | 20 
 emacs/notmuch-show.el |  4 ++--
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 4d50d25..99e23d8 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -405,26 +405,6 @@ the From: address first."
   (list (cons 'From (notmuch-mua-prompt-for-sender))
 (notmuch-mua-mail nil nil other-headers nil 
(notmuch-mua-get-switch-function
 
-(defun notmuch-mua-new-forward-message ( prompt-for-sender)
-  "Invoke the notmuch message forwarding window.
-
-The current buffer must contain an RFC2822 message to forward.
-
-If PROMPT-FOR-SENDER is non-nil, the user will be prompted for
-the From: address first."
-  (let* ((cur (current-buffer))
-(message-forward-decoded-p nil)
-(subject (message-make-forward-subject))
-(other-headers
- (when (or prompt-for-sender notmuch-always-prompt-for-sender)
-   (list (cons 'From (notmuch-mua-prompt-for-sender))
-(notmuch-mua-mail nil subject other-headers nil 
(notmuch-mua-get-switch-function))
-(message-forward-make-body cur)
-;; `message-forward-make-body' shows the User-agent header.  Hide
-;; it again.
-(message-hide-headers)
-(set-buffer-modified-p nil)))
-
 (defun notmuch-mua-new-forward-messages (messages  prompt-for-sender)
   "Compose a new message forwarding MESSAGES.
 
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index a8c6f1e..d40cb09 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1796,8 +1796,8 @@ any effects from previous calls to
 (defun notmuch-show-forward-message ( prompt-for-sender)
   "Forward the current message."
   (interactive "P")
-  (with-current-notmuch-show-message
-   (notmuch-mua-new-forward-message prompt-for-sender)))
+  (notmuch-mua-new-forward-messages (list (notmuch-show-get-message-id))
+   prompt-for-sender))
 
 (put 'notmuch-show-forward-open-messages 'notmuch-prefix-doc
  "... and prompt for sender")
-- 
2.1.4

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


Re: api-doc: return status for notmuch_query_search_threads_st ...

2016-02-08 Thread David Bremner
Gaute Hope  writes:

> Hi,
>
> I am switching from the deprecated notmuch_query_search_threads to
> notmuch_query_search_threads_st, but the api-documentation does not
> specify what status values are returned and what they mean.
>
> The same goes for notmuch_query_search_messages_st (...).
>

They both can return OUT_OF_MEMORY, XAPIAN_EXCEPTION, and SUCCESS.
It would be great if someone (TM) would work up, and test the output of
doxygen on, a patch to lib/notmuch.h.

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


Re: [PATCH v2 0/2] Allow forwarding of all open messages in the current view.

2016-02-08 Thread David Edmondson
On Sun, Feb 07 2016, Mark Walters wrote:
> This basically looks good to me. At the moment there is some typo in the
> first patch introducing two extra parenthesis at the end of the 
> notmuch-mua-new-forward-messages function.

Yikes. I turned on paredit-mode and haven't quite got comfortable
yet. Followup coming...
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show'.

2016-02-08 Thread David Edmondson
On Sun, Feb 07 2016, Mark Walters wrote:
> However, I wonder if we actually want an error at all in this case,
> rather than just a "message". I think some people run with
> debug-on-error enabled and it might be annoying in that case (though
> clearly less annoying than the current situation).

How about (ding) (message "...") ?
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] cli: avoid non-zero exits in notmuch insert --keep

2016-02-08 Thread David Bremner
Maarten Aertsen  writes:

> In the case of any failure, we now return EX_TEMPFAIL (a sendmail
> convention, defined in sysexits.h) to signal to the LDA that it should
> retry later. This prevents a direct reject or bounce of e-mail.

We talked a bit on IRC about the portability of sysexits.h. Afaik, it's
available in GNU systems, on *BSD systems, and on OS/X. We can also
borrow the gnulib copy if we need a compatability version.

> +notmuch_bool_t notmuch_has_unmatched_db_uuid (notmuch_database_t *notmuch);
>  void notmuch_exit_if_unmatched_db_uuid (notmuch_database_t *notmuch);

It's a bit unfortunate to end up with two such functions, but I guess we
could migrate everything to has_unmatched_db_uuid. The double negative
is a bit confusing too, it seems like it would be more natural to have a
_has_matching_db_uuid
> +status = notmuch_database_open (notmuch_config_get_database_path 
> (config),
> +NOTMUCH_DATABASE_MODE_READ_WRITE, );
> +if (! status) {
> + /* with keep, send EX_TEMPFAIL per sysexits.h to invite the caller to
> +  * retry at some later point and avoid permanent failure */
> + if (notmuch_has_unmatched_db_uuid(notmuch))
> +exit (keep ? EX_TEMPFAIL : EXIT_FAILURE);

We're a bit fussy about spaces; see devel/STYLE

I'd invite brainstorming about whether mismatched UUID is really a
temporary failure. Unlike a lock, I don't see it going away without
user/admin intervention.  Actually, someone even specifying a UUID when
calling notmuch insert would be a bit surprising.

I suspect some  of the tests in T070-insert.sh could/should be updated
for changed exit values.

d




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


Re: [Vagrant Cascadian] Bug#759646: notmuch-emacs: switching mode= to invalid value sends unencrypted mail

2016-02-08 Thread David Edmondson
[Raking over history...]

On Sat, Nov 29 2014, David Bremner wrote:
> David Edmondson  writes:
>
>> On Tue, Sep 02 2014, Tomi Ollila wrote:
>>> On Tue, Sep 02 2014, Daniel Kahn Gillmor  wrote:
>>>
 On 08/30/2014 03:37 AM, Jani Nikula wrote:
> I'm inclined to think this is a bug in message-mode. 

 I agree it's a bug in message-mode, not in notmuch itself.
>>>
>>> I think it might be here:
>>>
>>> http://bzr.savannah.gnu.org/lh/emacs/emacs-24/annotate/head:/lisp/gnus/mml.el#L258
>>>
>>> (it takes time to load, please wait...)
>>>
>>> If cond does not match, then don't fail...
>>
>> This looks to have been fixed in emacs at the end of September 2014.
>
> Right, this fix was released in emacs 24.4
>
> I'm a little torn what to do here. On the one hand the upstream change
> fixes the bug as reported. On the other hand, if something corrupts the
> #secure tag (e.g., by deleting a letter), then the message is still sent
> un-uncrypted.

That's true, but it's undoubtedly an upstream bug rather than a
notmuch-emacs bug.

If we apply some heuristic workaround in notmuch, users of gnus (and
mu4e?) will still be vulnerable to the same problem. The right thing to
do is report (and fix) the bug upstream.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [Vagrant Cascadian] Bug#759302: notmuch-emacs: citation should use datestring from the replied to message

2016-02-08 Thread David Edmondson
> So, I've struggled with coming up with a citation line format:
> 
>  '(message-citation-line-format "On %Y-%m-%d %T %z, %N wrote:")
>  '(message-citation-line-function (quote 
> message-insert-formatted-citation-line))
> 
> But it localizes the timezone of datestring, rather than simply copying
> the datestring from the replied to message.

This is not something that we can fix (as is alluded to in the Debian
bug report).

`message-insert-formatted-citation-line' converts the date of the
message being replied to into Emacs time (a list of two integers) and
then uses `format-time-string' with the result.

All of the timezone information from the original header is lost during
the conversion to Emacs time.

Do we typically just open an upstream emacs bug in such cases?
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v4 0/7] emacs: Improve the cited message included in replies

2016-02-08 Thread David Edmondson
On Sat, Nov 07 2015, Mark Walters wrote:
> This is a rebase and somewhat tweaked version of dme's series from last year
> id:1399897769-26809-1-git-send-email-...@dme.org

I'm a bad person to review these changes, having written some of
them. Could someone else take a look?

> One particular motivation for this series is that it fixes a long
> standing bug we have that replying to a message with an rfc822 part
> completely omits that part. It also fixes the bug whereby we don't
> include application/octet-stream parts which are actually text/plain
> (and thus are displayed in show mode).
>
> This series makes the reply code use the same code as the show code so
> everything works as expected: the reply buffer looks essentially the
> same as the show buffer.
>
> There is one slight difference: the user might want different part
> headers displayed when replying; both because the audience is
> different (a non-notmuch using recipient) and because the buttons
> don't "work" (you can't click on them to show or view a part).
>
> Dme and I disagree on which of these we would like to see so make that
> customisable.
>
> The key change is patch 3 which switches how reply works. Also note
> that patch 2 is almost all whitespace change as the changes modify the
> indentation.
>
> Best wishes
>
> Mark
>
>
> David Edmondson (6):
>   emacs/show: Re-arrange determination if a part header is necessary
>   emacs/show: Accommodate the lack of part header buttons
>   emacs/mua: Generate improved cited text for replies
>   emacs/show: Remove the 'no-buttons option of
> `notmuch-show-insert-bodypart'
>   emacs/show: Make the insertion of part headers overridable.
>   emacs/mua: Let user specify which parts get a header in citations.
>
> Mark Walters (1):
>   test: fix the tests for the new reply code
>
>  emacs/notmuch-mua.el  |  60 ++---
>  emacs/notmuch-show.el | 141 
> +++---
>  test/T310-emacs.sh|  32 
>  test/test-lib.el  |   4 ++
>  4 files changed, 155 insertions(+), 82 deletions(-)
>
> -- 
> 2.1.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [Gaudenz Steinlin] Bug#810784: should match email adress case insensitive when sending encrypted mail

2016-02-08 Thread David Edmondson
On Fri, Jan 15 2016, Daniel Kahn Gillmor wrote:
> So where is the case-insensitive lookup happening?  Is this a bug in
> mml-mode, or in notmuch-emacs?

It's caused by behaviour in mml2015.el (hence upstream).

`mml2015-epg-check-user-id' uses `equal' to compare the recipient from
the composition buffer with the addresses from the matching key.

The simplest way to get the desired behaviour would be to `downcase'
both strings before comparing.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: nmbug in the Debian packages?

2016-02-08 Thread W. Trevor King
On Mon, Feb 08, 2016 at 07:33:10AM -0400, David Bremner wrote:
> We can include it in /usr/bin along and install a proper man pageā€¦

I'm happy to write up a man page.  Do you want it in a separate
directory from nmbug-status / notmuch-report [1]?  Do you want to
rename nmbug to something notmuch-* namespaced?

Cheers,
Trevor

[1]: id:20160206205030.gh11...@odin.tremily.us

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


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


Re: [Gaudenz Steinlin] Bug#810784: should match email adress case insensitive when sending encrypted mail

2016-02-08 Thread David Edmondson
On Mon, Feb 08 2016, David Edmondson wrote:
> On Fri, Jan 15 2016, Daniel Kahn Gillmor wrote:
>> So where is the case-insensitive lookup happening?  Is this a bug in
>> mml-mode, or in notmuch-emacs?
>
> It's caused by behaviour in mml2015.el (hence upstream).
>
> `mml2015-epg-check-user-id' uses `equal' to compare the recipient from
> the composition buffer with the addresses from the matching key.
>
> The simplest way to get the desired behaviour would be to `downcase'
> both strings before comparing.

Reported as bug#22603 in emacs.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch