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 E98AF431FBF for ; Sun, 2 Dec 2012 16:59:01 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 K3UU2YS+kOiV for ; Sun, 2 Dec 2012 16:59:00 -0800 (PST) Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id C76E4431FC2 for ; Sun, 2 Dec 2012 16:58:54 -0800 (PST) Received: by mail-wi0-f175.google.com with SMTP id hm11so787414wib.2 for ; Sun, 02 Dec 2012 16:58:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=HdN992WXFL0vFdWmuse2Rzc4MGBvDeSS60jD4jI8RPA=; b=t7+6hvKDHok4RQz5Zz5qHni5c4N5JZUUoruVBMgH3g3OmUwAICkCONKDbPc6MISrpk r+EtWIFfCr+4GBH7ZTpDYc9vqaByEY/vTreh+3CZPjhc46OnMqgnGErbP1i++j36NNL+ DciJSYUMQGK90YVPx7EpWKYocSLYpinl7eF5fQZ+v61INOpu8p4PKlT+wg4wsXwmb5th 8DPEBWLq5m4YOwdeZ1qT1/92Z8X7DFyI51FetyhgqVEis5a0Sbzw188uaqTeZ3FUm5Uq kZMyZTnZ++JB8nmld8lguGbLP18siphVfMBzyNCfbCTXRaarErvhpt1jho26eB0hzAgX AFKg== Received: by 10.216.209.130 with SMTP id s2mr2933166weo.86.1354496333581; Sun, 02 Dec 2012 16:58:53 -0800 (PST) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPS id d9sm9334493wiw.0.2012.12.02.16.58.52 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 02 Dec 2012 16:58:52 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH v2 3/3] emacs: show make default part button toggle view when sensible Date: Mon, 3 Dec 2012 00:58:37 +0000 Message-Id: <1354496317-24564-4-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1354496317-24564-1-git-send-email-markwalters1009@gmail.com> References: <1354496317-24564-1-git-send-email-markwalters1009@gmail.com> 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: Mon, 03 Dec 2012 00:59:02 -0000 When the part has no filename it is reasonable to guess it is not a part for saving or other normal attachment things so default to toggling viewability. Possibly this should be customisable but the 4 main actions (save, view, open with, toggle viewability) all force that particular action so it is easy for the user to get round if we do make a mistake. --- emacs/notmuch-show.el | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 9a33d28..c8c1657 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1988,7 +1988,12 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')." (defun notmuch-show-part-button-default (&optional button) (interactive) - (notmuch-show-part-button-internal button notmuch-show-part-button-default-action)) + (let* ((button (or button (button-at (point)))) + (filename (and button (button-get button :notmuch-filename))) + (handler (if filename + notmuch-show-part-button-default-action + #'notmuch-show-internally-show-part))) + (notmuch-show-part-button-internal button handler))) (defun notmuch-show-part-button-save (&optional button) (interactive) -- 1.7.9.1