unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 0/5] Random patches for notmuch-vim-ruby
@ 2013-01-28 15:52 Kirill A. Shutemov
  2013-01-28 15:52 ` [PATCH 1/5] open_reply: fallback to use addr.local if addr.name is nil Kirill A. Shutemov
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Kirill A. Shutemov @ 2013-01-28 15:52 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: notmuch

From: "Kirill A. Shutemov" <kirill@shutemov.name>

Kirill A. Shutemov (5):
  open_reply: fallback to use addr.local if addr.name is nil
  rename g:notmuch_sendmail -> g:notmuch_rb_sendmail
  /usr/sbin/sendmail as a default g:notmuch_rb_sendmail
  Introduce g:notmuch_rb_folders_count_threads
  Drop harmful reply buffer preparation

 notmuch-ruby.vim |   27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

-- 
1.7.10.4

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

* [PATCH 1/5] open_reply: fallback to use addr.local if addr.name is nil
  2013-01-28 15:52 [PATCH 0/5] Random patches for notmuch-vim-ruby Kirill A. Shutemov
@ 2013-01-28 15:52 ` Kirill A. Shutemov
  2013-04-02 19:31   ` Felipe Contreras
  2013-01-28 15:52 ` [PATCH 2/5] rename g:notmuch_sendmail -> g:notmuch_rb_sendmail Kirill A. Shutemov
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Kirill A. Shutemov @ 2013-01-28 15:52 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: notmuch

From: "Kirill A. Shutemov" <kirill@shutemov.name>

If address doesn't contain name we end up with " wrote:" as a reply
header. It doesn't look nice.

Let's use addr.local + "@" if name is not defined. If addr.local is not
defined too, let's just use "somebody".

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
 notmuch-ruby.vim |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/notmuch-ruby.vim b/notmuch-ruby.vim
index 761c87f..d8a9878 100644
--- a/notmuch-ruby.vim
+++ b/notmuch-ruby.vim
@@ -492,7 +492,11 @@ ruby << EOF
 			lines << ''
 
 			body_lines = []
-			body_lines << "%s wrote:" % Mail::Address.new(orig[:from].value).name
+			addr = Mail::Address.new(orig[:from].value)
+			name = addr.name
+			name = addr.local + "@" if name.nil? && !addr.local.nil?
+			name = "somebody" if name.nil?
+			body_lines << "%s wrote:" % name
 			part = orig.find_first_text
 			part.convert.each_line do |l|
 				body_lines << "> %s" % l.chomp
-- 
1.7.10.4

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

* [PATCH 2/5] rename g:notmuch_sendmail -> g:notmuch_rb_sendmail
  2013-01-28 15:52 [PATCH 0/5] Random patches for notmuch-vim-ruby Kirill A. Shutemov
  2013-01-28 15:52 ` [PATCH 1/5] open_reply: fallback to use addr.local if addr.name is nil Kirill A. Shutemov
@ 2013-01-28 15:52 ` Kirill A. Shutemov
  2013-04-02 19:21   ` Felipe Contreras
  2013-01-28 15:52 ` [PATCH 3/5] /usr/sbin/sendmail as a default g:notmuch_rb_sendmail Kirill A. Shutemov
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Kirill A. Shutemov @ 2013-01-28 15:52 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: notmuch

From: "Kirill A. Shutemov" <kirill@shutemov.name>

All configuration variable use prefix notmuch_rb_ except
notmuch_sendmail. Let's fix it.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
 notmuch-ruby.vim |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/notmuch-ruby.vim b/notmuch-ruby.vim
index d8a9878..624987e 100644
--- a/notmuch-ruby.vim
+++ b/notmuch-ruby.vim
@@ -96,7 +96,7 @@ function! s:compose_send()
 	0,4d
 	write
 
-	let cmdtxt = g:notmuch_sendmail . ' -t -f ' . s:reply_from . ' < ' . fname
+	let cmdtxt = g:notmuch_rb_sendmail . ' -t -f ' . s:reply_from . ' < ' . fname
 	let out = system(cmdtxt)
 	let err = v:shell_error
 	if err
-- 
1.7.10.4

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

