RE: [PATCH] VIM: Improve search list
authorFranz Fellner <alpine.art.de@gmail.com>
Sat, 18 Oct 2014 20:31:52 +0000 (22:31 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:05:21 +0000 (10:05 -0800)
aa/f266587401e6d52ba9702e58f01ebe9297b6b0 [new file with mode: 0644]

diff --git a/aa/f266587401e6d52ba9702e58f01ebe9297b6b0 b/aa/f266587401e6d52ba9702e58f01ebe9297b6b0
new file mode 100644 (file)
index 0000000..1bdedef
--- /dev/null
@@ -0,0 +1,165 @@
+Return-Path: <alpine.art.de@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id B6F1F431FBD\r
+       for <notmuch@notmuchmail.org>; Sat, 18 Oct 2014 13:31:50 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id KRw8hCgx9K-M for <notmuch@notmuchmail.org>;\r
+       Sat, 18 Oct 2014 13:31:43 -0700 (PDT)\r
+Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com\r
+ [74.125.82.43])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ 50356431FB6   for <notmuch@notmuchmail.org>; Sat, 18 Oct 2014 13:31:43 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f43.google.com with SMTP id m15so2996051wgh.14\r
+       for <notmuch@notmuchmail.org>; Sat, 18 Oct 2014 13:31:42 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=date:from:to:message-id:in-reply-to:references:subject:mime-version\r
+       :content-type:content-transfer-encoding;\r
+       bh=yBT4SoiHm0D4+jzcJQUVtX7Dko8VjUf6R1T++zwnev0=;\r
+       b=V0lvmy+KJGwHFSQqpQRAXiD9nR6JmWGW+MZZoJjzUj8BT5pS1m9X5Re6o9hxkr2a4r\r
+       Gi8aWJy3us7WZatLK3q874Z1y/j4ez+bhpD4A6CCPIFl7FQy/41JK2QGeKy9mXdX7CnP\r
+       IBK/il0K5DzdW0UJbCv6jb/L3L3sCHxBE7b0lCPIubwu4FzaLekrxAeYb8GYxiRgx2oS\r
+       sKBbuK0e6DG3BLqnkSjW0o5VZMtzra/nD3YhApS++FvltblWB18oVtOqFmOT3oF6aaFk\r
+       26+AFTVgZUBKC4MXlylL0Vmu6PjiTY/MNZv73OIBhpM1pJWKErq9KvMJDI0iJEF59QQo\r
+       Z87Q==\r
+X-Received: by 10.180.101.102 with SMTP id ff6mr8398485wib.34.1413664302216;\r
+       Sat, 18 Oct 2014 13:31:42 -0700 (PDT)\r
+Received: from localhost (p5B00C687.dip0.t-ipconnect.de. [91.0.198.135])\r
+       by mx.google.com with ESMTPSA id yr9sm6158028wjc.31.2014.10.18.13.31.40\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sat, 18 Oct 2014 13:31:41 -0700 (PDT)\r
+Date: Sat, 18 Oct 2014 22:31:52 +0200\r
+From: Franz Fellner <alpine.art.de@gmail.com>\r
+To: Ian Main <imain@stemwinder.org>, Ian Main <imain@stemwinder.org>, \r
+       notmuch@notmuchmail.org\r
+Message-ID: <5442ce38e11bf_255f136de9416@TP_L520.notmuch>\r
+In-Reply-To: <1412621414-31793-1-git-send-email-imain@stemwinder.org>\r
+References: <1412621414-31793-1-git-send-email-imain@stemwinder.org>\r
+Subject: RE: [PATCH] VIM: Improve search list\r
+Mime-Version: 1.0\r
+Content-Type: text/plain;\r
+ charset=utf-8\r
+Content-Transfer-Encoding: 7bit\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 18 Oct 2014 20:31:50 -0000\r
+\r
+LGTM\r
+\r
+Franz\r
+\r
+Ian Main wrote:\r
+> Make the width of the search name column expand/contract with the\r
+> length of the longest search name string.\r
+> \r
+> Fix syntax highlighting to make the above work right.\r
+> \r
+> Add the ability to use a blank search pattern to create a spacer\r
+> to break up searches into groups.\r
+> ---\r
+>  vim/notmuch.txt                |  4 ++++\r
+>  vim/notmuch.vim                | 16 ++++++++++++++--\r
+>  vim/syntax/notmuch-folders.vim |  2 +-\r
+>  3 files changed, 19 insertions(+), 3 deletions(-)\r
+> \r
+> diff --git a/vim/notmuch.txt b/vim/notmuch.txt\r
+> index 4374102..3a73912 100644\r
+> --- a/vim/notmuch.txt\r
+> +++ b/vim/notmuch.txt\r
+> @@ -94,11 +94,15 @@ You can add the following configurations to your `.vimrc`, or\r
+>                                              *g:notmuch_folders*\r
+>  \r
+>  The first thing you might want to do is set your custom searches.\r
+> +\r
+> +Adding an empty set of strings results in a blank line which allows you\r
+> +to break up searches into groups.\r
+>  >\r
+>      let g:notmuch_folders = [\r
+>              \ [ 'new', 'tag:inbox and tag:unread' ],\r
+>              \ [ 'inbox', 'tag:inbox' ],\r
+>              \ [ 'unread', 'tag:unread' ],\r
+> +            \ [ '', '' ],\r
+>              \ [ 'to-do', 'tag:to-do' ],\r
+>              \ [ 'to-me', 'to:john.doe and tag:new' ],\r
+>              \ ]\r
+> diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
+> index 331e930..61a7260 100644\r
+> --- a/vim/notmuch.vim\r
+> +++ b/vim/notmuch.vim\r
+> @@ -374,7 +374,9 @@ function! s:folders_show_search()\r
+>  ruby << EOF\r
+>      n = $curbuf.line_number\r
+>      s = $searches[n - 1]\r
+> -    VIM::command("call s:search('#{s}')")\r
+> +    if s.length > 0\r
+> +            VIM::command("call s:search('#{s}')")\r
+> +    end\r
+>  EOF\r
+>  endfunction\r
+>  \r
+> @@ -633,11 +635,21 @@ ruby << EOF\r
+>                      folders = VIM::evaluate('g:notmuch_folders')\r
+>                      count_threads = VIM::evaluate('g:notmuch_folders_count_threads') == 1\r
+>                      $searches.clear\r
+> +                    longest_name = 0\r
+> +                    folders.each do |name, search|\r
+> +                            if name.length > longest_name\r
+> +                                    longest_name = name.length\r
+> +                            end\r
+> +                    end\r
+>                      folders.each do |name, search|\r
+>                              q = $curbuf.query(search)\r
+>                              $searches << search\r
+>                              count = count_threads ? q.search_threads.count : q.search_messages.count\r
+> -                            b << "%9d %-20s (%s)" % [count, name, search]\r
+> +                            if name == ''\r
+> +                                    b << ""\r
+> +                            else\r
+> +                                    b << "%9d %-#{longest_name + 1}s (%s)" % [count, name, search]\r
+> +                            end\r
+>                      end\r
+>              end\r
+>      end\r
+> diff --git a/vim/syntax/notmuch-folders.vim b/vim/syntax/notmuch-folders.vim\r
+> index 9477f86..03209c1 100644\r
+> --- a/vim/syntax/notmuch-folders.vim\r
+> +++ b/vim/syntax/notmuch-folders.vim\r
+> @@ -1,7 +1,7 @@\r
+>  " notmuch folders mode syntax file\r
+>  \r
+>  syntax region nmFoldersCount     start='^' end='\%10v'\r
+> -syntax region nmFoldersName      start='\%11v' end='\%31v'\r
+> +syntax region nmFoldersName      start='\%11v' end='  ('me=e-1\r
+>  syntax match  nmFoldersSearch    /([^()]\+)$/\r
+>  \r
+>  highlight link nmFoldersCount     Statement\r
+> -- \r
+> 1.9.3\r
+> \r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r
+\r
+\r