unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 00/21] vim: general updates
@ 2013-11-02 13:55 Felipe Contreras
  2013-11-02 13:55 ` [PATCH 01/21] vim: run mutt in default term Felipe Contreras
                   ` (21 more replies)
  0 siblings, 22 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Hi,

I've been cooking this in my personal notmuch-vim-ruby repository, and I think
they are ready for notmuch.

A few highlights:

 * There's now support to compose new messages, previously there was only
   support to reply.
 * Database handling has been revamped to get rid of memory leaks
 * A new help file is included
 * Added support to go straight to a search (bypassing the folders view)

Cheers.

Charlie Allom (1):
  vim: run mutt in default term

Felipe Contreras (20):
  vim: don't automatically refresh after tagging
  vim: use notmuch fields
  vim: refactor database handling
  vim: show first message of the thread
  vim: use much clearer sort constant
  vim: add option to save the patches of a patch series
  vim: allow calling with arguments
  vim: split $email_address
  vim: generate custom message-id
  vim: don't execute search if it's cancelled
  vim: trivial cleanup
  vim: refactor open_reply()
  vim: add option to compose new messages
  vim: rename internal notmuch_rb variables
  vim: rename public notmuch_rb variables
  vim: move default sets to set_defaults()
  vim: add wrapper for old variable names
  vim: remove unnecessary buffer queue
  vim: check compose is done on delete
  vim: add help file

 debian/notmuch-vim.dirs    |   1 +
 debian/notmuch-vim.install |   1 +
 vim/Makefile               |   1 +
 vim/notmuch.txt            | 153 ++++++++++++++++
 vim/notmuch.vim            | 434 ++++++++++++++++++++++++++++-----------------
 vim/notmuch.yaml           |   1 +
 6 files changed, 431 insertions(+), 160 deletions(-)
 create mode 100644 vim/notmuch.txt

-- 
1.8.4.2+fc1

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

* [PATCH 01/21] vim: run mutt in default term
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 02/21] vim: don't automatically refresh after tagging Felipe Contreras
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

From: Charlie Allom <charlie@evilforbeginners.com>

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index bdf2720..0ccaaf1 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -52,7 +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 = 'xfce4-terminal -e "mutt -f %s"'
+let s:notmuch_rb_reader_default = 'mutt -f %s'
 let s:notmuch_rb_sendmail_default = 'sendmail'
 let s:notmuch_rb_folders_count_threads_default = 0
 
-- 
1.8.4.2+fc1

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

* [PATCH 02/21] vim: don't automatically refresh after tagging
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
  2013-11-02 13:55 ` [PATCH 01/21] vim: run mutt in default term Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 03/21] vim: use notmuch fields Felipe Contreras
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

This operation might take a while, and even if it only takes fractions
of a second, that's not what the user might want.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 1 -
 1 file changed, 1 deletion(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 0ccaaf1..438fadf 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -218,7 +218,6 @@ function! s:search_tag(intags)
 	endif
 	ruby do_tag(get_thread_id, VIM::evaluate('l:tags'))
 	norm j
-	call s:search_refresh()
 endfunction
 
 function! s:folders_search_prompt()
-- 
1.8.4.2+fc1

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

* [PATCH 03/21] vim: use notmuch fields
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
  2013-11-02 13:55 ` [PATCH 01/21] vim: run mutt in default term Felipe Contreras
  2013-11-02 13:55 ` [PATCH 02/21] vim: don't automatically refresh after tagging Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 04/21] vim: refactor database handling Felipe Contreras
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

They are better encoded than Ruby's Mail.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 438fadf..11a7c26 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -309,9 +309,9 @@ ruby << EOF
 				nm_m.start = b.count
 				b << "%s %s (%s)" % [msg['from'], date, msg.tags]
 				b << "Subject: %s" % [msg['subject']]
-				b << "To: %s" % m['to']
-				b << "Cc: %s" % m['cc']
-				b << "Date: %s" % m['date']
+				b << "To: %s" % msg['to']
+				b << "Cc: %s" % msg['cc']
+				b << "Date: %s" % msg['date']
 				nm_m.body_start = b.count
 				b << "--- %s ---" % part.mime_type
 				part.convert.each_line do |l|
-- 
1.8.4.2+fc1

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

* [PATCH 04/21] vim: refactor database handling
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (2 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 03/21] vim: use notmuch fields Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 05/21] vim: show first message of the thread Felipe Contreras
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

To minimize memory usage we need to destroy the queries and the
databases, so we should keep track of them.

Each buffer gets a database connection that is destroyed when the buffer
is destroyed, and all the queries along with it.

Ideally notmuch should destroy the queries when the database is
destroyed, but it's not doing that at the moment.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 125 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 72 insertions(+), 53 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 11a7c26..72bf73b 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -80,6 +80,7 @@ function! s:new_file_buffer(type, fname)
 	exec printf('edit %s', a:fname)
 	execute printf('set filetype=notmuch-%s', a:type)
 	execute printf('set syntax=notmuch-%s', a:type)
+	ruby $curbuf.init(VIM::evaluate('a:type'))
 	ruby $buf_queue.push($curbuf.number)
 endfunction
 
@@ -195,6 +196,7 @@ function! s:search_search_prompt()
 	setlocal modifiable
 ruby << EOF
 	$cur_search = VIM::evaluate('text')
+	$curbuf.reopen
 	search_render($cur_search)
 EOF
 	setlocal nomodifiable
@@ -206,6 +208,7 @@ endfunction
 
 function! s:search_refresh()
 	setlocal modifiable
+	ruby $curbuf.reopen
 	ruby search_render($cur_search)
 	setlocal nomodifiable
 endfunction
@@ -227,6 +230,7 @@ endfunction
 
 function! s:folders_refresh()
 	setlocal modifiable
+	ruby $curbuf.reopen
 	ruby folders_render()
 	setlocal nomodifiable
 endfunction
@@ -254,6 +258,7 @@ function! s:show_next_thread()
 endfunction
 
 function! s:kill_this_buffer()
+	ruby $curbuf.close
 	bdelete!
 ruby << EOF
 	$buf_queue.pop
@@ -276,6 +281,7 @@ function! s:new_buffer(type)
 	keepjumps 0d
 	execute printf('set filetype=notmuch-%s', a:type)
 	execute printf('set syntax=notmuch-%s', a:type)
+	ruby $curbuf.init(VIM::evaluate('a:type'))
 	ruby $buf_queue.push($curbuf.number)
 endfunction
 
@@ -295,33 +301,31 @@ ruby << EOF
 	$cur_thread = thread_id
 	$messages.clear
 	$curbuf.render do |b|
-		do_read do |db|
-			q = db.query(get_cur_view)
-			q.sort = 0
-			msgs = q.search_messages
-			msgs.each do |msg|
-				m = Mail.read(msg.filename)
-				part = m.find_first_text
-				nm_m = Message.new(msg, m)
-				$messages << nm_m
-				date_fmt = VIM::evaluate('g:notmuch_rb_datetime_format')
-				date = Time.at(msg.date).strftime(date_fmt)
-				nm_m.start = b.count
-				b << "%s %s (%s)" % [msg['from'], date, msg.tags]
-				b << "Subject: %s" % [msg['subject']]
-				b << "To: %s" % msg['to']
-				b << "Cc: %s" % msg['cc']
-				b << "Date: %s" % msg['date']
-				nm_m.body_start = b.count
-				b << "--- %s ---" % part.mime_type
-				part.convert.each_line do |l|
-					b << l.chomp
-				end
-				b << ""
-				nm_m.end = b.count
+		q = $curbuf.query(get_cur_view)
+		q.sort = 0
+		msgs = q.search_messages
+		msgs.each do |msg|
+			m = Mail.read(msg.filename)
+			part = m.find_first_text
+			nm_m = Message.new(msg, m)
+			$messages << nm_m
+			date_fmt = VIM::evaluate('g:notmuch_rb_datetime_format')
+			date = Time.at(msg.date).strftime(date_fmt)
+			nm_m.start = b.count
+			b << "%s %s (%s)" % [msg['from'], date, msg.tags]
+			b << "Subject: %s" % [msg['subject']]
+			b << "To: %s" % msg['to']
+			b << "Cc: %s" % msg['cc']
+			b << "Date: %s" % msg['date']
+			nm_m.body_start = b.count
+			b << "--- %s ---" % part.mime_type
+			part.convert.each_line do |l|
+				b << l.chomp
 			end
-			b.delete(b.count)
+			b << ""
+			nm_m.end = b.count
 		end
+		b.delete(b.count)
 	end
 	$messages.each_with_index do |msg, i|
 		VIM::command("syntax region nmShowMsg#{i}Desc start='\\%%%il' end='\\%%%il' contains=@nmShowMsgDesc" % [msg.start, msg.start + 1])
@@ -469,24 +473,6 @@ ruby << EOF
 		end
 	end
 
-	def do_write
-		db = Notmuch::Database.new($db_name, :mode => Notmuch::MODE_READ_WRITE)
-		begin
-			yield db
-		ensure
-			db.close
-		end
-	end
-
-	def do_read
-		db = Notmuch::Database.new($db_name)
-		begin
-			yield db
-		ensure
-			db.close
-		end
-	end
-
 	def open_reply(orig)
 		help_lines = [
 			'Notmuch-Help: Type in your message here; to help you use these bindings:',
@@ -559,21 +545,18 @@ ruby << EOF
 			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
-					count = count_threads ? q.search_threads.count : q.search_messages.count
-					b << "%9d %-20s (%s)" % [count, name, search]
-				end
+			folders.each do |name, search|
+				q = $curbuf.query(search)
+				$searches << search
+				count = count_threads ? q.search_threads.count : q.search_messages.count
+				b << "%9d %-20s (%s)" % [count, name, search]
 			end
 		end
 	end
 
 	def search_render(search)
 		date_fmt = VIM::evaluate('g:notmuch_rb_date_format')
-		db = Notmuch::Database.new($db_name)
-		q = db.query(search)
+		q = $curbuf.query(search)
 		$threads.clear
 		t = q.search_threads
 
@@ -593,7 +576,7 @@ ruby << EOF
 	end
 
 	def do_tag(filter, tags)
-		do_write do |db|
+		$curbuf.do_write do |db|
 			q = db.query(filter)
 			q.search_messages.each do |e|
 				e.freeze
@@ -610,6 +593,40 @@ ruby << EOF
 				e.thaw
 				e.tags_to_maildir_flags
 			end
+			q.destroy!
+		end
+	end
+
+	module DbHelper
+		def init(name)
+			@name = name
+			@db = Notmuch::Database.new($db_name)
+			@queries = []
+		end
+
+		def query(*args)
+			q = @db.query(*args)
+			@queries << q
+			q
+		end
+
+		def close
+			@queries.delete_if { |q| ! q.destroy! }
+			@db.close
+		end
+
+		def reopen
+			close if @db
+			@db = Notmuch::Database.new($db_name)
+		end
+
+		def do_write
+			db = Notmuch::Database.new($db_name, :mode => Notmuch::MODE_READ_WRITE)
+			begin
+				yield db
+			ensure
+				db.close
+			end
 		end
 	end
 
@@ -658,6 +675,8 @@ ruby << EOF
 	end
 
 	class VIM::Buffer
+		include DbHelper
+
 		def <<(a)
 			append(count(), a)
 		end
-- 
1.8.4.2+fc1

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

* [PATCH 05/21] vim: show first message of the thread
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (3 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 04/21] vim: refactor database handling Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 06/21] vim: use much clearer sort constant Felipe Contreras
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 72bf73b..11ea4fd 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -557,6 +557,7 @@ ruby << EOF
 	def search_render(search)
 		date_fmt = VIM::evaluate('g:notmuch_rb_date_format')
 		q = $curbuf.query(search)
+		q.sort = Notmuch::SORT_NEWEST_FIRST
 		$threads.clear
 		t = q.search_threads
 
@@ -564,10 +565,11 @@ ruby << EOF
 			items.each do |e|
 				authors = e.authors.to_utf8.split(/[,|]/).map { |a| author_filter(a) }.join(",")
 				date = Time.at(e.newest_date).strftime(date_fmt)
+				subject = e.messages.first['subject']
 				if $mail_installed
-					subject = Mail::Field.new("Subject: " + e.subject).to_s
+					subject = Mail::Field.new("Subject: " + subject).to_s
 				else
-					subject = e.subject.force_encoding('utf-8')
+					subject = subject.force_encoding('utf-8')
 				end
 				b << "%-12s %3s %-20.20s | %s (%s)" % [date, e.matched_messages, authors, subject, e.tags]
 				$threads << e.thread_id
-- 
1.8.4.2+fc1

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

* [PATCH 06/21] vim: use much clearer sort constant
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (4 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 05/21] vim: show first message of the thread Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 07/21] vim: add option to save the patches of a patch series Felipe Contreras
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 11ea4fd..a1c5e28 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -302,7 +302,7 @@ ruby << EOF
 	$messages.clear
 	$curbuf.render do |b|
 		q = $curbuf.query(get_cur_view)
-		q.sort = 0
+		q.sort = Notmuch::SORT_OLDEST_FIRST
 		msgs = q.search_messages
 		msgs.each do |msg|
 			m = Mail.read(msg.filename)
-- 
1.8.4.2+fc1

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

* [PATCH 07/21] vim: add option to save the patches of a patch series
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (5 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 06/21] vim: use much clearer sort constant Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 08/21] vim: allow calling with arguments Felipe Contreras
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index a1c5e28..9cfa795 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -34,6 +34,7 @@ let g:notmuch_rb_show_maps = {
 	\ 'o':		'show_open_msg()',
 	\ 'e':		'show_extract_msg()',
 	\ 's':		'show_save_msg()',
+	\ 'p':		'show_save_patches()',
 	\ 'r':		'show_reply()',
 	\ '?':		'show_info()',
 	\ '<Tab>':	'show_next_msg()',
@@ -181,6 +182,20 @@ ruby << EOF
 EOF
 endfunction
 
+function! s:show_save_patches()
+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]
+		system "notmuch show --format=mbox id:#{m.message_id} > #{file}"
+	end
+	vim_puts "Saved #{n} patches"
+EOF
+endfunction
+
 function! s:show_tag(intags)
 	if empty(a:intags)
 		let tags = input('tags: ')
-- 
1.8.4.2+fc1

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

* [PATCH 08/21] vim: allow calling with arguments
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (6 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 07/21] vim: add option to save the patches of a patch series Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 09/21] vim: split $email_address Felipe Contreras
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

For example:

  :NotMuch date:today

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 9cfa795..aa1b7ef 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -273,12 +273,14 @@ function! s:show_next_thread()
 endfunction
 
 function! s:kill_this_buffer()
-	ruby $curbuf.close
-	bdelete!
 ruby << EOF
-	$buf_queue.pop
-	b = $buf_queue.last
-	VIM::command("buffer #{b}") if b
+	if $buf_queue.size > 1
+		$curbuf.close
+		VIM::command("bdelete!")
+		$buf_queue.pop
+		b = $buf_queue.last
+		VIM::command("buffer #{b}") if b
+	end
 EOF
 endfunction
 
@@ -412,7 +414,7 @@ function! s:set_defaults()
 	endif
 endfunction
 
-function! s:NotMuch()
+function! s:NotMuch(...)
 	call s:set_defaults()
 
 ruby << EOF
@@ -863,9 +865,13 @@ ruby << EOF
 
 	get_config
 EOF
-	call s:folders()
+	if a:0
+	  call s:search(join(a:000))
+	else
+	  call s:folders()
+	endif
 endfunction
 
-command NotMuch :call s:NotMuch()
+command -nargs=* NotMuch call s:NotMuch(<f-args>)
 
 " vim: set noexpandtab:
-- 
1.8.4.2+fc1

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

* [PATCH 09/21] vim: split $email_address
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (7 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 08/21] vim: allow calling with arguments Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 10/21] vim: generate custom message-id Felipe Contreras
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index aa1b7ef..4bd5f13 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -427,7 +427,7 @@ ruby << EOF
 	end
 
 	$db_name = nil
-	$email_address = nil
+	$email = $email_name = $email_address = nil
 	$searches = []
 	$buf_queue = []
 	$threads = []
@@ -452,7 +452,9 @@ ruby << EOF
 		end
 
 		$db_name = $config['database.path']
-		$email_address = "%s <%s>" % [$config['user.name'], $config['user.primary_email']]
+		$email_name = $config['user.name']
+		$email_address = $config['user.primary_email']
+		$email = "%s <%s>" % [$email_name, $email_address]
 	end
 
 	def vim_puts(s)
@@ -502,7 +504,7 @@ ruby << EOF
 				m.to = [orig[:from].to_s, orig[:to].to_s]
 			end
 			m.cc = orig[:cc]
-			m.from = $email_address
+			m.from = $email
 			m.charset = 'utf-8'
 			m.content_transfer_encoding = '7bit'
 		end
-- 
1.8.4.2+fc1

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

* [PATCH 10/21] vim: generate custom message-id
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (8 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 09/21] vim: split $email_address Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 11/21] vim: don't execute search if it's cancelled Felipe Contreras
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Using Mail as a reference.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 4bd5f13..64038eb 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -421,6 +421,7 @@ ruby << EOF
 	require 'notmuch'
 	require 'rubygems'
 	require 'tempfile'
+	require 'socket'
 	begin
 		require 'mail'
 	rescue LoadError
@@ -492,6 +493,14 @@ ruby << EOF
 		end
 	end
 
+	def generate_message_id
+		t = Time.now
+		random_tag = sprintf('%x%x_%x%x%x',
+			t.to_i, t.tv_usec,
+			$$, Thread.current.object_id.abs, rand(255))
+		return "<#{random_tag}@#{Socket.gethostname}.notmuch>"
+	end
+
 	def open_reply(orig)
 		help_lines = [
 			'Notmuch-Help: Type in your message here; to help you use these bindings:',
@@ -505,6 +514,7 @@ ruby << EOF
 			end
 			m.cc = orig[:cc]
 			m.from = $email
+			m.message_id = generate_message_id
 			m.charset = 'utf-8'
 			m.content_transfer_encoding = '7bit'
 		end
-- 
1.8.4.2+fc1

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

* [PATCH 11/21] vim: don't execute search if it's cancelled
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (9 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 10/21] vim: generate custom message-id Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 12/21] vim: trivial cleanup Felipe Contreras
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 64038eb..cf829a6 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -208,6 +208,9 @@ endfunction
 
 function! s:search_search_prompt()
 	let text = input('Search: ')
+	if text == ""
+	  return
+	endif
 	setlocal modifiable
 ruby << EOF
 	$cur_search = VIM::evaluate('text')
-- 
1.8.4.2+fc1

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

* [PATCH 12/21] vim: trivial cleanup
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (10 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 11/21] vim: don't execute search if it's cancelled Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 13/21] vim: refactor open_reply() Felipe Contreras
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Using $email_address is more straight forward.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index cf829a6..9a45300 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -566,7 +566,7 @@ ruby << EOF
 
 			f.flush
 
-			VIM::command("let s:reply_from='%s'" % reply.from.first.to_s)
+			VIM::command("let s:reply_from='%s'" % $email_address)
 			VIM::command("call s:new_file_buffer('compose', '#{f.path}')")
 			VIM::command("call cursor(#{old_count}, 0)")
 		end
-- 
1.8.4.2+fc1

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

* [PATCH 13/21] vim: refactor open_reply()
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (11 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 12/21] vim: trivial cleanup Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 14/21] vim: add option to compose new messages Felipe Contreras
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

In preparation for composing new messages.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 92 ++++++++++++++++++++++++++++++---------------------------
 1 file changed, 49 insertions(+), 43 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 9a45300..8383fd6 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -504,12 +504,37 @@ ruby << EOF
 		return "<#{random_tag}@#{Socket.gethostname}.notmuch>"
 	end
 
-	def open_reply(orig)
+	def open_compose_helper(lines, cur)
 		help_lines = [
 			'Notmuch-Help: Type in your message here; to help you use these bindings:',
 			'Notmuch-Help:   ,s    - send the message (Notmuch-Help lines will be removed)',
 			'Notmuch-Help:   ,q    - abort the message',
 			]
+
+		dir = File.expand_path('~/.notmuch/compose')
+		FileUtils.mkdir_p(dir)
+		Tempfile.open(['nm-', '.mail'], dir) do |f|
+			f.puts(help_lines)
+			f.puts
+			f.puts(lines)
+
+			sig_file = File.expand_path('~/.signature')
+			if File.exists?(sig_file)
+				f.puts("-- ")
+				f.write(File.read(sig_file))
+			end
+
+			f.flush
+
+			cur += help_lines.size + 1
+
+			VIM::command("let s:reply_from='%s'" % $email_address)
+			VIM::command("call s:new_file_buffer('compose', '#{f.path}')")
+			VIM::command("call cursor(#{cur}, 0)")
+		end
+	end
+
+	def open_reply(orig)
 		reply = orig.reply do |m|
 			# fix headers
 			if not m[:reply_to]
@@ -522,54 +547,35 @@ ruby << EOF
 			m.content_transfer_encoding = '7bit'
 		end
 
-		dir = File.expand_path('~/.notmuch/compose')
-		FileUtils.mkdir_p(dir)
-		Tempfile.open(['nm-', '.mail'], dir) do |f|
-			lines = []
-
-			lines += help_lines
-			lines << ''
-
-			body_lines = []
-			if $mail_installed
-				addr = Mail::Address.new(orig[:from].value)
-				name = addr.name
-				name = addr.local + "@" if name.nil? && !addr.local.nil?
-			else
-				name = orig[:from]
-			end
-			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
-			end
-			body_lines << ""
-			body_lines << ""
-			body_lines << ""
-
-			reply.body = body_lines.join("\n")
+		lines = []
 
-			lines += reply.to_s.lines.map { |e| e.chomp }
-			lines << ""
+		body_lines = []
+		if $mail_installed
+			addr = Mail::Address.new(orig[:from].value)
+			name = addr.name
+			name = addr.local + "@" if name.nil? && !addr.local.nil?
+		else
+			name = orig[:from]
+		end
+		name = "somebody" if name.nil?
 
-			old_count = lines.count - 1
+		body_lines << "%s wrote:" % name
+		part = orig.find_first_text
+		part.convert.each_line do |l|
+			body_lines << "> %s" % l.chomp
+		end
+		body_lines << ""
+		body_lines << ""
+		body_lines << ""
 
-			f.puts(lines)
+		reply.body = body_lines.join("\n")
 
-			sig_file = File.expand_path('~/.signature')
-			if File.exists?(sig_file)
-				f.puts("-- ")
-				f.write(File.read(sig_file))
-			end
+		lines += reply.to_s.lines.map { |e| e.chomp }
+		lines << ""
 
-			f.flush
+		cur = lines.count - 1
 
-			VIM::command("let s:reply_from='%s'" % $email_address)
-			VIM::command("call s:new_file_buffer('compose', '#{f.path}')")
-			VIM::command("call cursor(#{old_count}, 0)")
-		end
+		open_compose_helper(lines, cur)
 	end
 
 	def folders_render()
-- 
1.8.4.2+fc1

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

* [PATCH 14/21] vim: add option to compose new messages
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (12 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 13/21] vim: refactor open_reply() Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 15/21] vim: rename internal notmuch_rb variables Felipe Contreras
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 8383fd6..42c5f18 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -12,6 +12,7 @@ let g:notmuch_rb_folders_maps = {
 	\ '<Enter>':	'folders_show_search()',
 	\ 's':		'folders_search_prompt()',
 	\ '=':		'folders_refresh()',
+	\ 'c':		'compose()',
 	\ }
 
 let g:notmuch_rb_search_maps = {
@@ -24,6 +25,7 @@ let g:notmuch_rb_search_maps = {
 	\ 's':		'search_search_prompt()',
 	\ '=':		'search_refresh()',
 	\ '?':		'search_info()',
+	\ 'c':		'compose()',
 	\ }
 
 let g:notmuch_rb_show_maps = {
@@ -38,6 +40,7 @@ let g:notmuch_rb_show_maps = {
 	\ 'r':		'show_reply()',
 	\ '?':		'show_info()',
 	\ '<Tab>':	'show_next_msg()',
+	\ 'c':		'compose()',
 	\ }
 
 let g:notmuch_rb_compose_maps = {
@@ -148,6 +151,14 @@ function! s:show_reply()
 	startinsert!
 endfunction
 
+function! s:compose()
+	ruby open_compose
+	let b:compose_done = 0
+	call s:set_map(g:notmuch_rb_compose_maps)
+	autocmd BufUnload <buffer> call s:compose_unload()
+	startinsert!
+endfunction
+
 function! s:show_info()
 	ruby vim_puts get_message.inspect
 endfunction
@@ -578,6 +589,28 @@ ruby << EOF
 		open_compose_helper(lines, cur)
 	end
 
+	def open_compose()
+		lines = []
+
+		lines << "Date: #{Time.now().strftime('%a, %-d %b %Y %T %z')}"
+		lines << "From: #{$email}"
+		lines << "To: "
+		cur = lines.count
+
+		lines << "Cc: "
+		lines << "Bcc: "
+		lines << "Message-Id: #{generate_message_id}"
+		lines << "Subject: "
+		lines << "Mime-Version: 1.0"
+		lines << "Content-Type: text/plain; charset=utf-8"
+		lines << "Content-Transfer-Encoding: 7bit"
+		lines << ""
+		lines << ""
+		lines << ""
+
+		open_compose_helper(lines, cur)
+	end
+
 	def folders_render()
 		$curbuf.render do |b|
 			folders = VIM::evaluate('g:notmuch_rb_folders')
-- 
1.8.4.2+fc1

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

* [PATCH 15/21] vim: rename internal notmuch_rb variables
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (13 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 14/21] vim: add option to compose new messages Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 16/21] vim: rename public " Felipe Contreras
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Now we are the official one.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 59 ++++++++++++++++++++++++++-------------------------------
 1 file changed, 27 insertions(+), 32 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 42c5f18..4e4dfb0 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -1,4 +1,4 @@
-if exists("g:loaded_notmuch_rb")
+if exists("g:loaded_notmuch")
 	finish
 endif
 
@@ -6,16 +6,16 @@ if !has("ruby") || version < 700
 	finish
 endif
 
-let g:loaded_notmuch_rb = "yep"
+let g:loaded_notmuch = "yep"
 
-let g:notmuch_rb_folders_maps = {
+let g:notmuch_folders_maps = {
 	\ '<Enter>':	'folders_show_search()',
 	\ 's':		'folders_search_prompt()',
 	\ '=':		'folders_refresh()',
 	\ 'c':		'compose()',
 	\ }
 
-let g:notmuch_rb_search_maps = {
+let g:notmuch_search_maps = {
 	\ 'q':		'kill_this_buffer()',
 	\ '<Enter>':	'search_show_thread(1)',
 	\ '<Space>':	'search_show_thread(2)',
@@ -28,7 +28,7 @@ let g:notmuch_rb_search_maps = {
 	\ 'c':		'compose()',
 	\ }
 
-let g:notmuch_rb_show_maps = {
+let g:notmuch_show_maps = {
 	\ 'q':		'kill_this_buffer()',
 	\ 'A':		'show_tag("-inbox -unread")',
 	\ 'I':		'show_tag("-unread")',
@@ -43,41 +43,41 @@ let g:notmuch_rb_show_maps = {
 	\ 'c':		'compose()',
 	\ }
 
-let g:notmuch_rb_compose_maps = {
+let g:notmuch_compose_maps = {
 	\ ',s':		'compose_send()',
 	\ ',q':		'compose_quit()',
 	\ }
 
-let s:notmuch_rb_folders_default = [
+let s:notmuch_folders_default = [
 	\ [ 'new', 'tag:inbox and tag:unread' ],
 	\ [ 'inbox', 'tag:inbox' ],
 	\ [ 'unread', 'tag:unread' ],
 	\ ]
 
-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 = 'mutt -f %s'
-let s:notmuch_rb_sendmail_default = 'sendmail'
-let s:notmuch_rb_folders_count_threads_default = 0
+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_folders_count_threads_default = 0
 
 if !exists('g:notmuch_rb_date_format')
-	let g:notmuch_rb_date_format = s:notmuch_rb_date_format_default
+	let g:notmuch_rb_date_format = s:notmuch_date_format_default
 endif
 
 if !exists('g:notmuch_rb_datetime_format')
-	let g:notmuch_rb_datetime_format = s:notmuch_rb_datetime_format_default
+	let g:notmuch_rb_datetime_format = s:notmuch_datetime_format_default
 endif
 
 if !exists('g:notmuch_rb_reader')
-	let g:notmuch_rb_reader = s:notmuch_rb_reader_default
+	let g:notmuch_rb_reader = s:notmuch_reader_default
 endif
 
 if !exists('g:notmuch_rb_sendmail')
-	let g:notmuch_rb_sendmail = s:notmuch_rb_sendmail_default
+	let g:notmuch_rb_sendmail = s:notmuch_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
+	let g:notmuch_rb_folders_count_threads = s:notmuch_folders_count_threads_default
 endif
 
 function! s:new_file_buffer(type, fname)
@@ -146,7 +146,7 @@ endfunction
 function! s:show_reply()
 	ruby open_reply get_message.mail
 	let b:compose_done = 0
-	call s:set_map(g:notmuch_rb_compose_maps)
+	call s:set_map(g:notmuch_compose_maps)
 	autocmd BufUnload <buffer> call s:compose_unload()
 	startinsert!
 endfunction
@@ -154,7 +154,7 @@ endfunction
 function! s:compose()
 	ruby open_compose
 	let b:compose_done = 0
-	call s:set_map(g:notmuch_rb_compose_maps)
+	call s:set_map(g:notmuch_compose_maps)
 	autocmd BufUnload <buffer> call s:compose_unload()
 	startinsert!
 endfunction
@@ -365,7 +365,7 @@ ruby << EOF
 	end
 EOF
 	setlocal nomodifiable
-	call s:set_map(g:notmuch_rb_show_maps)
+	call s:set_map(g:notmuch_show_maps)
 endfunction
 
 function! s:search_show_thread(mode)
@@ -388,7 +388,7 @@ ruby << EOF
 	search_render($cur_search)
 EOF
 	call s:set_menu_buffer()
-	call s:set_map(g:notmuch_rb_search_maps)
+	call s:set_map(g:notmuch_search_maps)
 	autocmd CursorMoved <buffer> call s:show_cursor_moved()
 endfunction
 
@@ -404,27 +404,22 @@ function! s:folders()
 	call s:new_buffer('folders')
 	ruby folders_render()
 	call s:set_menu_buffer()
-	call s:set_map(g:notmuch_rb_folders_maps)
+	call s:set_map(g:notmuch_folders_maps)
 endfunction
 
 "" root
 
 function! s:set_defaults()
 	if exists('g:notmuch_rb_custom_search_maps')
-		call extend(g:notmuch_rb_search_maps, g:notmuch_rb_custom_search_maps)
+		call extend(g:notmuch_search_maps, g:notmuch_rb_custom_search_maps)
 	endif
 
 	if exists('g:notmuch_rb_custom_show_maps')
-		call extend(g:notmuch_rb_show_maps, g:notmuch_rb_custom_show_maps)
+		call extend(g:notmuch_show_maps, g:notmuch_rb_custom_show_maps)
 	endif
 
-	" TODO for now lets check the old folders too
-	if !exists('g:notmuch_rb_folders')
-		if exists('g:notmuch_folders')
-			let g:notmuch_rb_folders = g:notmuch_folders
-		else
-			let g:notmuch_rb_folders = s:notmuch_rb_folders_default
-		endif
+	if !exists('g:notmuch_folders')
+		let g:notmuch_folders = s:notmuch_folders_default
 	endif
 endfunction
 
@@ -613,7 +608,7 @@ ruby << EOF
 
 	def folders_render()
 		$curbuf.render do |b|
-			folders = VIM::evaluate('g:notmuch_rb_folders')
+			folders = VIM::evaluate('g:notmuch_folders')
 			count_threads = VIM::evaluate('g:notmuch_rb_folders_count_threads')
 			$searches.clear
 			folders.each do |name, search|
-- 
1.8.4.2+fc1

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

* [PATCH 16/21] vim: rename public notmuch_rb variables
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (14 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 15/21] vim: rename internal notmuch_rb variables Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 17/21] vim: move default sets to set_defaults() Felipe Contreras
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 4e4dfb0..2fe9346 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -60,24 +60,24 @@ let s:notmuch_reader_default = 'mutt -f %s'
 let s:notmuch_sendmail_default = 'sendmail'
 let s:notmuch_folders_count_threads_default = 0
 
-if !exists('g:notmuch_rb_date_format')
-	let g:notmuch_rb_date_format = s:notmuch_date_format_default
+if !exists('g:notmuch_date_format')
+	let g:notmuch_date_format = s:notmuch_date_format_default
 endif
 
-if !exists('g:notmuch_rb_datetime_format')
-	let g:notmuch_rb_datetime_format = s:notmuch_datetime_format_default
+if !exists('g:notmuch_datetime_format')
+	let g:notmuch_datetime_format = s:notmuch_datetime_format_default
 endif
 
-if !exists('g:notmuch_rb_reader')
-	let g:notmuch_rb_reader = s:notmuch_reader_default
+if !exists('g:notmuch_reader')
+	let g:notmuch_reader = s:notmuch_reader_default
 endif
 
-if !exists('g:notmuch_rb_sendmail')
-	let g:notmuch_rb_sendmail = s:notmuch_sendmail_default
+if !exists('g:notmuch_sendmail')
+	let g:notmuch_sendmail = s:notmuch_sendmail_default
 endif
 
-if !exists('g:notmuch_rb_folders_count_threads')
-	let g:notmuch_rb_folders_count_threads = s:notmuch_folders_count_threads_default
+if !exists('g:notmuch_folders_count_threads')
+	let g:notmuch_folders_count_threads = s:notmuch_folders_count_threads_default
 endif
 
 function! s:new_file_buffer(type, fname)
@@ -179,7 +179,7 @@ function! s:show_open_msg()
 ruby << EOF
 	m = get_message
 	mbox = File.expand_path('~/.notmuch/vim_mbox')
-	cmd = VIM::evaluate('g:notmuch_rb_reader') % mbox
+	cmd = VIM::evaluate('g:notmuch_reader') % mbox
 	system "notmuch show --format=mbox id:#{m.message_id} > #{mbox} && #{cmd}"
 EOF
 endfunction
@@ -340,7 +340,7 @@ ruby << EOF
 			part = m.find_first_text
 			nm_m = Message.new(msg, m)
 			$messages << nm_m
-			date_fmt = VIM::evaluate('g:notmuch_rb_datetime_format')
+			date_fmt = VIM::evaluate('g:notmuch_datetime_format')
 			date = Time.at(msg.date).strftime(date_fmt)
 			nm_m.start = b.count
 			b << "%s %s (%s)" % [msg['from'], date, msg.tags]
@@ -410,12 +410,12 @@ endfunction
 "" root
 
 function! s:set_defaults()
-	if exists('g:notmuch_rb_custom_search_maps')
-		call extend(g:notmuch_search_maps, g:notmuch_rb_custom_search_maps)
+	if exists('g:notmuch_custom_search_maps')
+		call extend(g:notmuch_search_maps, g:notmuch_custom_search_maps)
 	endif
 
-	if exists('g:notmuch_rb_custom_show_maps')
-		call extend(g:notmuch_show_maps, g:notmuch_rb_custom_show_maps)
+	if exists('g:notmuch_custom_show_maps')
+		call extend(g:notmuch_show_maps, g:notmuch_custom_show_maps)
 	endif
 
 	if !exists('g:notmuch_folders')
@@ -609,7 +609,7 @@ ruby << EOF
 	def folders_render()
 		$curbuf.render do |b|
 			folders = VIM::evaluate('g:notmuch_folders')
-			count_threads = VIM::evaluate('g:notmuch_rb_folders_count_threads')
+			count_threads = VIM::evaluate('g:notmuch_folders_count_threads')
 			$searches.clear
 			folders.each do |name, search|
 				q = $curbuf.query(search)
@@ -621,7 +621,7 @@ ruby << EOF
 	end
 
 	def search_render(search)
-		date_fmt = VIM::evaluate('g:notmuch_rb_date_format')
+		date_fmt = VIM::evaluate('g:notmuch_date_format')
 		q = $curbuf.query(search)
 		q.sort = Notmuch::SORT_NEWEST_FIRST
 		$threads.clear
-- 
1.8.4.2+fc1

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

* [PATCH 17/21] vim: move default sets to set_defaults()
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (15 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 16/21] vim: rename public " Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 18/21] vim: add wrapper for old variable names Felipe Contreras
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 2fe9346..71d4b32 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -60,26 +60,6 @@ let s:notmuch_reader_default = 'mutt -f %s'
 let s:notmuch_sendmail_default = 'sendmail'
 let s:notmuch_folders_count_threads_default = 0
 
-if !exists('g:notmuch_date_format')
-	let g:notmuch_date_format = s:notmuch_date_format_default
-endif
-
-if !exists('g:notmuch_datetime_format')
-	let g:notmuch_datetime_format = s:notmuch_datetime_format_default
-endif
-
-if !exists('g:notmuch_reader')
-	let g:notmuch_reader = s:notmuch_reader_default
-endif
-
-if !exists('g:notmuch_sendmail')
-	let g:notmuch_sendmail = s:notmuch_sendmail_default
-endif
-
-if !exists('g:notmuch_folders_count_threads')
-	let g:notmuch_folders_count_threads = s:notmuch_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)
@@ -410,6 +390,26 @@ endfunction
 "" root
 
 function! s:set_defaults()
+	if !exists('g:notmuch_date_format')
+		let g:notmuch_date_format = s:notmuch_date_format_default
+	endif
+
+	if !exists('g:notmuch_datetime_format')
+		let g:notmuch_datetime_format = s:notmuch_datetime_format_default
+	endif
+
+	if !exists('g:notmuch_reader')
+		let g:notmuch_reader = s:notmuch_reader_default
+	endif
+
+	if !exists('g:notmuch_sendmail')
+		let g:notmuch_sendmail = s:notmuch_sendmail_default
+	endif
+
+	if !exists('g:notmuch_folders_count_threads')
+		let g:notmuch_folders_count_threads = s:notmuch_folders_count_threads_default
+	endif
+
 	if exists('g:notmuch_custom_search_maps')
 		call extend(g:notmuch_search_maps, g:notmuch_custom_search_maps)
 	endif
-- 
1.8.4.2+fc1

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

* [PATCH 18/21] vim: add wrapper for old variable names
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (16 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 17/21] vim: move default sets to set_defaults() Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 19/21] vim: remove unnecessary buffer queue Felipe Contreras
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 44 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 38 insertions(+), 6 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 71d4b32..fc9eaa2 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -391,23 +391,51 @@ endfunction
 
 function! s:set_defaults()
 	if !exists('g:notmuch_date_format')
-		let g:notmuch_date_format = s:notmuch_date_format_default
+		if exists('g:notmuch_rb_date_format')
+			let g:notmuch_date_format = g:notmuch_rb_date_format
+		else
+			let g:notmuch_date_format = s:notmuch_date_format_default
+		endif
 	endif
 
 	if !exists('g:notmuch_datetime_format')
-		let g:notmuch_datetime_format = s:notmuch_datetime_format_default
+		if exists('g:notmuch_rb_datetime_format')
+			let g:notmuch_datetime_format = g:notmuch_rb_datetime_format
+		else
+			let g:notmuch_datetime_format = s:notmuch_datetime_format_default
+		endif
 	endif
 
 	if !exists('g:notmuch_reader')
-		let g:notmuch_reader = s:notmuch_reader_default
+		if exists('g:notmuch_rb_reader')
+			let g:notmuch_reader = g:notmuch_rb_reader
+		else
+			let g:notmuch_reader = s:notmuch_reader_default
+		endif
 	endif
 
 	if !exists('g:notmuch_sendmail')
-		let g:notmuch_sendmail = s:notmuch_sendmail_default
+		if exists('g:notmuch_rb_sendmail')
+			let g:notmuch_sendmail = g:notmuch_rb_sendmail
+		else
+			let g:notmuch_sendmail = s:notmuch_sendmail_default
+		endif
 	endif
 
 	if !exists('g:notmuch_folders_count_threads')
-		let g:notmuch_folders_count_threads = s:notmuch_folders_count_threads_default
+		if exists('g:notmuch_rb_count_threads')
+			let g:notmuch_count_threads = g:notmuch_rb_count_threads
+		else
+			let g:notmuch_folders_count_threads = s:notmuch_folders_count_threads_default
+		endif
+	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
+
+	if !exists('g:notmuch_custom_show_maps') && exists('g:notmuch_rb_custom_show_maps')
+		let g:notmuch_custom_show_maps = g:notmuch_rb_custom_show_maps
 	endif
 
 	if exists('g:notmuch_custom_search_maps')
@@ -419,7 +447,11 @@ function! s:set_defaults()
 	endif
 
 	if !exists('g:notmuch_folders')
-		let g:notmuch_folders = s:notmuch_folders_default
+		if exists('g:notmuch_rb_folders')
+			let g:notmuch_folders = g:notmuch_rb_folders
+		else
+			let g:notmuch_folders = s:notmuch_folders_default
+		endif
 	endif
 endfunction
 
-- 
1.8.4.2+fc1

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

* [PATCH 19/21] vim: remove unnecessary buffer queue
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (17 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 18/21] vim: add wrapper for old variable names Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 20/21] vim: check compose is done on delete Felipe Contreras
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Vim handles the buffers just fine: when one is deleted, we go to the
previous one.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index fc9eaa2..9109470 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -65,7 +65,6 @@ function! s:new_file_buffer(type, fname)
 	execute printf('set filetype=notmuch-%s', a:type)
 	execute printf('set syntax=notmuch-%s', a:type)
 	ruby $curbuf.init(VIM::evaluate('a:type'))
-	ruby $buf_queue.push($curbuf.number)
 endfunction
 
 function! s:compose_unload()
@@ -268,13 +267,8 @@ endfunction
 
 function! s:kill_this_buffer()
 ruby << EOF
-	if $buf_queue.size > 1
-		$curbuf.close
-		VIM::command("bdelete!")
-		$buf_queue.pop
-		b = $buf_queue.last
-		VIM::command("buffer #{b}") if b
-	end
+	$curbuf.close
+	VIM::command("bdelete!")
 EOF
 endfunction
 
@@ -293,7 +287,6 @@ function! s:new_buffer(type)
 	execute printf('set filetype=notmuch-%s', a:type)
 	execute printf('set syntax=notmuch-%s', a:type)
 	ruby $curbuf.init(VIM::evaluate('a:type'))
-	ruby $buf_queue.push($curbuf.number)
 endfunction
 
 function! s:set_menu_buffer()
@@ -471,7 +464,6 @@ ruby << EOF
 	$db_name = nil
 	$email = $email_name = $email_address = nil
 	$searches = []
-	$buf_queue = []
 	$threads = []
 	$messages = []
 	$config = {}
-- 
1.8.4.2+fc1

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

* [PATCH 20/21] vim: check compose is done on delete
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (18 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 19/21] vim: remove unnecessary buffer queue Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-02 13:55 ` [PATCH 21/21] vim: add help file Felipe Contreras
  2013-11-11 18:11 ` [PATCH 00/21] vim: general updates Felipe Contreras
  21 siblings, 0 replies; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Not on unload, which happens when we switch buffers.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 9109470..d7b310c 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -67,7 +67,7 @@ function! s:new_file_buffer(type, fname)
 	ruby $curbuf.init(VIM::evaluate('a:type'))
 endfunction
 
-function! s:compose_unload()
+function! s:on_compose_delete()
 	if b:compose_done
 		return
 	endif
@@ -126,7 +126,7 @@ function! s:show_reply()
 	ruby open_reply get_message.mail
 	let b:compose_done = 0
 	call s:set_map(g:notmuch_compose_maps)
-	autocmd BufUnload <buffer> call s:compose_unload()
+	autocmd BufDelete <buffer> call s:on_compose_delete()
 	startinsert!
 endfunction
 
@@ -134,7 +134,7 @@ function! s:compose()
 	ruby open_compose
 	let b:compose_done = 0
 	call s:set_map(g:notmuch_compose_maps)
-	autocmd BufUnload <buffer> call s:compose_unload()
+	autocmd BufDelete <buffer> call s:on_compose_delete()
 	startinsert!
 endfunction
 
-- 
1.8.4.2+fc1

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

* [PATCH 21/21] vim: add help file
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (19 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 20/21] vim: check compose is done on delete Felipe Contreras
@ 2013-11-02 13:55 ` Felipe Contreras
  2013-11-08 12:43   ` David Bremner
  2013-11-11 18:11 ` [PATCH 00/21] vim: general updates Felipe Contreras
  21 siblings, 1 reply; 35+ messages in thread
From: Felipe Contreras @ 2013-11-02 13:55 UTC (permalink / raw)
  To: notmuch

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 debian/notmuch-vim.dirs    |   1 +
 debian/notmuch-vim.install |   1 +
 vim/Makefile               |   1 +
 vim/notmuch.txt            | 153 +++++++++++++++++++++++++++++++++++++++++++++
 vim/notmuch.yaml           |   1 +
 5 files changed, 157 insertions(+)
 create mode 100644 vim/notmuch.txt

diff --git a/debian/notmuch-vim.dirs b/debian/notmuch-vim.dirs
index c978ac1..c6373e4 100644
--- a/debian/notmuch-vim.dirs
+++ b/debian/notmuch-vim.dirs
@@ -1,3 +1,4 @@
 usr/share/vim/registry
 usr/share/vim/addons/plugin
+usr/share/vim/addons/doc
 usr/share/vim/addons/syntax
diff --git a/debian/notmuch-vim.install b/debian/notmuch-vim.install
index d444fef..a1af708 100644
--- a/debian/notmuch-vim.install
+++ b/debian/notmuch-vim.install
@@ -1,3 +1,4 @@
 vim/notmuch.vim usr/share/vim/addons/plugin
+vim/notmuch.txt usr/share/vim/addons/doc
 vim/syntax/notmuch-*.vim usr/share/vim/addons/syntax
 vim/notmuch.yaml usr/share/vim/registry
