From: Felipe Contreras Date: Thu, 19 Apr 2012 16:36:56 +0000 (+0300) Subject: Re: [RFC] vim plugin rewrite II X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=16fed4911a0da983b39f76d3d9635898d4f1d3fe;p=notmuch-archives.git Re: [RFC] vim plugin rewrite II --- diff --git a/d7/f14f930ffbf629637f1a658c75da4dc2404d25 b/d7/f14f930ffbf629637f1a658c75da4dc2404d25 new file mode 100644 index 000000000..a4a81159c --- /dev/null +++ b/d7/f14f930ffbf629637f1a658c75da4dc2404d25 @@ -0,0 +1,150 @@ +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 9A6D8431FB6 + for ; Thu, 19 Apr 2012 09:37:03 -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 LC6qcmeXed2e for ; + Thu, 19 Apr 2012 09:36:59 -0700 (PDT) +Received: from mail-ey0-f181.google.com (mail-ey0-f181.google.com + [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 3F934431FAE + for ; Thu, 19 Apr 2012 09:36:59 -0700 (PDT) +Received: by eaa1 with SMTP id 1so3563026eaa.26 + for ; Thu, 19 Apr 2012 09:36:56 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=mime-version:in-reply-to:references:date:message-id:subject:from:to + :cc:content-type:content-transfer-encoding; + bh=jwHWiV/VglhOYg2VLs5sRW7dpP7wG09mvohWlIQK2pY=; + b=rxwIJFHfJGTzjQ3j8N3K9mJWMuf8jWY3g3ErfUhZapJGCdA8dWX6dfzLMLo9+QsYkW + JjqIOnoiPf113o7oMxETZ2b6SLKtbXgmddWAM8vDgsScbxsYaAdENEYzeY4SQvQODQMp + o7Zhs5qUm8tolzJ1Hi46C1RjSf7lFNWSyMF8r20ISTFQXjUZqXWTzQG6MKpFyX/pZNsP + ++mNW74WjouHmiXLRCVgj7dhAFehe8Jftbfi1h4xRyWRXI7b46f/FU7YxmhwY3PDJEYp + nTK9ulQt1op1tDAqaQ02dDcYkzTCxFzWGTuSSuktL/5id5WvKLPTXMinMxSNq6S6RyKq + ykgw== +MIME-Version: 1.0 +Received: by 10.213.32.2 with SMTP id a2mr243849ebd.39.1334853416365; Thu, 19 + Apr 2012 09:36:56 -0700 (PDT) +Received: by 10.213.19.67 with HTTP; Thu, 19 Apr 2012 09:36:56 -0700 (PDT) +In-Reply-To: + +References: <20120114075443.27927.39754@daenerys.khirnov.net> + + +Date: Thu, 19 Apr 2012 19:36:56 +0300 +Message-ID: + +Subject: Re: [RFC] vim plugin rewrite II +From: Felipe Contreras +To: anton@khirnov.net +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable +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: Thu, 19 Apr 2012 16:37:03 -0000 + +On Wed, Apr 18, 2012 at 5:42 PM, Felipe Contreras + wrote: +> On Wed, Apr 18, 2012 at 5:21 PM, Felipe Contreras +> wrote: +>> On Sat, Jan 14, 2012 at 9:54 AM, =C2=A0 wrote: +>>> branch vim. Simply copy vim/plugin/{nm_vim.py,notmuch-vimpy.vim} to the +>>> vim plugins dir and vim/syntax/{nm_vimpy*} to the vim syntax dir and ru= +n +>>> :NMVimpy() in vim. You'll need vim with python support and +>>> python-notmuch bindings. +>> +>> I gave this a try, copying those files makes vim crash for me. +>> +>> I probably need to install notmuch's python bindings, but either way +>> it shouldn't crash. +> +> All right, with the bindings it works, but if it cannot find the +> database, it crashes too. +> +> And this slows by 5 times the startup time of vim for me: +> +> vim -c 'quit' =C2=A00.47s user 0.02s system 99% cpu 0.501 total +> vim -c 'quit' =C2=A00.08s user 0.01s system 96% cpu 0.092 total +> +> It is interesting, but I personally I would not use if it's going to +> slow vim for everything else, there must be a way to solve that. Also, +> would be nice if you rebased your branch on top of the latest release. + +I fixed the issue this way: + +--- notmuch-vimpy.vim 2012-04-18 22:38:16.193358898 +0300 ++++ notmuch-vimpy-mod.vim 2012-04-19 17:07:19.390693437 +0300 +@@ -29,11 +29,7 @@ + finish + endif + +-" init the python layer +-let s:python_path =3D expand(':p:h') +-python import sys +-exec "python sys.path +=3D [r'" . s:python_path . "']" +-python import vim, nm_vim ++let s:notmuch_loaded =3D 1 + + command! NMVimpy call NMVimpy() + +@@ -815,7 +811,11 @@ + " --- command handler {{{1 + + function! NMVimpy() +- call NM_cmd_folders(g:nm_vimpy_folders) ++ let s:python_path =3D expand(':p:h') ++ python import sys ++ exec "python sys.path +=3D [r'" . s:python_path . "']" ++ python import vim, nm_vim ++ call NM_cmd_folders(g:nm_vimpy_folders) + endfunction + + "Custom foldtext() for show buffers, which indents folds to +@@ -859,5 +859,3 @@ + python nm_vim.vim_get_tags() + return prefix . substitute(taglist, "\n", "\n" . prefix, "g") + endfunction +- +-let s:notmuch_loaded =3D 1 + +I was seriously considering to concentrate on this plugin instead of +the current one, but I'm afraid every little error causes a crash, +even when a subprocess fails (e.g. msmtp), so it's not really usable +for me. Not to mention that it's really hard to debug, because every +bug causes a crash, and sometimes I get random crashes with no +information about what caused it at all. + +I am starting to work on a version that uses ruby, and it doesn't seem +to have these issues, but lets see. I'm still not sure if we should +depend on ruby/python bindings, maybe there's a way to make them +optional. + +Anyway, if you find a way to improve the crash issues, let me know, so +far it's the only real issue I see with this plug-in. + +Cheers. + +--=20 +Felipe Contreras