From: Mark Walters Date: Fri, 5 Jul 2013 18:11:12 +0000 (+0100) Subject: [PATCH 05/11] contrib: pick: add in to-message-window function X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e088fe9ba15c634ec92a27ffa62e135a07f89d43;p=notmuch-archives.git [PATCH 05/11] contrib: pick: add in to-message-window function --- diff --git a/66/9fb74960831d9420eb891481741a6a2e9cb92c b/66/9fb74960831d9420eb891481741a6a2e9cb92c new file mode 100644 index 000000000..63c72600f --- /dev/null +++ b/66/9fb74960831d9420eb891481741a6a2e9cb92c @@ -0,0 +1,109 @@ +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 5E4AA431FC2 + for ; Fri, 5 Jul 2013 11:11:46 -0700 (PDT) +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 KBeQgltsSpUO for ; + Fri, 5 Jul 2013 11:11:40 -0700 (PDT) +Received: from mail-ea0-f180.google.com (mail-ea0-f180.google.com + [209.85.215.180]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 89558431FAE + for ; Fri, 5 Jul 2013 11:11:35 -0700 (PDT) +Received: by mail-ea0-f180.google.com with SMTP id k10so1638361eaj.25 + for ; Fri, 05 Jul 2013 11:11:34 -0700 (PDT) +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=o4/hlSSp0f3JwFkmee7H5vDLLetaaaieKVFRt9JSZrA=; + b=GHu7r2vrZcCek3m1JZnBei66bvjqBvf/5c1qj5rD97/qZTSw61hJvTcmyqKOwzxOBf + kQ+99RNrCgv2hpATNdYcopDtNifgTn7rp0qNnRnK6G0bQpjeFjPyGjxavG3ha0DUpQj8 + gnoBBTxXuwAVJppBoy+7ngEa6nE7dg1nZlzT2/E897zZsHOHRH8js+9WemJ+8kJHboWi + p3S+6t+ER/ximv5m6P7F02IKCxupwEHKQtXs6tTZyFN2YEB6E4xV5Wics5zBdI52BXwm + 11FFbAdVjdCZXWctryggya8C5Z9uUzH26F5wEmzZwBi7C1IYtVhhqtyxDiRxeMGk2P0V + iVAw== +X-Received: by 10.14.48.77 with SMTP id u53mr13160639eeb.154.1373047894391; + Fri, 05 Jul 2013 11:11:34 -0700 (PDT) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPSA id + n42sm15853841eeh.15.2013.07.05.11.11.33 for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Fri, 05 Jul 2013 11:11:33 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 05/11] contrib: pick: add in to-message-window function +Date: Fri, 5 Jul 2013 19:11:12 +0100 +Message-Id: <1373047878-20822-6-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1373047878-20822-1-git-send-email-markwalters1009@gmail.com> +References: <1373047878-20822-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: Fri, 05 Jul 2013 18:11:46 -0000 + +This would be very simple but we want to get a useful doc string (so +we get useful help messages). + +We use this for tabbing between and activate buttons in the message +pane but it is trivial for pick or the user to link in other +functions. For example + +(define-key map "h" (notmuch-pick-to-message-pane #'notmuch-show-toggle-visibility-headers)) + +Other plausible functions for linking are + +notmuch-show-toggle-elide-non-matching +notmuch-show-toggle-process-crypto +notmuch-show-toggle-thread-indentation +toggle-truncate-lines +--- + contrib/notmuch-pick/notmuch-pick.el | 13 +++++++++++++ + 1 files changed, 13 insertions(+), 0 deletions(-) + +diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el +index 7313100..8251b35 100644 +--- a/contrib/notmuch-pick/notmuch-pick.el ++++ b/contrib/notmuch-pick/notmuch-pick.el +@@ -187,6 +187,19 @@ if the user has loaded a different buffer in that window.") + (make-variable-buffer-local 'notmuch-pick-message-buffer) + (put 'notmuch-pick-message-buffer 'permanent-local t) + ++(defun notmuch-pick-to-message-pane (func) ++ "Execute FUNC in message pane. ++ ++This function returns a function (so can be used as a keybinding) ++which executes function FUNC in the message pane if it is ++open (if the message pane is closed it does nothing)." ++ `(lambda () ++ ,(concat "(In message pane) " (documentation func t)) ++ (interactive) ++ (when (window-live-p notmuch-pick-message-window) ++ (with-selected-window notmuch-pick-message-window ++ (funcall #',func))))) ++ + (defvar notmuch-pick-mode-map + (let ((map (make-sparse-keymap))) + (define-key map [mouse-1] 'notmuch-pick-show-message) +-- +1.7.9.1 +