* [PATCH 3/5] /usr/sbin/sendmail as a default g:notmuch_rb_sendmail
  2013-01-28 15:52 [PATCH 0/5] Random patches for notmuch-vim-ruby Kirill A. Shutemov
  2013-01-28 15:52 ` [PATCH 1/5] open_reply: fallback to use addr.local if addr.name is nil Kirill A. Shutemov
  2013-01-28 15:52 ` [PATCH 2/5] rename g:notmuch_sendmail -> g:notmuch_rb_sendmail Kirill A. Shutemov
@ 2013-01-28 15:52 ` Kirill A. Shutemov
  2013-04-02 19:33   ` Felipe Contreras
  2013-01-28 15:52 ` [PATCH 4/5] Introduce g:notmuch_rb_folders_count_threads Kirill A. Shutemov
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Kirill A. Shutemov @ 2013-01-28 15:52 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: notmuch

From: "Kirill A. Shutemov" <kirill@shutemov.name>

It's confusing that we don't have a default sendmail program. Let's use
/usr/sbin/sendmail as reasonable default.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
 notmuch-ruby.vim |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/notmuch-ruby.vim b/notmuch-ruby.vim
index 624987e..81da9b3 100644
--- a/notmuch-ruby.vim
+++ b/notmuch-ruby.vim
@@ -52,6 +52,7 @@ let s:notmuch_rb_folders_default = [
 let s:notmuch_rb_date_format_default = '%d.%m.%y'
 let s:notmuch_rb_datetime_format_default = '%d.%m.%y %H:%M:%S'
 let s:notmuch_rb_reader_default = 'terminal -e "mutt -f %s"'
+let s:notmuch_rb_sendmail_default = '/usr/sbin/sendmail'
 
 if !exists('g:notmuch_rb_date_format')
 	let g:notmuch_rb_date_format = s:notmuch_rb_date_format_default
@@ -65,6 +66,10 @@ if !exists('g:notmuch_rb_reader')
 	let g:notmuch_rb_reader = s:notmuch_rb_reader_default
 endif
 
+if !exists('g:notmuch_rb_sendmail')
+	let g:notmuch_rb_sendmail = s:notmuch_rb_sendmail_default
+endif
+
 function! s:new_file_buffer(type, fname)
 	exec printf('edit %s', a:fname)
 	execute printf('set filetype=notmuch-%s', a:type)
-- 
1.7.10.4

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

* [PATCH 4/5] Introduce g:notmuch_rb_folders_count_threads
  2013-01-28 15:52 [PATCH 0/5] Random patches for notmuch-vim-ruby Kirill A. Shutemov
                   ` (2 preceding siblings ...)
  2013-01-28 15:52 ` [PATCH 3/5] /usr/sbin/sendmail as a default g:notmuch_rb_sendmail Kirill A. Shutemov
@ 2013-01-28 15:52 ` Kirill A. Shutemov
  2013-04-02 19:39   ` Felipe Contreras
  2013-01-28 15:52 ` [PATCH 5/5] Drop harmful reply buffer preparation Kirill A. Shutemov
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Kirill A. Shutemov @ 2013-01-28 15:52 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: notmuch

From: "Kirill A. Shutemov" <kirill@shutemov.name>

If the option set, folders list shows count of threads, not messages

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
 notmuch-ruby.vim |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/notmuch-ruby.vim b/notmuch-ruby.vim
index 81da9b3..cda5df4 100644
--- a/notmuch-ruby.vim
+++ b/notmuch-ruby.vim
@@ -53,6 +53,7 @@ let s:notmuch_rb_date_format_default = '%d.%m.%y'
 let s:notmuch_rb_datetime_format_default = '%d.%m.%y %H:%M:%S'
 let s:notmuch_rb_reader_default = 'terminal -e "mutt -f %s"'
 let s:notmuch_rb_sendmail_default = '/usr/sbin/sendmail'
+let s:notmuch_rb_folders_count_threads_default = 0
 
 if !exists('g:notmuch_rb_date_format')
 	let g:notmuch_rb_date_format = s:notmuch_rb_date_format_default
@@ -70,6 +71,10 @@ if !exists('g:notmuch_rb_sendmail')
 	let g:notmuch_rb_sendmail = s:notmuch_rb_sendmail_default
 endif
 
+if !exists('g:notmuch_rb_folders_count_threads')
+	let g:notmuch_rb_folders_count_threads = s:notmuch_rb_folders_count_threads_default
+endif
+
 function! s:new_file_buffer(type, fname)
 	exec printf('edit %s', a:fname)
 	execute printf('set filetype=notmuch-%s', a:type)
@@ -536,12 +541,15 @@ ruby << EOF
 	def folders_render()
 		$curbuf.render do |b|
 			folders = VIM::evaluate('g:notmuch_rb_folders')
+			count_threads = VIM::evaluate('g:notmuch_rb_folders_count_threads')
 			$searches.clear
 			do_read do |db|
 				folders.each do |name, search|
 					q = db.query(search)
 					$searches << search
-					b << "%9d %-20s (%s)" % [q.search_messages.count, name, search]
+					count = count_threads == 0 ?
+						q.search_messages.count : q.search_threads.count
+					b << "%9d %-20s (%s)" % [count, name, search]
 				end
 			end
 		end
-- 
1.7.10.4

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

* [PATCH 5/5] Drop harmful reply buffer preparation
  2013-01-28 15:52 [PATCH 0/5] Random patches for notmuch-vim-ruby Kirill A. Shutemov
                   ` (3 preceding siblings ...)
  2013-01-28 15:52 ` [PATCH 4/5] Introduce g:notmuch_rb_folders_count_threads Kirill A. Shutemov
@ 2013-01-28 15:52 ` Kirill A. Shutemov
  2013-04-02 19:46   ` Felipe Contreras
  2013-01-28 18:09 ` [PATCH 0/5] Random patches for notmuch-vim-ruby David Bremner
  2013-04-02 19:52 ` Felipe Contreras
  6 siblings, 1 reply; 13+ messages in thread
From: Kirill A. Shutemov @ 2013-01-28 15:52 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: notmuch

From: "Kirill A. Shutemov" <kirill@shutemov.name>

Inserting empty lines at the end of reply buffer and switching to insert
mode are not what user want on reply. It's only annoying if you try to
comment on patch.

If a user really wants this kind of preparation it should be implemented
as an user-specific hook.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
 notmuch-ruby.vim |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/notmuch-ruby.vim b/notmuch-ruby.vim
index cda5df4..44d127f 100644
--- a/notmuch-ruby.vim
+++ b/notmuch-ruby.vim
@@ -144,7 +144,6 @@ ruby << EOF
 EOF
 	call s:set_map(g:notmuch_rb_compose_maps)
 	autocmd BufUnload <buffer> call s:compose_unload()
-	startinsert!
 endfunction
 
 function! s:show_info()
@@ -511,9 +510,6 @@ ruby << EOF
 			part.convert.each_line do |l|
 				body_lines << "> %s" % l.chomp
 			end
-			body_lines << ""
-			body_lines << ""
-			body_lines << ""
 
 			reply.body = body_lines.join("\n")
 
-- 
1.7.10.4

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

* Re: [PATCH 0/5] Random patches for notmuch-vim-ruby
  2013-01-28 15:52 [PATCH 0/5] Random patches for notmuch-vim-ruby Kirill A. Shutemov
                   ` (4 preceding siblings ...)
  2013-01-28 15:52 ` [PATCH 5/5] Drop harmful reply buffer preparation Kirill A. Shutemov
@ 2013-01-28 18:09 ` David Bremner
  2013-04-02 19:52 ` Felipe Contreras
  6 siblings, 0 replies; 13+ messages in thread
From: David Bremner @ 2013-01-28 18:09 UTC (permalink / raw)
  To: Kirill A. Shutemov, Felipe Contreras; +Cc: notmuch

"Kirill A. Shutemov" <kirill@shutemov.name> writes:

> From: "Kirill A. Shutemov" <kirill@shutemov.name>
>
> Kirill A. Shutemov (5):
>   open_reply: fallback to use addr.local if addr.name is nil
>   rename g:notmuch_sendmail -> g:notmuch_rb_sendmail
>   /usr/sbin/sendmail as a default g:notmuch_rb_sendmail
>   Introduce g:notmuch_rb_folders_count_threads
>   Drop harmful reply buffer preparation
>
>  notmuch-ruby.vim |   27 ++++++++++++++++++++-------
>  1 file changed, 20 insertions(+), 7 deletions(-)