diff --git a/vim/Makefile b/vim/Makefile
index bb3ec60..b6f9db7 100644
--- a/vim/Makefile
+++ b/vim/Makefile
@@ -8,6 +8,7 @@ all:
 
 install:
 	$(INSTALL) $(CURDIR)/notmuch.vim $(D)$(prefix)/plugin/notmuch.vim
+	$(INSTALL) $(CURDIR)/notmuch.txt $(D)$(prefix)/doc/notmuch.txt
 	@$(foreach file,$(wildcard syntax/*), \
 		$(INSTALL) $(CURDIR)/$(file) $(D)$(prefix)/$(file);)
 
diff --git a/vim/notmuch.txt b/vim/notmuch.txt
new file mode 100644
index 0000000..4374102
--- /dev/null
+++ b/vim/notmuch.txt
@@ -0,0 +1,153 @@
+*notmuch.txt*	Plug-in to make vim a nice email client using notmuch
+
+Author: Felipe Contreras <felipe.contreras@gmail.com>
+
+Overview 					|notmuch-intro|
+Usage						|notmuch-usage|
+Mappings					|notmuch-mappings|
+Configuration					|notmuch-config|
+
+==============================================================================
+OVERVIEW					*notmuch-intro*
+
+This is a vim plug-in that provides a fully usable mail client interface,
+utilizing the notmuch framework.
+
+It has three main views: folders, search, and thread. In the folder view you
+can find a summary of saved searches, In the search view you can see all the
+threads that comprise the selected search, and in the thread view you can read
+every mail in the thread.
+
+==============================================================================
+USAGE						*notmuch-usage*
+
+To use it, simply run the `:NotMuch` command.
+
+By default you start in the folder view which shows you default searches and
+the number of threads that match those:
+>
+	10 new                  (tag:inbox and tag:unread)
+	20 inbox                (tag:inbox)
+	30 unread               (tag:unread)
+<
+You can see the threads of each by clicking `enter`, which sends you to the
+search view. In both the search and folder views you can type `s` to type a
+new search, or `=` to refresh. To see a thread, type `enter` again.
+
+To exit a view, click `q`.
+
+Also, you can specify a search directly:
+>
+	:NotMuch is:inbox and date:yesterday..
+<
+==============================================================================
+MAPPINGS					*notmuch-mappings*
+
+------------------------------------------------------------------------------
+Folder view~
+
+<enter>	Show selected search
+s	Enter a new search
+=	Refresh
+c	Compose a new mail
+
+------------------------------------------------------------------------------
+Search view~
+
+q	Quit view
+<enter>	Show selected search
+<space>	Show selected search with filter
+A	Archive (-inbox -unread)
+I	Mark as read (-unread)
+t	Tag (prompted)
+s	Search
+=	Refresh
+?	Show search information
+c	Compose a new mail
+>
+------------------------------------------------------------------------------
+Thread view~
+
+q	Quit view
+A	Archive (-inbox -unread)
+I	Mark as read (-unread)
+t	Tag (prompted)
+s	Search
+p	Save patches
+r	Reply
+?	Show thread information
+<tab>	Show next message
+c	Compose a new mail
+
+------------------------------------------------------------------------------
+Compose view~
+
+q	Quit view
+s	Send
+
+==============================================================================
+CONFIGURATION					*notmuch-config*
+
+You can add the following configurations to your `.vimrc`, or
+`~/.vim/plugin/notmuch.vim`.
+
+						*g:notmuch_folders*
+
+The first thing you might want to do is set your custom searches.
+>
+	let g:notmuch_folders = [
+		\ [ 'new', 'tag:inbox and tag:unread' ],
+		\ [ 'inbox', 'tag:inbox' ],
+		\ [ 'unread', 'tag:unread' ],
+		\ [ 'to-do', 'tag:to-do' ],
+		\ [ 'to-me', 'to:john.doe and tag:new' ],
+		\ ]
+<
+
+						*g:notmuch_custom_search_maps*
+						*g:notmuch_custom_show_maps*
+
+You can also configure the keyboard mappings for the different views:
+>
+	let g:notmuch_custom_search_maps = {
+		\ 't':		'search_tag("+to-do -inbox")',
+		\ 'd':		'search_tag("+deleted -inbox -unread")',
+		\ }
+
+	let g:notmuch_custom_show_maps = {
+		\ 't':		'show_tag("+to-do -inbox")',
+		\ 'd':		'show_tag("+deleted -inbox -unread")',
+		\ }
+<
+
+						*g:notmuch_date_format*
+
+To configure the date format you want in the search view:
+>
+	let g:notmuch_date_format = '%d.%m.%y'
+<
+
+						*g:notmuch_datetime_format*
+
+You can do the same for the thread view:
+>
+	let g:notmuch_datetime_format = '%d.%m.%y %H:%M:%S'
+<
+
+						*g:notmuch_folders_count_threads*
+
+If you want to count the threads instead of the messages in the folder view:
+>
+	let g:notmuch_folders_count_threads = 0
+<
+
+						*g:notmuch_reader*
+						*g:notmuch_sendmail*
+
+You can also configure your externail mail reader and sendemail program:
+>
+	let g:notmuch_reader = 'mutt -f %s'
+	let g:notmuch_sendmail = 'sendmail'
+<
+
+vim:tw=78:ts=8:noet:ft=help:
diff --git a/vim/notmuch.yaml b/vim/notmuch.yaml
index 6d36810..6f3b705 100644
--- a/vim/notmuch.yaml
+++ b/vim/notmuch.yaml
@@ -2,6 +2,7 @@ addon: notmuch
 description: "notmuch mail user interface"
 files:
   - plugin/notmuch.vim
+  - doc/notmuch.txt
   - syntax/notmuch-compose.vim
   - syntax/notmuch-folders.vim
   - syntax/notmuch-git-diff.vim
-- 
1.8.4.2+fc1

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

* Re: [PATCH 21/21] vim: add help file
  2013-11-02 13:55 ` [PATCH 21/21] vim: add help file Felipe Contreras
@ 2013-11-08 12:43   ` David Bremner
  2013-11-08 13:10     ` Felipe Contreras
  0 siblings, 1 reply; 35+ messages in thread
From: David Bremner @ 2013-11-08 12:43 UTC (permalink / raw)
  To: Felipe Contreras, notmuch

Felipe Contreras <felipe.contreras@gmail.com> writes:

> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  debian/notmuch-vim.dirs    |   1 +
>  debian/notmuch-vim.install |   1 +
>  vim/Makefile               |   1 +
>  vim/notmuch.txt            | 153 +++++++++++++++++++++++++++++++++++++++++++++
>  vim/notmuch.yaml           |   1 +

I verified that these changes don't break the debian build.  FWIW, I
didn't manage to invoke the notmuch help within vim, but that's probably
just invimcompetence on my part.  Let me know if there is something
you'd like me to verify on the debian packages.

d

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

* Re: [PATCH 21/21] vim: add help file
  2013-11-08 12:43   ` David Bremner
@ 2013-11-08 13:10     ` Felipe Contreras
  2013-11-08 18:03       ` David Bremner
  0 siblings, 1 reply; 35+ messages in thread
From: Felipe Contreras @ 2013-11-08 13:10 UTC (permalink / raw)
  To: David Bremner; +Cc: notmuch@notmuchmail.org

On Fri, Nov 8, 2013 at 6:43 AM, David Bremner <david@tethera.net> wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
>> ---
>>  debian/notmuch-vim.dirs    |   1 +
>>  debian/notmuch-vim.install |   1 +
>>  vim/Makefile               |   1 +
>>  vim/notmuch.txt            | 153 +++++++++++++++++++++++++++++++++++++++++++++
>>  vim/notmuch.yaml           |   1 +
>
> I verified that these changes don't break the debian build.  FWIW, I
> didn't manage to invoke the notmuch help within vim, but that's probably
> just invimcompetence on my part.  Let me know if there is something
> you'd like me to verify on the debian packages.

You can probably check that it's working with this:
% vim -c ":h notmuch"

If that doesn't work, you might need to do this first:
% vim -c ':helptags /usr/share/vim/addons/doc' -c q

-- 
Felipe Contreras

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

* Re: [PATCH 21/21] vim: add help file
  2013-11-08 13:10     ` Felipe Contreras
@ 2013-11-08 18:03       ` David Bremner
  2013-11-08 18:05         ` Felipe Contreras
  0 siblings, 1 reply; 35+ messages in thread
From: David Bremner @ 2013-11-08 18:03 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: notmuch@notmuchmail.org

Felipe Contreras <felipe.contreras@gmail.com> writes:
>
> You can probably check that it's working with this:
> % vim -c ":h notmuch"

It turns I needed to re-run 

   "vim-addon-manager install notmuch"

This might be a bit debian specific, but it's already documented as
needed for the initial install. It would probably be worth updating
debian/notmuch-vim.README.Debian to suggest running this on upgrade as
well.

Otherwise running :helptags wants write into /usr/share/vim/addons/doc,
which is naturally a bit tricky for a non-root user.

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

* Re: [PATCH 21/21] vim: add help file
  2013-11-08 18:03       ` David Bremner
@ 2013-11-08 18:05         ` Felipe Contreras
  2013-11-09  0:08           ` David Bremner
  0 siblings, 1 reply; 35+ messages in thread
From: Felipe Contreras @ 2013-11-08 18:05 UTC (permalink / raw)
  To: David Bremner; +Cc: notmuch@notmuchmail.org

On Fri, Nov 8, 2013 at 12:03 PM, David Bremner <david@tethera.net> wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>>
>> You can probably check that it's working with this:
>> % vim -c ":h notmuch"
>
> It turns I needed to re-run
>
>    "vim-addon-manager install notmuch"
>
> This might be a bit debian specific, but it's already documented as
> needed for the initial install. It would probably be worth updating
> debian/notmuch-vim.README.Debian to suggest running this on upgrade as
> well.

Shouldn't this happen on a post update script or something?

-- 
Felipe Contreras

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

* Re: [PATCH 21/21] vim: add help file
  2013-11-08 18:05         ` Felipe Contreras
@ 2013-11-09  0:08           ` David Bremner
  0 siblings, 0 replies; 35+ messages in thread
From: David Bremner @ 2013-11-09  0:08 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: notmuch@notmuchmail.org

Felipe Contreras <felipe.contreras@gmail.com> writes:

> On Fri, Nov 8, 2013 at 12:03 PM, David Bremner <david@tethera.net> wrote:

>> This might be a bit debian specific, but it's already documented as
>> needed for the initial install. It would probably be worth updating
>> debian/notmuch-vim.README.Debian to suggest running this on upgrade as
>> well.
>
> Shouldn't this happen on a post update script or something?
>

Yeah, I talked to the Debian vim maintainer, and apparently that is a
design flaw with the current way vim addons are managed. So the best we
can do for the moment is put a note in "debian/notmuch-vim.NEWS" (in the
same format as debian/NEWS.Debian. The format is a bit fussy, so I can
take care of that.

d

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

* Re: [PATCH 00/21] vim: general updates
  2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
                   ` (20 preceding siblings ...)
  2013-11-02 13:55 ` [PATCH 21/21] vim: add help file Felipe Contreras
@ 2013-11-11 18:11 ` Felipe Contreras
  2013-11-20 12:21   ` David Bremner
  21 siblings, 1 reply; 35+ messages in thread
From: Felipe Contreras @ 2013-11-11 18:11 UTC (permalink / raw)
  To: notmuch@notmuchmail.org

On Sat, Nov 2, 2013 at 7:55 AM, Felipe Contreras
<felipe.contreras@gmail.com> wrote:

> I've been cooking this in my personal notmuch-vim-ruby repository, and I think
> they are ready for notmuch.
>
> A few highlights:
>
>  * There's now support to compose new messages, previously there was only
>    support to reply.
>  * Database handling has been revamped to get rid of memory leaks
>  * A new help file is included
>  * Added support to go straight to a search (bypassing the folders view)

All right, if there's no further feedback I'll push these tomorrow.

-- 
Felipe Contreras

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

* Re: [PATCH 00/21] vim: general updates
  2013-11-11 18:11 ` [PATCH 00/21] vim: general updates Felipe Contreras
@ 2013-11-20 12:21   ` David Bremner
  2013-11-20 13:31     ` Felipe Contreras
  0 siblings, 1 reply; 35+ messages in thread
From: David Bremner @ 2013-11-20 12:21 UTC (permalink / raw)
  To: Felipe Contreras, notmuch@notmuchmail.org

Felipe Contreras <felipe.contreras@gmail.com> writes:

>
> All right, if there's no further feedback I'll push these tomorrow.
>

Please do. It's one of the things I'm waiting for before a feature
freeze for 0.17

cheers,

d

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

* Re: [PATCH 00/21] vim: general updates
  2013-11-20 12:21   ` David Bremner
@ 2013-11-20 13:31     ` Felipe Contreras
  2013-11-20 22:13       ` David Bremner
  0 siblings, 1 reply; 35+ messages in thread
From: Felipe Contreras @ 2013-11-20 13:31 UTC (permalink / raw)
  To: David Bremner; +Cc: notmuch@notmuchmail.org

On Wed, Nov 20, 2013 at 6:21 AM, David Bremner <david@tethera.net> wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>>
>> All right, if there's no further feedback I'll push these tomorrow.
>>
>
> Please do. It's one of the things I'm waiting for before a feature
> freeze for 0.17

Sorry I forgot, it's pushed now.

Cheers.

-- 
Felipe Contreras

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

* Re: [PATCH 00/21] vim: general updates
  2013-11-20 13:31     ` Felipe Contreras
@ 2013-11-20 22:13       ` David Bremner
  2013-11-27  6:35         ` Felipe Contreras
  0 siblings, 1 reply; 35+ messages in thread
From: David Bremner @ 2013-11-20 22:13 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: notmuch@notmuchmail.org

Felipe Contreras <felipe.contreras@gmail.com> writes:
>> Please do. It's one of the things I'm waiting for before a feature
>> freeze for 0.17
>
> Sorry I forgot, it's pushed now.

OK, thanks. Anything you want to add to the NEWS file about vim stuff?

d

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

* Re: [PATCH 00/21] vim: general updates
  2013-11-20 22:13       ` David Bremner
@ 2013-11-27  6:35         ` Felipe Contreras
  2013-11-28 10:26           ` [PATCH] vim: NEWS for vim interface David Bremner
  0 siblings, 1 reply; 35+ messages in thread
From: Felipe Contreras @ 2013-11-27  6:35 UTC (permalink / raw)
  To: David Bremner; +Cc: notmuch@notmuchmail.org

On Wed, Nov 20, 2013 at 4:13 PM, David Bremner <david@tethera.net> wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>>> Please do. It's one of the things I'm waiting for before a feature
>>> freeze for 0.17
>>
>> Sorry I forgot, it's pushed now.
>
> OK, thanks. Anything you want to add to the NEWS file about vim stuff?

I think these two have merit enough:

 * There's now support to compose new messages, previously there was only
   support to reply.
 * Added support to go straight to a search (bypassing the folders view)

-- 
Felipe Contreras

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

* [PATCH] vim: NEWS for vim interface
  2013-11-27  6:35         ` Felipe Contreras
@ 2013-11-28 10:26           ` David Bremner
  2013-11-29  7:54             ` Tomi Ollila
  2013-11-29 11:58             ` David Bremner
  0 siblings, 2 replies; 35+ messages in thread
From: David Bremner @ 2013-11-28 10:26 UTC (permalink / raw)
  To: notmuch

Transcribed from Felipe's email.
---
 NEWS | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/NEWS b/NEWS
index 184bd0e..02ed670 100644
--- a/NEWS
+++ b/NEWS
@@ -146,6 +146,13 @@ Fixed `notmuch-mua-reply` point placement when signature involved
   section anymore. Now inserted citation content will definitely go to
   the body part of the message.
 
+Vim Interface
+-------------
+
+  It is now possible to compose new messages in the Vim interface, as
+  opposed reply to existing messages.  There is also support for
+  going straight to a search (bypassing the folders view).
+
 Notmuch 0.16 (2013-08-03)
 =========================
 
-- 
1.8.4.2

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

* Re: [PATCH] vim: NEWS for vim interface
  2013-11-28 10:26           ` [PATCH] vim: NEWS for vim interface David Bremner
@ 2013-11-29  7:54             ` Tomi Ollila
  2013-11-29 11:58             ` David Bremner
  1 sibling, 0 replies; 35+ messages in thread
From: Tomi Ollila @ 2013-11-29  7:54 UTC (permalink / raw)
  To: David Bremner, notmuch

On Thu, Nov 28 2013, David Bremner <david@tethera.net> wrote:

> Transcribed from Felipe's email.
> ---

FWIW LGTM :D

Tomi


>  NEWS | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/NEWS b/NEWS
> index 184bd0e..02ed670 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -146,6 +146,13 @@ Fixed `notmuch-mua-reply` point placement when signature involved
>    section anymore. Now inserted citation content will definitely go to
>    the body part of the message.
>  
> +Vim Interface
> +-------------
> +
> +  It is now possible to compose new messages in the Vim interface, as
> +  opposed reply to existing messages.  There is also support for
> +  going straight to a search (bypassing the folders view).
> +
>  Notmuch 0.16 (2013-08-03)
>  =========================
>  
> -- 
> 1.8.4.2
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH] vim: NEWS for vim interface
  2013-11-28 10:26           ` [PATCH] vim: NEWS for vim interface David Bremner
  2013-11-29  7:54             ` Tomi Ollila
@ 2013-11-29 11:58             ` David Bremner
  1 sibling, 0 replies; 35+ messages in thread
From: David Bremner @ 2013-11-29 11:58 UTC (permalink / raw)
  To: notmuch

David Bremner <david@tethera.net> writes:

> Transcribed from Felipe's email.
> ---

and pushed to a new release candidate.

d

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

end of thread, other threads:[~2013-11-29 11:59 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
2013-11-02 13:55 ` [PATCH 01/21] vim: run mutt in default term Felipe Contreras
2013-11-02 13:55 ` [PATCH 02/21] vim: don't automatically refresh after tagging Felipe Contreras
2013-11-02 13:55 ` [PATCH 03/21] vim: use notmuch fields Felipe Contreras
2013-11-02 13:55 ` [PATCH 04/21] vim: refactor database handling Felipe Contreras
2013-11-02 13:55 ` [PATCH 05/21] vim: show first message of the thread Felipe Contreras
2013-11-02 13:55 ` [PATCH 06/21] vim: use much clearer sort constant Felipe Contreras
2013-11-02 13:55 ` [PATCH 07/21] vim: add option to save the patches of a patch series Felipe Contreras
2013-11-02 13:55 ` [PATCH 08/21] vim: allow calling with arguments Felipe Contreras
2013-11-02 13:55 ` [PATCH 09/21] vim: split $email_address Felipe Contreras
2013-11-02 13:55 ` [PATCH 10/21] vim: generate custom message-id Felipe Contreras
2013-11-02 13:55 ` [PATCH 11/21] vim: don't execute search if it's cancelled Felipe Contreras
2013-11-02 13:55 ` [PATCH 12/21] vim: trivial cleanup Felipe Contreras
2013-11-02 13:55 ` [PATCH 13/21] vim: refactor open_reply() Felipe Contreras
2013-11-02 13:55 ` [PATCH 14/21] vim: add option to compose new messages Felipe Contreras
2013-11-02 13:55 ` [PATCH 15/21] vim: rename internal notmuch_rb variables Felipe Contreras
2013-11-02 13:55 ` [PATCH 16/21] vim: rename public " Felipe Contreras
2013-11-02 13:55 ` [PATCH 17/21] vim: move default sets to set_defaults() Felipe Contreras
2013-11-02 13:55 ` [PATCH 18/21] vim: add wrapper for old variable names Felipe Contreras
2013-11-02 13:55 ` [PATCH 19/21] vim: remove unnecessary buffer queue Felipe Contreras
2013-11-02 13:55 ` [PATCH 20/21] vim: check compose is done on delete Felipe Contreras
2013-11-02 13:55 ` [PATCH 21/21] vim: add help file Felipe Contreras
2013-11-08 12:43   ` David Bremner
2013-11-08 13:10     ` Felipe Contreras
2013-11-08 18:03       ` David Bremner
2013-11-08 18:05         ` Felipe Contreras
2013-11-09  0:08           ` David Bremner
2013-11-11 18:11 ` [PATCH 00/21] vim: general updates Felipe Contreras
2013-11-20 12:21   ` David Bremner
2013-11-20 13:31     ` Felipe Contreras
2013-11-20 22:13       ` David Bremner
2013-11-27  6:35         ` Felipe Contreras
2013-11-28 10:26           ` [PATCH] vim: NEWS for vim interface David Bremner
2013-11-29  7:54             ` Tomi Ollila
2013-11-29 11:58             ` David Bremner

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