[PATCH v1 2/3] emacs: Neaten `notmuch-show-insert-bodypart-internal'.
--- emacs/notmuch-show.el | 25 ++--- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 6e268f9..f739987 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -848,21 +848,16 @@ will return nil if the CID is unknown or cannot be retrieved." ;; (defun notmuch-show-insert-bodypart-internal (msg part content-type nth depth button) - (let ((handlers (notmuch-show-handlers-for content-type))) -;; Run the content handlers until one of them returns a non-nil -;; value. -(while (and handlers - (not (condition-case err -(funcall (car handlers) msg part content-type nth depth button) - ;; Specifying `debug' here lets the debugger - ;; run if `debug-on-error' is non-nil. - ((debug error) - (progn - (insert "!!! Bodypart insert error: ") - (insert (error-message-string err)) - (insert " !!!\n") nil) - (setq handlers (cdr handlers - t) + ;; Run the handlers until one of them succeeds. + (loop for handler in (notmuch-show-handlers-for content-type) + until (condition-case err + (funcall handler msg part content-type nth depth button) + ;; Specifying `debug' here lets the debugger run if + ;; `debug-on-error' is non-nil. + ((debug error) +(insert "!!! Bodypart handler `" (prin1-to-string handler) "' threw an error:\n" +"!!! " (error-message-string err) "\n") +nil (defun notmuch-show-create-part-overlays (button beg end) "Add an overlay to the part between BEG and END" -- 2.1.4 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v1 0/3] Improve the acquisition of text parts.
Improve the acquisition of text parts. This affects the new "reply" behaviour and the rendering of application/octet-stream parts that are treated as text. David Edmondson (3): emacs: `notmuch-show-insert-part-multipart/encrypted' should not assume the presence of a button. emacs: Neaten `notmuch-show-insert-bodypart-internal'. emacs: Improve the acquisition of text parts. emacs/notmuch-lib.el | 73 ++- emacs/notmuch-show.el | 28 +--- 2 files changed, 43 insertions(+), 58 deletions(-) -- 2.1.4 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: (emacs) Parsing problems replying to encrypted html
> On Tue, Mar 08 2016, Tomi Ollila wrote: > >> [ text/plain ] >> On Tue, Mar 08 2016, David Bremner wrote: >> >>> [ text/plain ] >>> Matthew Learwrites: >>> >>> >>> Thanks for the test case. I can duplicate a (the?) bug as >>> follows. Replying to that message from notmuch-show mode works, but >>> replying from notmuch-search mode yields >>> !!! Bodypart insert error: Wrong type argument: number-or-marker-p, nil !!! [ application/pgp-encrypted ] Version: 1 [ encrypted.asc: application/octet-stream (as text/plain) ] !!! Bodypart insert error: Internal error: No :content from ("show" "--format=sexp" "--include-html" "--part=3" "id:56dde706.6060...@bubblegen.co.uk") !!! >>> >>> Followed by the ciphertext. -BEGIN PGP MESSAGE- >>> >>> If anyone wants to play with this, you just need to import the notmuch >>> test key into your keyring, something like >>> >>> gpg --import path/to/notmuch-source/test/gnupg-secret-key.asc >>> >>> What's odd is that the notmuch command in the error message works on >>> the >>> command line. >> >> I got these to my log: >> >> when replying from search: >> >> 2016-03-08 (Tue) 14:16:01: reply --format=sexp --format-version=1 >> --reply-to=sender thread:4a6f >> 2016-03-08 (Tue) 14:16:01: show --format=raw --part=2 >> id:56dde706.6060...@bubblegen.co.uk >> 2016-03-08 (Tue) 14:16:01: show --format=sexp --include-html --part=3 >> id:56dde706.6060...@bubblegen.co.uk > > The above line returns (same as in latest !!! bodypart insert error !!!) > > (:id 3 :content-type "application/octet-stream" :filename "encrypted.asc" > :content-length 1875) > > -- there is no content to be included from that line :/ (and wat is this >"encrypted.asc" anyway ?) encrypted.asc is what Enigmail uses when sending using PGP/MIME. I think it wraps up the message body in this file (armor encrypted) and marks it with disposition inline. Enigmail also sends PGP/MIME version identification information in another MIME part (application/pgp-encrypted) - so you have two MIME parts per PGP/MIME encrypted message. You can view all headers in the test message if you're in notmuch-show by using V. You'll see something like: Content-Type: multipart/encrypted; protocol="application/pgp-encrypted"; boundary="xxx" This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156) --xxx Content-Type: application/pgp-encrypted Content-Description: PGP/MIME version identification Version: 1 --xxx Content-Type: application/octet-stream; name="encrypted.asc" Content-Description: OpenPGP encrypted message Content-Disposition: inline; filename="encrypted.asc" -BEGIN PGP MESSAGE- Version: GnuPG v2 ... -END PGP MESSAGE- --xxx-- ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: (emacs) Parsing problems replying to encrypted html
On Tue, Mar 08 2016, Tomi Ollila wrote: > [ text/plain ] > On Tue, Mar 08 2016, David Bremner wrote: > >> [ text/plain ] >> Matthew Learwrites: >> >> >> Thanks for the test case. I can duplicate a (the?) bug as >> follows. Replying to that message from notmuch-show mode works, but >> replying from notmuch-search mode yields >> >>> !!! Bodypart insert error: Wrong type argument: number-or-marker-p, nil !!! >>> [ application/pgp-encrypted ] >>> Version: 1 >>> [ encrypted.asc: application/octet-stream (as text/plain) ] >>> !!! Bodypart insert error: Internal error: No :content from ("show" >>> "--format=sexp" "--include-html" "--part=3" >>> "id:56dde706.6060...@bubblegen.co.uk") !!! >> >> Followed by the ciphertext. >>> -BEGIN PGP MESSAGE- >> >> If anyone wants to play with this, you just need to import the notmuch >> test key into your keyring, something like >> >> gpg --import path/to/notmuch-source/test/gnupg-secret-key.asc >> >> What's odd is that the notmuch command in the error message works on the >> command line. > > I got these to my log: > > when replying from search: > > 2016-03-08 (Tue) 14:16:01: reply --format=sexp --format-version=1 > --reply-to=sender thread:4a6f > 2016-03-08 (Tue) 14:16:01: show --format=raw --part=2 > id:56dde706.6060...@bubblegen.co.uk > 2016-03-08 (Tue) 14:16:01: show --format=sexp --include-html --part=3 > id:56dde706.6060...@bubblegen.co.uk The above line returns (same as in latest !!! bodypart insert error !!!) (:id 3 :content-type "application/octet-stream" :filename "encrypted.asc" :content-length 1875) -- there is no content to be included from that line :/ (and wat is this "encrypted.asc" anyway ?) > when replying from show: > > 2016-03-08 (Tue) 14:16:37: reply --format=sexp --format-version=1 --decrypt > --reply-to=sender id:56dde706.6060...@bubblegen.co.uk the --decrypt here provided the content (from part=3) in this case. Tomi ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: (emacs) Parsing problems replying to encrypted html
>> Hmm. In emacs, if I try to reply to the message from notmuch-search, I >> get >> no error but there is no quoted text from the original message in the >> reply body and all I see is the 'on , wrote:' citation. >> Replying from notmuch-show gives me the error I mentioned previously. > > I suppose the main difference is the setting of > notmuch-multipart/alternative-discouraged. If I copy your setting I also > get an error replying in notmuch-show mode. > I know this was mentioned earlier but just to avoid any doubt, my discourage setting is currently: (setq notmuch-multipart/alternative-discouraged '("text/plain")) I removed the "multipart/related". (I agree it's probably not wise to discourage it). ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: (emacs) Parsing problems replying to encrypted html
On Tue, Mar 08 2016, David Bremner wrote: > [ text/plain ] > Matthew Learwrites: > >>> >>> Please encrypt a message to the attached gpg key (from the notmuch test >>> suite), and send it to the list as an attachement if you can replicate >>> the bug. >> >> Done. Attached here. >> >> [ >> 1457383253_0.15104.sunrise,U=4513,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S: >> application/octet-stream ] > > Thanks for the test case. I can duplicate a (the?) bug as > follows. Replying to that message from notmuch-show mode works, but > replying from notmuch-search mode yields > >> !!! Bodypart insert error: Wrong type argument: number-or-marker-p, nil !!! >> [ application/pgp-encrypted ] >> Version: 1 >> [ encrypted.asc: application/octet-stream (as text/plain) ] >> !!! Bodypart insert error: Internal error: No :content from ("show" >> "--format=sexp" "--include-html" "--part=3" >> "id:56dde706.6060...@bubblegen.co.uk") !!! > > Followed by the ciphertext. >> -BEGIN PGP MESSAGE- > > If anyone wants to play with this, you just need to import the notmuch > test key into your keyring, something like > > gpg --import path/to/notmuch-source/test/gnupg-secret-key.asc > > What's odd is that the notmuch command in the error message works on the > command line. I got these to my log: when replying from search: 2016-03-08 (Tue) 14:16:01: reply --format=sexp --format-version=1 --reply-to=sender thread:4a6f 2016-03-08 (Tue) 14:16:01: show --format=raw --part=2 id:56dde706.6060...@bubblegen.co.uk 2016-03-08 (Tue) 14:16:01: show --format=sexp --include-html --part=3 id:56dde706.6060...@bubblegen.co.uk 2016-03-08 (Tue) 14:16:01: show --format=raw --part=3 id:56dde706.6060...@bubblegen.co.uk when replying from show: 2016-03-08 (Tue) 14:16:37: reply --format=sexp --format-version=1 --decrypt --reply-to=sender id:56dde706.6060...@bubblegen.co.uk 2016-03-08 (Tue) 14:16:37: show --format=raw --part=2 id:56dde706.6060...@bubblegen.co.uk there's no --decrypt when from search ... and interestingly there are other differences, too... Tomi ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: (emacs) Parsing problems replying to encrypted html
Matthew Learwrites: > > Hmm. In emacs, if I try to reply to the message from notmuch-search, I get > no error but there is no quoted text from the original message in the > reply body and all I see is the 'on , wrote:' citation. > Replying from notmuch-show gives me the error I mentioned previously. I suppose the main difference is the setting of notmuch-multipart/alternative-discouraged. If I copy your setting I also get an error replying in notmuch-show mode. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: (emacs) Parsing problems replying to encrypted html
> Thanks for the test case. I can duplicate a (the?) bug as > follows. Replying to that message from notmuch-show mode works, but > replying from notmuch-search mode yields > >> !!! Bodypart insert error: Wrong type argument: number-or-marker-p, nil >> !!! >> [ application/pgp-encrypted ] >> Version: 1 >> [ encrypted.asc: application/octet-stream (as text/plain) ] >> !!! Bodypart insert error: Internal error: No :content from ("show" >> "--format=sexp" "--include-html" "--part=3" >> "id:56dde706.6060...@bubblegen.co.uk") !!! > > Followed by the ciphertext. >> -BEGIN PGP MESSAGE- > > If anyone wants to play with this, you just need to import the notmuch > test key into your keyring, something like > > gpg --import path/to/notmuch-source/test/gnupg-secret-key.asc > > What's odd is that the notmuch command in the error message works on the > command line. > Hmm. In emacs, if I try to reply to the message from notmuch-search, I get no error but there is no quoted text from the original message in the reply body and all I see is the 'on , wrote:' citation. Replying from notmuch-show gives me the error I mentioned previously. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: (emacs) Parsing problems replying to encrypted html
Matthew Learwrites: >> >> Please encrypt a message to the attached gpg key (from the notmuch test >> suite), and send it to the list as an attachement if you can replicate >> the bug. > > Done. Attached here. > > [ > 1457383253_0.15104.sunrise,U=4513,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S: > application/octet-stream ] Thanks for the test case. I can duplicate a (the?) bug as follows. Replying to that message from notmuch-show mode works, but replying from notmuch-search mode yields > !!! Bodypart insert error: Wrong type argument: number-or-marker-p, nil !!! > [ application/pgp-encrypted ] > Version: 1 > [ encrypted.asc: application/octet-stream (as text/plain) ] > !!! Bodypart insert error: Internal error: No :content from ("show" > "--format=sexp" "--include-html" "--part=3" > "id:56dde706.6060...@bubblegen.co.uk") !!! Followed by the ciphertext. > -BEGIN PGP MESSAGE- If anyone wants to play with this, you just need to import the notmuch test key into your keyring, something like gpg --import path/to/notmuch-source/test/gnupg-secret-key.asc What's odd is that the notmuch command in the error message works on the command line. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch