From 4736b33a5d0b215adfe17a7cd0bd5a484bc6a058 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sun, 13 Dec 2015 20:24:03 +0200 Subject: [PATCH] [PATCH] emacs: hello: display jump key next to saved search when available --- 8d/41e83a2fa7cc54b817808a916699cdd6d4cee7 | 119 ++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 8d/41e83a2fa7cc54b817808a916699cdd6d4cee7 diff --git a/8d/41e83a2fa7cc54b817808a916699cdd6d4cee7 b/8d/41e83a2fa7cc54b817808a916699cdd6d4cee7 new file mode 100644 index 000000000..ae31c5c5e --- /dev/null +++ b/8d/41e83a2fa7cc54b817808a916699cdd6d4cee7 @@ -0,0 +1,119 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 4DB266DE02CE + for ; Sun, 13 Dec 2015 10:24:53 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.541 +X-Spam-Level: +X-Spam-Status: No, score=-0.541 tagged_above=-999 required=5 tests=[AWL=0.179, + DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, + RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id p16AULXVrfdI for ; + Sun, 13 Dec 2015 10:24:51 -0800 (PST) +Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com + [74.125.82.41]) by arlo.cworth.org (Postfix) with ESMTPS id 58FCE6DE0231 for + ; Sun, 13 Dec 2015 10:24:51 -0800 (PST) +Received: by mail-wm0-f41.google.com with SMTP id p66so17128577wmp.0 + for ; Sun, 13 Dec 2015 10:24:51 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=nikula-org.20150623.gappssmtp.com; s=20150623; + h=from:to:cc:subject:date:message-id; + bh=cjrBHFkHaXV9uT60Dj0Zkr0yLctbkWT16ZM6XZdqChI=; + b=ETGAHlDrHJaXWU+X/8i6NQtGWFslVvFA7rI+oJKQFm+aeBdkTXATYOVkb6BjzYvLrl + QlfR/hN9IMfxSZPDqLwS5MQTtB+1njqVn6AZX2sbfdnGaqJP+oYJJnX42wVxDJye4GAm + NuMWtj5W9MDEp75hC9JxGXhktLKOA9OBfd/FnHLbcOL7hmM8VFbkNCotFCBBa8TARwXW + zzkrp3NgmSmIeop3tVA9w8o74xe0FyAjS7QRVC8zfax+DdCR5GOZB9PzP3Rfe7/22Wux + J7sIyot7TV+dHwiP8UPeiXM914hYc8HdqNQIgfdGjNE6eu9u99klfC6Y5hymr3QwEWhx + 1Q1Q== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id; + bh=cjrBHFkHaXV9uT60Dj0Zkr0yLctbkWT16ZM6XZdqChI=; + b=klngbPUvI2ozRSqEG3rgzF0e8fY1uaM9dYcrRudSFzXoxRauT2dh6qW+R/Ln2aWWFr + nBwXqVBVzDB5NGq37JGEqzpaHCj+Ly590E+8afYkIqY4aR1auN6egeeKLl86Wch3gaO3 + jNIq+rptdf1WsXM319nOiQCnZLCNH+hOfIHSo3UDCM9eyXx/0WE7xxfV8ApjAEVgD8b0 + ziXR2nlYwAB0J7YO6/XqKjKjjHgkLwGJGd0WiqqvT9r+c11u4c7quDED0ltPxKkZiKpy + iR6jlniPbdMwUXtJN7LnC6YeCaSp0yYabobcymf6hlxAVtcY8EHQx6qW5sb04PJY0nBO + eVHA== +X-Gm-Message-State: ALoCoQmU58cet9STzH5KWDAaW9bWu1pR7xEYz1shh4OXIQjwsftvrotiHWzXX/JR4Sqm5HIbqFPjLKXdVrsQHhWKSaYm17B3Mw== +X-Received: by 10.194.71.104 with SMTP id t8mr32008017wju.177.1450031089668; + Sun, 13 Dec 2015 10:24:49 -0800 (PST) +Received: from localhost (mobile-access-bcee05-14.dhcp.inet.fi. + [188.238.5.14]) by smtp.gmail.com with ESMTPSA id + 67sm12752524wmm.6.2015.12.13.10.24.48 (version=TLSv1/SSLv3 cipher=OTHER); + Sun, 13 Dec 2015 10:24:49 -0800 (PST) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH] emacs: hello: display jump key next to saved search when + available +Date: Sun, 13 Dec 2015 20:24:03 +0200 +Message-Id: <1450031043-24038-1-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 2.1.4 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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: Sun, 13 Dec 2015 18:24:53 -0000 + +Display the shortcut jump key next to the saved search name in notmuch +hello, if one is defined for the saved search. + +--- + +This is probably something with infinite bikeshedding +potential. Therefore I just quickly hacked something together as a +proof of concept. This displays the jump keys like this: + + 154 Inbox [j i] + +Maybe the space between "j" and the key is unnecessary? Maybe the "j" +itself is unnecessary? Maybe the brackets are unnecessary? Maybe it +could use some color? Does displaying these need to be customizable? +Etc? +--- + emacs/notmuch-hello.el | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el +index 738baad23b20..3c5440331669 100644 +--- a/emacs/notmuch-hello.el ++++ b/emacs/notmuch-hello.el +@@ -578,7 +578,9 @@ with `notmuch-hello-query-counts'." + (oldest-first t) + (otherwise notmuch-search-oldest-first))) + (search-type (eq (plist-get elem :search-type) 'tree)) +- (msg-count (plist-get elem :count))) ++ (msg-count (plist-get elem :count)) ++ (key (plist-get elem :key)) ++ (shortcut (if key (format " [j %s]" key) nil))) + (widget-insert (format "%8s " + (notmuch-hello-nice-number msg-count))) + (widget-create 'push-button +@@ -587,8 +589,10 @@ with `notmuch-hello-query-counts'." + :notmuch-search-oldest-first oldest-first + :notmuch-search-type search-type + name) ++ (when shortcut ++ (widget-insert shortcut)) + (setq column-indent +- (1+ (max 0 (- column-width (length name))))))) ++ (1+ (max 0 (- column-width (length name) (length shortcut))))))) + (setq count (1+ count)) + (when (eq (% count tags-per-line) 0) + (setq column-indent 0) +-- +2.1.4 + -- 2.26.2