On Thu, 12 Jan 2012 18:23:44 +0100, Pieter Praet 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.