Hi Kirill, Hi Felipe;

Since the ruby vim client is not currently part of notmuch, I'm
interpreting that series as "of possible interest to people reading the
list" rather than "for possible inclusion upstream". That's perfectly
fine, I just thought I'd comment to save people searching the notmuch
source.

d

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

* Re: [PATCH 2/5] rename g:notmuch_sendmail -> g:notmuch_rb_sendmail
  2013-01-28 15:52 ` [PATCH 2/5] rename g:notmuch_sendmail -> g:notmuch_rb_sendmail Kirill A. Shutemov
@ 2013-04-02 19:21   ` Felipe Contreras
  0 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2013-04-02 19:21 UTC (permalink / raw)
  To: Kirill A. Shutemov; +Cc: notmuch

On Mon, Jan 28, 2013 at 9:52 AM, Kirill A. Shutemov
<kirill@shutemov.name> wrote:
> From: "Kirill A. Shutemov" <kirill@shutemov.name>
>
> All configuration variable use prefix notmuch_rb_ except
> notmuch_sendmail. Let's fix it.

I'm not sure about this one. notmuch-vim is official, what happens if
you have both notmuch-vim and notmuch-vim-ruby? Wouldn't it be nice to
use the same variable for configuration?

-- 
Felipe Contreras

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

* RE: [PATCH 1/5] open_reply: fallback to use addr.local if addr.name is nil
  2013-01-28 15:52 ` [PATCH 1/5] open_reply: fallback to use addr.local if addr.name is nil Kirill A. Shutemov
@ 2013-04-02 19:31   ` Felipe Contreras
  0 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2013-04-02 19:31 UTC (permalink / raw)
  To: Kirill A. Shutemov, Felipe Contreras; +Cc: notmuch

Kirill A. Shutemov wrote:
> From: "Kirill A. Shutemov" <kirill@shutemov.name>
> 
> If address doesn't contain name we end up with " wrote:" as a reply
> header. It doesn't look nice.
> 
> Let's use addr.local + "@" if name is not defined. If addr.local is not
> defined too, let's just use "somebody".

Thanks. Applied.

-- 
Felipe Contreras

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

* RE: [PATCH 3/5] /usr/sbin/sendmail as a default g:notmuch_rb_sendmail
  2013-01-28 15:52 ` [PATCH 3/5] /usr/sbin/sendmail as a default g:notmuch_rb_sendmail Kirill A. Shutemov
@ 2013-04-02 19:33   ` Felipe Contreras
  0 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2013-04-02 19:33 UTC (permalink / raw)
  To: Kirill A. Shutemov, Felipe Contreras; +Cc: notmuch

Kirill A. Shutemov wrote:
> From: "Kirill A. Shutemov" <kirill@shutemov.name>
> 
> It's confusing that we don't have a default sendmail program. Let's use
> /usr/sbin/sendmail as reasonable default.

Applied.

-- 
Felipe Contreras

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

* RE: [PATCH 4/5] Introduce g:notmuch_rb_folders_count_threads
  2013-01-28 15:52 ` [PATCH 4/5] Introduce g:notmuch_rb_folders_count_threads Kirill A. Shutemov
@ 2013-04-02 19:39   ` Felipe Contreras
  0 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2013-04-02 19:39 UTC (permalink / raw)
  To: Kirill A. Shutemov, Felipe Contreras; +Cc: notmuch

Kirill A. Shutemov wrote:
> From: "Kirill A. Shutemov" <kirill@shutemov.name>
> 
> If the option set, folders list shows count of threads, not messages

>  				folders.each do |name, search|
>  					q = db.query(search)
>  					$searches << search
> -					b << "%9d %-20s (%s)" % [q.search_messages.count, name, search]
> +					count = count_threads == 0 ?
> +						q.search_messages.count : q.search_threads.count

I prefer:
count = count_threads ? q.search_threads.count : q.search_messages.count

But other than that looks good to me. Applied.

-- 
Felipe Contreras

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

