Re: [PATCH 1/2] emacs: remove some code duplication in notmuch-show

Subject: Re: [PATCH 1/2] emacs: remove some code duplication in notmuch-show

Date: Mon, 28 Nov 2011 13:28:55 -0500

To: Jameson Graef Rollins

Cc: notmuch@notmuchmail.org

From: Austin Clements


Quoth Jameson Graef Rollins on Nov 28 at  6:24 am:
> On Sat, 26 Nov 2011 02:23:30 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> > -(defun notmuch-show-get-header (header)
> > +(defun notmuch-show-get-header (header &optional props)
> >    "Return the named header of the current message, if any."
> > -  (plist-get (notmuch-show-get-prop :headers) header))
> > +  (plist-get (notmuch-show-get-prop :headers props) header))
> 
> Hey, Dmitry.  It looks like the new plist-get call is assuming props is
> defined, but it looks like it's only optional in the argument list.
> Wouldn't the function fail if the props argument is not supplied?

If props isn't provided, it'll be nil, so notmuch-show-get-prop will
also interpret its optional props argument as not being provided.

Thread: