From: Austin Clements Date: Tue, 5 Aug 2014 01:44:03 +0000 (+2000) Subject: Re: [PATCH v2 1/2] emacs: Introduce notmuch-jump: shortcut keys to saved searches X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3cbab22366ab8218626608b95a4a6d7e36c0a50f;p=notmuch-archives.git Re: [PATCH v2 1/2] emacs: Introduce notmuch-jump: shortcut keys to saved searches --- diff --git a/82/8a50e89c1c43949f974c389549730c7a1c0c52 b/82/8a50e89c1c43949f974c389549730c7a1c0c52 new file mode 100644 index 000000000..4460f1b4d --- /dev/null +++ b/82/8a50e89c1c43949f974c389549730c7a1c0c52 @@ -0,0 +1,182 @@ +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 15CB2431FBC + for ; Mon, 4 Aug 2014 18:44:14 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -2.3 +X-Spam-Level: +X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_MED=-2.3] 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 qW1M2KinJxE6 for ; + Mon, 4 Aug 2014 18:44:07 -0700 (PDT) +Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu + [18.9.25.12]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id B686C431FAE + for ; Mon, 4 Aug 2014 18:44:07 -0700 (PDT) +X-AuditID: 1209190c-f79ef6d000005dd6-11-53e036e65542 +Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) + (using TLS with cipher AES256-SHA (256/256 bits)) + (Client did not present a certificate) + by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP + id FB.64.24022.6E630E35; Mon, 4 Aug 2014 21:44:07 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id s751i5vL005609; + Mon, 4 Aug 2014 21:44:05 -0400 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s751i3jl004814 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); + Mon, 4 Aug 2014 21:44:04 -0400 +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) + (envelope-from ) + id 1XETnH-0008EX-8K; Mon, 04 Aug 2014 21:44:03 -0400 +Date: Mon, 4 Aug 2014 21:44:03 -0400 +From: Austin Clements +To: David Bremner +Subject: Re: [PATCH v2 1/2] emacs: Introduce notmuch-jump: shortcut keys to + saved searches +Message-ID: <20140805014403.GX13893@mit.edu> +References: <1405353735-26244-1-git-send-email-amdragon@mit.edu> + <1405433166-2198-1-git-send-email-amdragon@mit.edu> + <1405433166-2198-2-git-send-email-amdragon@mit.edu> + <87ha1r6esm.fsf@maritornes.cs.unb.ca> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <87ha1r6esm.fsf@maritornes.cs.unb.ca> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFprGKsWRmVeSWpSXmKPExsUixG6novvc7EGwwSJtixut3YwW++5sYbJY + PZfH4vrNmcwOLB67nv9l8tg56y67x7NVt5g9thx6zxzAEsVlk5Kak1mWWqRvl8CV0bRrI3NB + i0TFit0fmBsY/wh1MXJySAiYSLQf+8YKYYtJXLi3nq2LkYtDSGA2k8T7lt2MIAkhgQ2MEl83 + W0MkTjFJXD5/khXCWcIo8XlHAxtIFYuAisS8TbfYQWw2AQ2JbfuXg3WLCKhKXN02GayGWcBZ + YsaDPWDrhAViJNo3z2UCsXkFdCQu93xngRh6hVHi6vfpjBAJQYmTM5+wQDRrSdz49xKogQPI + lpZY/o8DJMwpYCRx7tlfsDmiQDdMObmNbQKj0Cwk3bOQdM9C6F7AyLyKUTYlt0o3NzEzpzg1 + Wbc4OTEvL7VI11AvN7NELzWldBMjKPg5JXl2ML45qHSIUYCDUYmHV0DtfrAQa2JZcWXuIUZJ + DiYlUd5QvQfBQnxJ+SmVGYnFGfFFpTmpxYcYJTiYlUR48wWBcrwpiZVVqUX5MClpDhYlcd63 + 1lbBQgLpiSWp2ampBalFMFkZDg4lCd6fpkCNgkWp6akVaZk5JQhpJg5OkOE8QMN7QWp4iwsS + c4sz0yHypxgVpcR5M0ESAiCJjNI8uF5YcnrFKA70ijCvBzBVCfEAExtc9yugwUxAg8107oMM + LklESEk1MC5cJv5A5Z/uqph9uXu/Sgft2y0s3/zn0q8kP5lCCa9ZzfU+pxz8pZembzwWw+ps + u8L2GbPAd5M5tpf8NKc9ExOYOzFeIunEb6mbP6rLPMuaFi848crQs9M+UcxHSyGxf+E99pCN + ccLSBzf+7VQ3qzuZ2Ms5bVfB8ai1ko0XtpgIfg+e2vx/mxJLcUaioRZzUXEiAFsDy3UpAwAA +Cc: notmuch@notmuchmail.org +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: Tue, 05 Aug 2014 01:44:14 -0000 + +Quoth David Bremner on Aug 04 at 8:00 pm: +> Austin Clements writes: +> +> > This introduces notmuch-jump, which is like a user-friendly, +> > user-configurable global prefix map for saved searches. This provi +> +> Unfortunately this patch doesn't apply anymore. + +Drat. Thwarted by my own other patch! + +Rebased series coming shortly (the resolution wasn't anything +interesting). + +> > @@ -18,7 +18,8 @@ emacs_sources := \ +> > $(dir)/notmuch-tag.el \ +> > $(dir)/coolj.el \ +> > $(dir)/notmuch-print.el \ +> > - $(dir)/notmuch-version.el +> > + $(dir)/notmuch-version.el \ +> > + $(dir)/notmuch-jump.el \ +> +> Why the extra \ ? + +It means we can add more lines to this list without having the modify +an existing line, which cleans up future diffs and simplifies future +rebasing and handling of merge conflicts. + +> > +(defun notmuch-jump--plist-delete (plist property) +> > + (let* ((xplist (cons nil plist)) +> > + (pred xplist)) +> > + (while (cdr pred) +> > + (when (eq (cadr pred) property) +> > + (setcdr pred (cdddr pred))) +> > + (setq pred (cddr pred))) +> > + (cdr xplist))) +> +> Should this function maybe be somewhere more generic? + +Good idea. I've moved it to notmuch-lib. The diff from v2 is below: + +diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el +index 9cb1e6a..05bbce5 100644 +--- a/emacs/notmuch-jump.el ++++ b/emacs/notmuch-jump.el +@@ -22,6 +22,7 @@ + + (eval-when-compile (require 'cl)) + ++(require 'notmuch-lib) + (require 'notmuch-hello) + + ;;;###autoload +@@ -90,7 +91,7 @@ (defun notmuch-jump (action-map prompt) + ;; ourselves) from their labels, so disable the minibuffer's + ;; own re-face-ing. + (minibuffer-prompt-properties +- (notmuch-jump--plist-delete ++ (notmuch-plist-delete + (copy-sequence minibuffer-prompt-properties) + 'face)) + ;; Build the keymap with our bindings +@@ -165,15 +166,6 @@ (defun notmuch-jump--make-keymap (action-map) + (exit-minibuffer)))) + map)) + +-(defun notmuch-jump--plist-delete (plist property) +- (let* ((xplist (cons nil plist)) +- (pred xplist)) +- (while (cdr pred) +- (when (eq (cadr pred) property) +- (setcdr pred (cdddr pred))) +- (setq pred (cddr pred))) +- (cdr xplist))) +- + (unless (fboundp 'window-body-width) + ;; Compatibility for Emacs pre-24 + (defun window-body-width (&optional window) +diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el +index a23c85d..19269e3 100644 +--- a/emacs/notmuch-lib.el ++++ b/emacs/notmuch-lib.el +@@ -476,6 +476,15 @@ (defun notmuch-remove-if-not (predicate list) + (setq list (cdr list))) + (nreverse out))) + ++(defun notmuch-plist-delete (plist property) ++ (let* ((xplist (cons nil plist)) ++ (pred xplist)) ++ (while (cdr pred) ++ (when (eq (cadr pred) property) ++ (setcdr pred (cdddr pred))) ++ (setq pred (cddr pred))) ++ (cdr xplist))) ++ + (defun notmuch-split-content-type (content-type) + "Split content/type into 'content' and 'type'" + (split-string content-type "/")) +