* RE: [PATCH 5/5] Drop harmful reply buffer preparation
  2013-01-28 15:52 ` [PATCH 5/5] Drop harmful reply buffer preparation Kirill A. Shutemov
@ 2013-04-02 19:46   ` Felipe Contreras
  0 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2013-04-02 19:46 UTC (permalink / raw)
  To: Kirill A. Shutemov, Felipe Contreras; +Cc: notmuch

Kirill A. Shutemov wrote:
> From: "Kirill A. Shutemov" <kirill@shutemov.name>
> 
> Inserting empty lines at the end of reply buffer and switching to insert
> mode are not what user want on reply. It's only annoying if you try to
> comment on patch.
> 
> If a user really wants this kind of preparation it should be implemented
> as an user-specific hook.

Insert mode, maybe, but the empty lines don't hurt. See, with your patch I end up in:

>  			part = orig.find_first_text
>  			part.convert.each_line do |l|
>  				body_lines << "> %s" % l.chomp
> -- 
> 1.7.10.4		<- HERE
> 
> -- 

I cannot type there, and in any case I have to remove those lines, so I end
selecting the text upwards and remove them.

With the current code:

>  			part = orig.find_first_text
>  			part.convert.each_line do |l|
>  				body_lines << "> %s" % l.chomp
> -- 
> 1.7.10.4
> 
> 			<- HERE
> 
> -- 

Not much of a difference, I still have to select the lines upwards and remove them.

That is of course if you reply *inline*. You might want to reply to the whole
thing without modifications, in which case the original behavior is more
useful.

I'm not strongly opposed to this, but I don't see why those extra lines would hurt.

Cheers.

-- 
Felipe Contreras

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

* RE: [PATCH 0/5] Random patches for notmuch-vim-ruby
  2013-01-28 15:52 [PATCH 0/5] Random patches for notmuch-vim-ruby Kirill A. Shutemov
                   ` (5 preceding siblings ...)
  2013-01-28 18:09 ` [PATCH 0/5] Random patches for notmuch-vim-ruby David Bremner
@ 2013-04-02 19:52 ` Felipe Contreras
  6 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2013-04-02 19:52 UTC (permalink / raw)
  To: Kirill A. Shutemov, Felipe Contreras; +Cc: notmuch

Hi,

Sorry for the late reply, I haven't really been following or doing any
development, but I'm back.

Kirill A. Shutemov wrote:
> From: "Kirill A. Shutemov" <kirill@shutemov.name>
> 
> Kirill A. Shutemov (5):
>   open_reply: fallback to use addr.local if addr.name is nil
>   rename g:notmuch_sendmail -> g:notmuch_rb_sendmail
>   /usr/sbin/sendmail as a default g:notmuch_rb_sendmail
>   Introduce g:notmuch_rb_folders_count_threads
>   Drop harmful reply buffer preparation

-- 
Felipe Contreras

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

end of thread, other threads:[~2013-04-02 19:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-28 15:52 [PATCH 0/5] Random patches for notmuch-vim-ruby Kirill A. Shutemov
2013-01-28 15:52 ` [PATCH 1/5] open_reply: fallback to use addr.local if addr.name is nil Kirill A. Shutemov
2013-04-02 19:31   ` Felipe Contreras
2013-01-28 15:52 ` [PATCH 2/5] rename g:notmuch_sendmail -> g:notmuch_rb_sendmail Kirill A. Shutemov
2013-04-02 19:21   ` Felipe Contreras
2013-01-28 15:52 ` [PATCH 3/5] /usr/sbin/sendmail as a default g:notmuch_rb_sendmail Kirill A. Shutemov
2013-04-02 19:33   ` Felipe Contreras
2013-01-28 15:52 ` [PATCH 4/5] Introduce g:notmuch_rb_folders_count_threads Kirill A. Shutemov
2013-04-02 19:39   ` Felipe Contreras
2013-01-28 15:52 ` [PATCH 5/5] Drop harmful reply buffer preparation Kirill A. Shutemov
2013-04-02 19:46   ` Felipe Contreras
2013-01-28 18:09 ` [PATCH 0/5] Random patches for notmuch-vim-ruby David Bremner
2013-04-02 19:52 ` 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).