Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id F0A45431FB6 for ; Wed, 21 Nov 2012 23:39:58 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q8ZuqiAqOgb8 for ; Wed, 21 Nov 2012 23:39:58 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id D3DCB431FAF for ; Wed, 21 Nov 2012 23:39:57 -0800 (PST) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 1443010010B; Thu, 22 Nov 2012 09:39:55 +0200 (EET) From: Tomi Ollila To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH v3 2/2] notmuch-show.el: handle the case where icalendar-import-buffer returns nil In-Reply-To: <87sj82wb0f.fsf@zancas.localnet> References: <1352376480-29961-1-git-send-email-tomi.ollila@iki.fi> <1352376480-29961-3-git-send-email-tomi.ollila@iki.fi> <87sj82wb0f.fsf@zancas.localnet> User-Agent: Notmuch/0.14+84~g8a199bf (http://notmuchmail.org) Emacs/24.2.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Nov 2012 07:39:59 -0000 On Thu, Nov 22 2012, David Bremner wrote: > Tomi Ollila writes: > >> icalendar-import-buffer can fail by an error signal (which have been >> witnessed) but according to its docstring it can also return nil >> when failing (it returns t when succeeding). >> >> Now that the error is caught by the caller of notmuch-show-inset-part-* >> functions in case icalendar-import-buffer returns nil an explicit >> error is signaled and unwind-protect takes care of deleting the >> temporary file (just in case, it is usually not written to the fs yet). > > This one looks OK to me too, although the API that makes it necessary > out to be taken out back... I didn't quite understand the meaning of the last words... Anyway, the point in this patch is that if icalendar-import-buffer (or the older version using icalendar private functions) fail by returning nil, the error case is not (and has not been) shown to the user (user gets either empty or partially filled bodypart. Now that we would have that condition-case in the caller this code can signal error message to the user and provide info where more information can be obtained (*ical-errors* buffer). More complex code could be used to make notmuch-show-insert-part-text/calendar return nil in case icalendar-import-buffer fails -- then notmuch-show-insert-bodypart-internal would attempt to use next handler in chain to insert content (if any) > > d Tomi > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch