[PATCH 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists
David Edmondson
dme at dme.org
Mon Jan 16 03:43:25 PST 2012
On Thu, 12 Jan 2012 18:23:44 +0100, Pieter Praet <pieter at praet.org> wrote:
> + (make-text-button string-start string-end
> 'action `(lambda (arg)
> - (notmuch-show ,(match-string-no-properties 0)))
> + (notmuch-show-if-found ,message-id))
I like this, but wonder idly about the performance impact (not enough to
suggest denying it, though).
> +(defun notmuch-show-found-target-p (target)
> + (let ((args `("count" ,target)))
> + (> (string-to-number (substring
> + (with-output-to-string
> + (apply 'call-process notmuch-command nil standard-output nil args))
> + 0 -1)) 0)))
`substring' seems unnecessary, presuming that it's to get rid of the
carriage return.
> +(defun notmuch-show-if-found (target &rest args)
> + (if (notmuch-show-found-target-p target nil)
> + (notmuch-show target args)
> + (error (format "Can't find target: %s" target))))
`error' will format strings without help.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20120116/874115a1/attachment.pgp>
More information about the notmuch
mailing list