From 33fae41afa54a300d826e44377cdd46864776981 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 2 May 2012 22:23:40 +0200 Subject: [PATCH] Re: [RFC] vim plugin rewrite II --- 79/48fd00a4b2ecd065cb54596099b2bff776d2cd | 169 ++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 79/48fd00a4b2ecd065cb54596099b2bff776d2cd diff --git a/79/48fd00a4b2ecd065cb54596099b2bff776d2cd b/79/48fd00a4b2ecd065cb54596099b2bff776d2cd new file mode 100644 index 000000000..4ca6f385c --- /dev/null +++ b/79/48fd00a4b2ecd065cb54596099b2bff776d2cd @@ -0,0 +1,169 @@ +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 A7EC6431FAF + for ; Wed, 2 May 2012 13:23:47 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 QH-oMbyueZDC for ; + Wed, 2 May 2012 13:23:46 -0700 (PDT) +Received: from smtp1.kolej.mff.cuni.cz (smtp1.kolej.mff.cuni.cz + [78.128.192.10]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id C7E14431FAE + for ; Wed, 2 May 2012 13:23:45 -0700 (PDT) +X-Envelope-From: anton@khirnov.net +Received: from daenerys.khirnov.net (zohar.kolej.mff.cuni.cz [78.128.198.199]) + by smtp1.kolej.mff.cuni.cz (8.14.4/8.14.4) with ESMTP id + q42KNeZe083184; Wed, 2 May 2012 22:23:41 +0200 (CEST) + (envelope-from anton@khirnov.net) +Received: from daenerys.khirnov.net (localhost [127.0.0.1]) + by daenerys.khirnov.net (Postfix) with ESMTP id 40707121840; + Wed, 2 May 2012 22:23:40 +0200 (CEST) +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +User-Agent: notmuch-vimpy +Message-ID: <20120502202340.4214.21470@daenerys.khirnov.net> +Date: Wed, 02 May 2012 22:23:40 +0200 +From: Anton Khirnov +To: Felipe Contreras +References: <20120114075443.27927.39754@daenerys.khirnov.net> + + + +In-Reply-To: + +Subject: Re: [RFC] vim plugin rewrite II +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: Wed, 02 May 2012 20:23:47 -0000 + + +Hi, +sorry for the late reply, I see you already reached the same point as +me, except with ruby ;) Yay for competition. + +On Thu, 19 Apr 2012 19:36:56 +0300, Felipe Contreras wrote: +> 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 t= +he +> >>> vim plugins dir and vim/syntax/{nm_vimpy*} to the vim syntax dir and = +run +> >>> :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 +> = + + +Thanks, looks good. + +> 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. + +That is weird, I'm not getting any crashes here. On any exception in the +python code it prints the backtrace and continues normally. I don't +think I've ever seen it actually crash (not counting my ultimately +unsuccessfull attempts at threading). I wonder what could cause this. + +-- = + +Anton Khirnov -- 2.26.2