From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 401DC431FD0 for ; Sun, 29 May 2011 09:03:40 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.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 IQoZOG4Ep0bp for ; Sun, 29 May 2011 09:03:39 -0700 (PDT) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 35A23431FB6 for ; Sun, 29 May 2011 09:03:38 -0700 (PDT) Received: by fxm8 with SMTP id 8so2338060fxm.26 for ; Sun, 29 May 2011 09:03:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=W78RplOjH54os9OpQnCsHDT8tJ+epDoh1CaLr5Z0oaY=; b=Z2XWjO1LPxzmmCrD2t4UC3BRnKNQDFMZ3nHSGwVFdkgoglkPrWKIg09Tv0RMxXz9xZ c/BteO2JaF3rAckr0ASBot4Z+RWOzMXv7PeeJiOq3klaAoeOCtX7TWs8p9RnpM2MqZic oMEE+a4gfilqsgXwJBJXxiHX81oBR9EhRk6T0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type; b=TVZlDpia08wF3hKJF8vcwVw3w13kVZTyPljn5WnQfuqG3CE1q4dDJPLLl4lguDRgHk R78ZMgEg5aiSrEmP9V7DJikQ04Hi96kH+1p3UJBfNVTorVt05Vfr1LaLLZ8VGC4jIhj/ cKxXLi9/MrC1gnwl0qIBBRCQ7acZ7ezmW+3bg= Received: by 10.223.71.204 with SMTP id i12mr441142faj.65.1306685015293; Sun, 29 May 2011 09:03:35 -0700 (PDT) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id n15sm456322fag.42.2011.05.29.09.03.33 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 29 May 2011 09:03:34 -0700 (PDT) From: Dmitry Kurochkin To: notmuch@dima.secretsauce.net, notmuch@notmuchmail.org Subject: Re: [PATCH] Added C-up and C-down to cycle through previous searches In-Reply-To: <1306659388-21809-1-git-send-email-notmuch@dima.secretsauce.net> References: <1306659388-21809-1-git-send-email-notmuch@dima.secretsauce.net> User-Agent: Notmuch/0.5-216-g0104e23 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Sun, 29 May 2011 20:04:00 +0400 Message-ID: <87vcwto5n3.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Sun, 29 May 2011 16:03:40 -0000 Hi Dima. On Sun, 29 May 2011 01:56:28 -0700, notmuch@dima.secretsauce.net wrote: > From: Dima Kogan > > --- > > Hi. > > I made a few improvements to the emacs UI. This patch allows the user to scroll > through the most recent searches with C-up and C-down while in the search box. > This sounds like a very nice improvement to me! I just have one concern: Why C-up and C-down? I believe M-p and M-n would be more natural for Emacs users (at least for me :)). Also, I did not read the code and can not comment on it. But notmuch coding style is to use tabs for indentation. I guess .dir-locals.el should be improved to set coding style variables for all modes, not just C. Regards, Dmitry > dima > > emacs/notmuch-hello.el | 49 +++++++++++++++++++++++++++++++++++++++++------ > 1 files changed, 42 insertions(+), 7 deletions(-) > > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el > index 916cda1..56f853f 100644 > --- a/emacs/notmuch-hello.el > +++ b/emacs/notmuch-hello.el > @@ -123,6 +123,12 @@ Typically \",\" in the US and UK and \".\" in Europe." > > (defvar notmuch-hello-recent-searches nil) > > +(defvar notmuch-hello-cyclerecent-index 0 > + "The current index of the most-recent searches" ) > + > +(defvar notmuch-hello-search-widget nil > + "The search widget") > + > (defun notmuch-hello-remember-search (search) > (if (not (member search notmuch-hello-recent-searches)) > (push search notmuch-hello-recent-searches)) > @@ -148,6 +154,28 @@ Typically \",\" in the US and UK and \".\" in Europe." > (match-string 1 search) > search)) > > +(defun notmuch-hello-cyclerecent-next () > + "Cycle through the most recently-searched queries, going forwards" > + (interactive) > + (notmuch-hello-cyclerecent 1)) > + > +(defun notmuch-hello-cyclerecent-prev () > + "Cycle through the most recently-searched queries, going backwards" > + (interactive) > + (notmuch-hello-cyclerecent -1)) > + > +(defun notmuch-hello-cyclerecent (d) () > + > + (when notmuch-hello-recent-searches ; if no recent searches, do nothing > + (let ((N (length notmuch-hello-recent-searches))) > + (setq notmuch-hello-cyclerecent-index > + (% (+ notmuch-hello-cyclerecent-index d N) N))) ; update the index > + > + (widget-value-set notmuch-hello-search-widget > + (nth notmuch-hello-cyclerecent-index notmuch-hello-recent-searches)) > + (widget-setup)) > +) > + > (defun notmuch-hello-search (search) > (let ((search (notmuch-hello-trim search))) > (notmuch-hello-remember-search search) > @@ -455,13 +483,19 @@ Complete list of currently available key bindings: > > (widget-insert "\nSearch: ") > (setq notmuch-hello-search-bar-marker (point-marker)) > - (widget-create 'editable-field > - ;; Leave some space at the start and end of the > - ;; search boxes. > - :size (max 8 (- (window-width) notmuch-hello-indent > - (length "Search: "))) > - :action (lambda (widget &rest ignore) > - (notmuch-hello-search (widget-value widget)))) > + (setq notmuch-hello-search-widget > + (widget-create 'editable-field > + ;; Leave some space at the start and end of the > + ;; search boxes. > + :size (max 8 (- (window-width) notmuch-hello-indent > + (length "Search: "))) > + :action (lambda (widget &rest ignore) > + (notmuch-hello-search (widget-value widget))) > + :keymap (let ((map (make-sparse-keymap))) > + (set-keymap-parent map widget-field-keymap) > + (define-key map (kbd "") 'notmuch-hello-cyclerecent-prev) > + (define-key map (kbd "") 'notmuch-hello-cyclerecent-next) > + map))) > (widget-insert "\n") > > (when notmuch-hello-recent-searches > @@ -535,6 +569,7 @@ Complete list of currently available key bindings: > (widget-insert "Type a search query and hit RET to view matching threads.\n") > (when notmuch-hello-recent-searches > (widget-insert "Hit RET to re-submit a previous search. Edit it first if you like.\n") > + (widget-insert "In the search box, C-up/C-down cycles through the recent searches.\n") > (widget-insert "Save recent searches with the `save' button.\n")) > (when notmuch-saved-searches > (widget-insert "Edit saved searches with the `edit' button.\n")) > -- > 1.7.4.4 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch