unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: notmuch@notmuchmail.org
Subject: Re: [RFC] vim plugin rewrite II
Date: Wed, 02 May 2012 22:23:40 +0200	[thread overview]
Message-ID: <20120502202340.4214.21470@daenerys.khirnov.net> (raw)
In-Reply-To: <CAMP44s0dKJduJs=N-1OqMRZRGyB+GPQXWnbNwBnK0BH7RKxX_g@mail.gmail.com>


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 <felipe.contreras@gmail.com> wrote:
> On Wed, Apr 18, 2012 at 5:42 PM, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
> > On Wed, Apr 18, 2012 at 5:21 PM, Felipe Contreras
> > <felipe.contreras@gmail.com> wrote:
> >> On Sat, Jan 14, 2012 at 9:54 AM,  <anton@khirnov.net> 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 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'  0.47s user 0.02s system 99% cpu 0.501 total
> > vim -c 'quit'  0.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 = expand('<sfile>:p:h')
> -python import sys
> -exec "python sys.path += [r'" . s:python_path . "']"
> -python import vim, nm_vim
> +let s:notmuch_loaded = 1
> 
>  command! NMVimpy call NMVimpy()
> 
> @@ -815,7 +811,11 @@
>  " --- command handler {{{1
> 
>  function! NMVimpy()
> -    call <SID>NM_cmd_folders(g:nm_vimpy_folders)
> +	let s:python_path = expand('<sfile>:p:h')
> +	python import sys
> +	exec "python sys.path += [r'" . s:python_path . "']"
> +	python import vim, nm_vim
> +	call <SID>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 = 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

  reply	other threads:[~2012-05-02 20:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-14  7:54 [RFC] vim plugin rewrite II anton
2012-01-15  2:15 ` David Bremner
2012-01-15 15:34   ` Anton Khirnov
     [not found]     ` <87mx9n7dq4.fsf@servo.finestructure.net>
2012-01-16 19:04       ` Anton Khirnov
2012-04-18 14:21 ` Felipe Contreras
2012-04-18 14:42   ` Felipe Contreras
2012-04-19 16:36     ` Felipe Contreras
2012-05-02 20:23       ` Anton Khirnov [this message]
2012-05-04 11:19         ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120502202340.4214.21470@daenerys.khirnov.net \
    --to=anton@khirnov.net \
    --cc=felipe.contreras@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).