[PATCH v2] VIM: Use notmuch CLI for config
Ian Main writes: > This patch switches from reading .notmuch-config directly to using > the CLI the same way that emacs does it. It actually uses less code > and is probably less error prone. > > Ian We're starting to get a few notmuch-vim patches ready at http://nmbug.tethera.net/status/#Maybe-Ready-vim- Unless Felipe convinces me otherwise, I'll start merging these into notmuch master in the next few days. d
[PATCH v3 3/4] cli: Extend the search command for --output={sender, recipients}
Hi Michal, been busy lately so I haven't got into this... ... I'll look into it in a bit more detail a bit later, On Tue, Oct 14 2014, Michal Sojka wrote: > > I don't know. You seem to think about this in the opposite way than how > it is implemented. The implementation really filters things out whereas > you specify what not to filter. > > My feeling is that if you would implement your proposal, the code would > be more complex than in my patch, because the mapping between command > line options and the actual algorithm would require some extra code. And > in a previous comment, you preferred simplicity. Yes, maybe the choice of reusing --duplicate was bad, and perhaps took thought from the main point -- what kind output options should be possible... > Hopefully, you consider the above as "healthy" criticism. Yes, I do -- I hope we can get something decent out in this in near future, with duplicate filtering that can have useful options to be used directly by MUAs and no duplicate filtering option which I can use in nottoomuch-addresses in 2016 ;D > Thanks for quick review. > -Michal Tomi
[PATCH] VIM: Make an option to save sent mail locally
On Tue, Oct 07 2014, Ian Main wrote: > Tomi Ollila wrote: >> On Mon, Oct 06 2014, Ian Main wrote: >> >> > Add an option to use 'notmuch insert' to save your sent mail. >> > --- >> > >> > Add -inbox as well. >> > >> > vim/notmuch.vim | 17 + >> > 1 file changed, 17 insertions(+) >> > >> > diff --git a/vim/notmuch.vim b/vim/notmuch.vim >> > index 331e930..a9044c4 100644 >> > --- a/vim/notmuch.vim >> > +++ b/vim/notmuch.vim >> > @@ -58,6 +58,7 @@ let s:notmuch_date_format_default = '%d.%m.%y' >> > let s:notmuch_datetime_format_default = '%d.%m.%y %H:%M:%S' >> > let s:notmuch_reader_default = 'mutt -f %s' >> > let s:notmuch_sendmail_default = 'sendmail' >> > +let s:notmuch_save_sent_locally_default = 1 >> > let s:notmuch_folders_count_threads_default = 0 >> > >> > function! s:new_file_buffer(type, fname) >> > @@ -108,6 +109,18 @@ EOF >> >echohl None >> >return >> >endif >> >> AFAIU looks mmm. readable ;) >> >> > + >> > + if g:notmuch_save_sent_locally >> > + let out = system('cat ' . fname . ' | notmuch insert >> > --create-folder --folder=Sent +sent -unread -inbox') >> >> as this is (looks like) shell invocation, this could be in format >> >> let out = system('notmuch insert --create-folder --folder=Sent +sent -unread >> -inbox < ' . fname) > > You are right, that's better. > >> or even >> >> let out = system('exec notmuch insert --create-folder --folder=Sent +sent >> -unread -inbox < ' . fname) >> >> (well, the latter would be out of the status quo) >> >> Ok, I looked a bit into the notmuch.vim -code, and noticed sometimes >> system() command lines use "notmuch" and sometimes g:notmuch_cmd >> -- I think the latter should be used in new code and the previous ones >> should be fixed. >> >> i.e. system ( g:notmuch_cmd . ' insert ... ' < . fname) >> >> Totally untested from my part... >> >> When the change alike this lands to the notmuch repository this needs NEWS >> item which informs that from now sent mails are notmuch-inserted to >> user's mail store (as this seems to be the default...) -- well, let's see >> that when there are real reviewers (i.e. those who are interested to and can >> test this). > > Also a good suggestion. From what I see they always use 'notmuch' straight up > which is probably a reasonable assumption. I do think the actual init code > for > vim could have a few more checks, such as verifying that 'notmuch' is in $PATH > etc. > > Thanks for the review!! I'll send out a new rev tomorrow - very tired > right now. I never seen the new rev... :D > > Ian Tomi
[PATCH] VIM: Improve moving between messages in a thread
On Sat, Oct 18 2014, Franz Fellner wrote: > Ian Main wrote: >> Franz Fellner wrote: >> > Patch works fine for me. It also would be nice to have a "move to next >> > unread message" function. >> > Most beautiful would be a treeview of the thread structure. Currently >> > threads are rendered as plain list, so you can't immediately see and >> > jump to the quoted mail. Bower IMHO uses the best approach here. I tried >> > emacs treeview but did not really like it (partly because I failed badly >> > to implement a solution that shows treeview by default). Indent the >> > whole large Message view IMHO also is not a good (at least to me) >> > solution. >> >> Yeah I agree. This is a start anyway. As I use the vim client more my >> plan is to just keep fixing things that get in my way. > > Great :) > > Just a LGTM to get this pushed. What was this 'vim_puts missed' comment in this thread -- I did not see any followup patch that referred to it -- any potential reviewer may wonder the same... > > Franz Tomi
[PATCH] VIM: Make starting in 'insert' mode for compose optional
On Wed, Oct 01 2014, Ian Main wrote: > This adds a variable to make starting in insert mode optional when > composing and replying to emails. I found it unusual to be started in > insert mode so I thought I'd make it optional as others may find this as > well. Looks "Trivial" enough to look Good To Me (and patch apply) > > Ian > --- > vim/notmuch.vim | 13 +++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/vim/notmuch.vim b/vim/notmuch.vim > index 331e930..252f16b 100644 > --- a/vim/notmuch.vim > +++ b/vim/notmuch.vim > @@ -59,6 +59,7 @@ let s:notmuch_datetime_format_default = '%d.%m.%y %H:%M:%S' > let s:notmuch_reader_default = 'mutt -f %s' > let s:notmuch_sendmail_default = 'sendmail' > let s:notmuch_folders_count_threads_default = 0 > +let s:notmuch_compose_start_insert_default = 1 > > function! s:new_file_buffer(type, fname) > exec printf('edit %s', a:fname) > @@ -132,7 +133,9 @@ function! s:show_reply() > let b:compose_done = 0 > call s:set_map(g:notmuch_compose_maps) > autocmd BufDelete call s:on_compose_delete() > - startinsert! > + if g:notmuch_compose_start_insert > + startinsert! > + end > endfunction > > function! s:compose() > @@ -140,7 +143,9 @@ function! s:compose() > let b:compose_done = 0 > call s:set_map(g:notmuch_compose_maps) > autocmd BufDelete call s:on_compose_delete() > - startinsert! > + if g:notmuch_compose_start_insert > + startinsert! > + end > endfunction > > function! s:show_info() > @@ -428,6 +433,10 @@ function! s:set_defaults() > endif > endif > > + if !exists('g:notmuch_compose_start_insert') > + let g:notmuch_compose_start_insert = > s:notmuch_compose_start_insert_default > + endif > + > if !exists('g:notmuch_custom_search_maps') && > exists('g:notmuch_rb_custom_search_maps') > let g:notmuch_custom_search_maps = > g:notmuch_rb_custom_search_maps > endif > -- > 1.9.3 > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] Make patch saving in vim a little better.
On Wed, Oct 01 2014, Ian Main wrote: > It seems like there was some bitrot on the previous version of this > which made it not work correctly. This fixes the bitrot and also > updates how it works. > > - Sometimes [PATCH.*] isn't at the beginning of the message (often on > lists I'm on). > - It now goes through all the messages in the thread. for some reason > the toplevel messages didn't usually contain all the patches in my > testing. > - Check for 'Re:' at the beginning and skip if it's there. > - Save patches to filesystem-safe filename containing the subject > (unfortunately we use system()...) > > Ian > --- > vim/notmuch.vim | 14 ++ > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/vim/notmuch.vim b/vim/notmuch.vim > index b33c6c6..d80f22f 100644 > --- a/vim/notmuch.vim > +++ b/vim/notmuch.vim > @@ -182,12 +182,18 @@ ruby << EOF > q = $curbuf.query($cur_thread) > t = q.search_threads.first > n = 0 > - t.toplevel_messages.first.replies.each do |m| > - next if not m['subject'] =~ /^\[PATCH.*\]/ > - file = "%04d.patch" % [n += 1] > + t.messages.each do |m| > + next if not m['subject'] =~ /\[PATCH.*\]/ > + next if m['subject'] =~ /^Re:/ > + file = "#{m['subject']}-%04d.patch" % [n += 1] Is the subject here taken from first message in the thread or is the subject changing in every message ? If the name is changing (which I presume, cannot test), the list of files will look a bit confusing. This could follow the git patch naming where the number is at the beginning of filename. > + # Sanitize for the filesystem > + file.gsub!(/[^0-9A-Za-z.\-]/, '_') > + # Remove leading underscores. > + file.gsub!(/^_+/, '') The naming could also follow git way, dashes (-) between words and replacing multiple --:s with just one - (like gsub(/--+/, '-')) -- but in this case there could something in the filename to distinguish from git patches as these patches may be `git am` -incompatible. > + vim_puts "Saving patch to #{file}" > system "notmuch show --format=mbox id:#{m.message_id} > #{file}" > end > - vim_puts "Saved #{n} patches" > + vim_puts "Saved #{n} patch(es)" > EOF > endfunction > > -- > 1.9.3 > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v2] VIM: Use notmuch CLI for config
Ian Main writes: > This patch switches from reading .notmuch-config directly to using > the CLI the same way that emacs does it. It actually uses less code > and is probably less error prone. > > Ian We're starting to get a few notmuch-vim patches ready at http://nmbug.tethera.net/status/#Maybe-Ready-vim- Unless Felipe convinces me otherwise, I'll start merging these into notmuch master in the next few days. d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v3 3/4] cli: Extend the search command for --output={sender, recipients}
Hi Michal, been busy lately so I haven't got into this... ... I'll look into it in a bit more detail a bit later, On Tue, Oct 14 2014, Michal Sojka wrote: > > I don't know. You seem to think about this in the opposite way than how > it is implemented. The implementation really filters things out whereas > you specify what not to filter. > > My feeling is that if you would implement your proposal, the code would > be more complex than in my patch, because the mapping between command > line options and the actual algorithm would require some extra code. And > in a previous comment, you preferred simplicity. Yes, maybe the choice of reusing --duplicate was bad, and perhaps took thought from the main point -- what kind output options should be possible... > Hopefully, you consider the above as "healthy" criticism. Yes, I do -- I hope we can get something decent out in this in near future, with duplicate filtering that can have useful options to be used directly by MUAs and no duplicate filtering option which I can use in nottoomuch-addresses in 2016 ;D > Thanks for quick review. > -Michal Tomi ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] VIM: Make an option to save sent mail locally
On Tue, Oct 07 2014, Ian Main wrote: > Tomi Ollila wrote: >> On Mon, Oct 06 2014, Ian Main wrote: >> >> > Add an option to use 'notmuch insert' to save your sent mail. >> > --- >> > >> > Add -inbox as well. >> > >> > vim/notmuch.vim | 17 + >> > 1 file changed, 17 insertions(+) >> > >> > diff --git a/vim/notmuch.vim b/vim/notmuch.vim >> > index 331e930..a9044c4 100644 >> > --- a/vim/notmuch.vim >> > +++ b/vim/notmuch.vim >> > @@ -58,6 +58,7 @@ let s:notmuch_date_format_default = '%d.%m.%y' >> > let s:notmuch_datetime_format_default = '%d.%m.%y %H:%M:%S' >> > let s:notmuch_reader_default = 'mutt -f %s' >> > let s:notmuch_sendmail_default = 'sendmail' >> > +let s:notmuch_save_sent_locally_default = 1 >> > let s:notmuch_folders_count_threads_default = 0 >> > >> > function! s:new_file_buffer(type, fname) >> > @@ -108,6 +109,18 @@ EOF >> >echohl None >> >return >> >endif >> >> AFAIU looks mmm. readable ;) >> >> > + >> > + if g:notmuch_save_sent_locally >> > + let out = system('cat ' . fname . ' | notmuch insert >> > --create-folder --folder=Sent +sent -unread -inbox') >> >> as this is (looks like) shell invocation, this could be in format >> >> let out = system('notmuch insert --create-folder --folder=Sent +sent -unread >> -inbox < ' . fname) > > You are right, that's better. > >> or even >> >> let out = system('exec notmuch insert --create-folder --folder=Sent +sent >> -unread -inbox < ' . fname) >> >> (well, the latter would be out of the status quo) >> >> Ok, I looked a bit into the notmuch.vim -code, and noticed sometimes >> system() command lines use "notmuch" and sometimes g:notmuch_cmd >> -- I think the latter should be used in new code and the previous ones >> should be fixed. >> >> i.e. system ( g:notmuch_cmd . ' insert ... ' < . fname) >> >> Totally untested from my part... >> >> When the change alike this lands to the notmuch repository this needs NEWS >> item which informs that from now sent mails are notmuch-inserted to >> user's mail store (as this seems to be the default...) -- well, let's see >> that when there are real reviewers (i.e. those who are interested to and can >> test this). > > Also a good suggestion. From what I see they always use 'notmuch' straight up > which is probably a reasonable assumption. I do think the actual init code > for > vim could have a few more checks, such as verifying that 'notmuch' is in $PATH > etc. > > Thanks for the review!! I'll send out a new rev tomorrow - very tired > right now. I never seen the new rev... :D > > Ian Tomi ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] VIM: Improve moving between messages in a thread
On Sat, Oct 18 2014, Franz Fellner wrote: > Ian Main wrote: >> Franz Fellner wrote: >> > Patch works fine for me. It also would be nice to have a "move to next >> > unread message" function. >> > Most beautiful would be a treeview of the thread structure. Currently >> > threads are rendered as plain list, so you can't immediately see and >> > jump to the quoted mail. Bower IMHO uses the best approach here. I tried >> > emacs treeview but did not really like it (partly because I failed badly >> > to implement a solution that shows treeview by default). Indent the >> > whole large Message view IMHO also is not a good (at least to me) >> > solution. >> >> Yeah I agree. This is a start anyway. As I use the vim client more my >> plan is to just keep fixing things that get in my way. > > Great :) > > Just a LGTM to get this pushed. What was this 'vim_puts missed' comment in this thread -- I did not see any followup patch that referred to it -- any potential reviewer may wonder the same... > > Franz Tomi ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] VIM: Make starting in 'insert' mode for compose optional
On Wed, Oct 01 2014, Ian Main wrote: > This adds a variable to make starting in insert mode optional when > composing and replying to emails. I found it unusual to be started in > insert mode so I thought I'd make it optional as others may find this as > well. Looks "Trivial" enough to look Good To Me (and patch apply) > > Ian > --- > vim/notmuch.vim | 13 +++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/vim/notmuch.vim b/vim/notmuch.vim > index 331e930..252f16b 100644 > --- a/vim/notmuch.vim > +++ b/vim/notmuch.vim > @@ -59,6 +59,7 @@ let s:notmuch_datetime_format_default = '%d.%m.%y %H:%M:%S' > let s:notmuch_reader_default = 'mutt -f %s' > let s:notmuch_sendmail_default = 'sendmail' > let s:notmuch_folders_count_threads_default = 0 > +let s:notmuch_compose_start_insert_default = 1 > > function! s:new_file_buffer(type, fname) > exec printf('edit %s', a:fname) > @@ -132,7 +133,9 @@ function! s:show_reply() > let b:compose_done = 0 > call s:set_map(g:notmuch_compose_maps) > autocmd BufDelete call s:on_compose_delete() > - startinsert! > + if g:notmuch_compose_start_insert > + startinsert! > + end > endfunction > > function! s:compose() > @@ -140,7 +143,9 @@ function! s:compose() > let b:compose_done = 0 > call s:set_map(g:notmuch_compose_maps) > autocmd BufDelete call s:on_compose_delete() > - startinsert! > + if g:notmuch_compose_start_insert > + startinsert! > + end > endfunction > > function! s:show_info() > @@ -428,6 +433,10 @@ function! s:set_defaults() > endif > endif > > + if !exists('g:notmuch_compose_start_insert') > + let g:notmuch_compose_start_insert = > s:notmuch_compose_start_insert_default > + endif > + > if !exists('g:notmuch_custom_search_maps') && > exists('g:notmuch_rb_custom_search_maps') > let g:notmuch_custom_search_maps = > g:notmuch_rb_custom_search_maps > endif > -- > 1.9.3 > > ___ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] Make patch saving in vim a little better.
On Wed, Oct 01 2014, Ian Main wrote: > It seems like there was some bitrot on the previous version of this > which made it not work correctly. This fixes the bitrot and also > updates how it works. > > - Sometimes [PATCH.*] isn't at the beginning of the message (often on > lists I'm on). > - It now goes through all the messages in the thread. for some reason > the toplevel messages didn't usually contain all the patches in my > testing. > - Check for 'Re:' at the beginning and skip if it's there. > - Save patches to filesystem-safe filename containing the subject > (unfortunately we use system()...) > > Ian > --- > vim/notmuch.vim | 14 ++ > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/vim/notmuch.vim b/vim/notmuch.vim > index b33c6c6..d80f22f 100644 > --- a/vim/notmuch.vim > +++ b/vim/notmuch.vim > @@ -182,12 +182,18 @@ ruby << EOF > q = $curbuf.query($cur_thread) > t = q.search_threads.first > n = 0 > - t.toplevel_messages.first.replies.each do |m| > - next if not m['subject'] =~ /^\[PATCH.*\]/ > - file = "%04d.patch" % [n += 1] > + t.messages.each do |m| > + next if not m['subject'] =~ /\[PATCH.*\]/ > + next if m['subject'] =~ /^Re:/ > + file = "#{m['subject']}-%04d.patch" % [n += 1] Is the subject here taken from first message in the thread or is the subject changing in every message ? If the name is changing (which I presume, cannot test), the list of files will look a bit confusing. This could follow the git patch naming where the number is at the beginning of filename. > + # Sanitize for the filesystem > + file.gsub!(/[^0-9A-Za-z.\-]/, '_') > + # Remove leading underscores. > + file.gsub!(/^_+/, '') The naming could also follow git way, dashes (-) between words and replacing multiple --:s with just one - (like gsub(/--+/, '-')) -- but in this case there could something in the filename to distinguish from git patches as these patches may be `git am` -incompatible. > + vim_puts "Saving patch to #{file}" > system "notmuch show --format=mbox id:#{m.message_id} > #{file}" > end > - vim_puts "Saved #{n} patches" > + vim_puts "Saved #{n} patch(es)" > EOF > endfunction > > -- > 1.9.3 > > ___ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch