unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [RFC] vim plugin rewrite II
@ 2012-01-14  7:54 anton
  2012-01-15  2:15 ` David Bremner
  2012-04-18 14:21 ` Felipe Contreras
  0 siblings, 2 replies; 9+ messages in thread
From: anton @ 2012-01-14  7:54 UTC (permalink / raw)
  To: notmuch


Hi,
this is a followup to my mail from spring where i presented a partial
rewrite of the vim plugin using python. There weren't many comments back
then, so I hope there will be more now.

I've changed the filenames so my version now coexists with the current
vim plugin. You can find it in

git://git.khirnov.net/git/notmuch

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.

The advantages over current vim client are still the following:
* sending and displaying/saving attachments
* much better unicode support
* tag name and search commands completion
* proper representation of the thread structure
* easier to extend thanks to python's massive standard library

Please comment.

-- 
Anton Khirnov

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] vim plugin rewrite II
  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
  2012-04-18 14:21 ` Felipe Contreras
  1 sibling, 1 reply; 9+ messages in thread
From: David Bremner @ 2012-01-15  2:15 UTC (permalink / raw)
  To: anton, notmuch

On Sat, 14 Jan 2012 08:54:43 +0100, anton@khirnov.net wrote:
> 
> The advantages over current vim client are still the following:
> * sending and displaying/saving attachments
> * much better unicode support
> * tag name and search commands completion
> * proper representation of the thread structure
> * easier to extend thanks to python's massive standard library
> 
> Please comment.

Hi Anton;

I'm not a vim user, so I probably can't say anything very helpful, but
it does sound like some nice improvements.  Hopefully one of our vim
front-end users can comment a bit more.  One thing I wondered about is
if your version is still completely synchronous, with the resulting
problems dealing with large (say, more than 10000 messages) search
results?

All the best,

David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] vim plugin rewrite II
  2012-01-15  2:15 ` David Bremner
@ 2012-01-15 15:34   ` Anton Khirnov
       [not found]     ` <87mx9n7dq4.fsf@servo.finestructure.net>
  0 siblings, 1 reply; 9+ messages in thread
From: Anton Khirnov @ 2012-01-15 15:34 UTC (permalink / raw)
  To: David Bremner, notmuch


On Sat, 14 Jan 2012 22:15:07 -0400, David Bremner <david@tethera.net> wrote:
> On Sat, 14 Jan 2012 08:54:43 +0100, anton@khirnov.net wrote:
> > 
> > The advantages over current vim client are still the following:
> > * sending and displaying/saving attachments
> > * much better unicode support
> > * tag name and search commands completion
> > * proper representation of the thread structure
> > * easier to extend thanks to python's massive standard library
> > 
> > Please comment.
> 
> Hi Anton;
> 
> I'm not a vim user, so I probably can't say anything very helpful, but
> it does sound like some nice improvements.  Hopefully one of our vim
> front-end users can comment a bit more.  One thing I wondered about is
> if your version is still completely synchronous, with the resulting
> problems dealing with large (say, more than 10000 messages) search
> results?
> 

Yes, it's still synchronous. I suppose making it asynchronous shouldn't
be all that hard, i just never found enough time and motivation for that
(it was never a huge problem here).

-- 
Anton Khirnov

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] vim plugin rewrite II
       [not found]     ` <87mx9n7dq4.fsf@servo.finestructure.net>
@ 2012-01-16 19:04       ` Anton Khirnov
  0 siblings, 0 replies; 9+ messages in thread
From: Anton Khirnov @ 2012-01-16 19:04 UTC (permalink / raw)
  To: Jameson Graef Rollins, notmuch


On Mon, 16 Jan 2012 09:34:59 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> On Sun, 15 Jan 2012 16:34:08 +0100, Anton Khirnov <anton@khirnov.net> wrote:
> > Yes, it's still synchronous. I suppose making it asynchronous shouldn't
> > be all that hard, i just never found enough time and motivation for that
> > (it was never a huge problem here).
> 
> My understanding was that vim was not actually capable of loading files
> asynchronously.  That would be very interesting if it was.
> 

It should be possible to run the query in a separate python thread which
would write the results into the vim buffer.

-- 
Anton Khirnov

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] vim plugin rewrite II
  2012-01-14  7:54 [RFC] vim plugin rewrite II anton
  2012-01-15  2:15 ` David Bremner
@ 2012-04-18 14:21 ` Felipe Contreras
  2012-04-18 14:42   ` Felipe Contreras
  1 sibling, 1 reply; 9+ messages in thread
From: Felipe Contreras @ 2012-04-18 14:21 UTC (permalink / raw)
  To: anton; +Cc: notmuch

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.

Cheers.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] vim plugin rewrite II
  2012-04-18 14:21 ` Felipe Contreras
@ 2012-04-18 14:42   ` Felipe Contreras
  2012-04-19 16:36     ` Felipe Contreras
  0 siblings, 1 reply; 9+ messages in thread
From: Felipe Contreras @ 2012-04-18 14:42 UTC (permalink / raw)
  To: anton; +Cc: notmuch

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.

Cheers.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] vim plugin rewrite II
  2012-04-18 14:42   ` Felipe Contreras
@ 2012-04-19 16:36     ` Felipe Contreras
  2012-05-02 20:23       ` Anton Khirnov
  0 siblings, 1 reply; 9+ messages in thread
From: Felipe Contreras @ 2012-04-19 16:36 UTC (permalink / raw)
  To: anton; +Cc: notmuch

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

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.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] vim plugin rewrite II
  2012-04-19 16:36     ` Felipe Contreras
@ 2012-05-02 20:23       ` Anton Khirnov
  2012-05-04 11:19         ` Felipe Contreras
  0 siblings, 1 reply; 9+ messages in thread
From: Anton Khirnov @ 2012-05-02 20:23 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: notmuch


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] vim plugin rewrite II
  2012-05-02 20:23       ` Anton Khirnov
@ 2012-05-04 11:19         ` Felipe Contreras
  0 siblings, 0 replies; 9+ messages in thread
From: Felipe Contreras @ 2012-05-04 11:19 UTC (permalink / raw)
  To: Anton Khirnov; +Cc: notmuch

On Wed, May 2, 2012 at 10:23 PM, Anton Khirnov <anton@khirnov.net> wrote:

> sorry for the late reply, I see you already reached the same point as
> me, except with ruby ;) Yay for competition.

I think my plugin is a bit further. And yeah, competition is good, but
also collaboration; hopefully the 3 plugins can share as much as
possible.

>> 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.

Interesting. I would need to check that, but I don't have time right now =/

Cheers.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-05-04 11:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2012-05-04 11:19         ` Felipe Contreras

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).