[PATCH 10/13] vim: option to add reply quote datetime

Subject: [PATCH 10/13] vim: option to add reply quote datetime

Date: Sun, 18 Apr 2021 17:48:48 -0500

To: notmuch@notmuchmail.org

Cc: Aaron Borden

From: Felipe Contreras


From: Aaron Borden <adborden@live.com>

By default it's empty so the format doesn't change.

Cleanup-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.txt |  7 +++++++
 vim/notmuch.vim | 12 +++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/vim/notmuch.txt b/vim/notmuch.txt
index b658020d..a8a75fed 100644
--- a/vim/notmuch.txt
+++ b/vim/notmuch.txt
@@ -140,6 +140,13 @@ If you want to change the reply quote format to show the email address:
 	let g:notmuch_reply_quote_format = '%s <%s>'
 <
 
+						*g:notmuch_reply_quote_datetime_format*
+
+There's also a way to specy the reply quote datetime format:
+>
+	let g:notmuch_reply_quote_datetime_format = '%a %b %e'
+<
+
 						*g:notmuch_folders_count_threads*
 
 If you want to count the threads instead of the messages in the folder view:
diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 59914a76..e717fb5a 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -57,6 +57,7 @@ let s:notmuch_folders_default = [
 let s:notmuch_date_format_default = '%d.%m.%y'
 let s:notmuch_datetime_format_default = '%d.%m.%y %H:%M:%S'
 let s:notmuch_reply_quote_format_default = '%s'
+let s:notmuch_reply_quote_datetime_format_default = ''
 let s:notmuch_reader_default = 'mutt -f %s'
 let s:notmuch_sendmail_default = 'sendmail'
 let s:notmuch_folders_count_threads_default = 0
@@ -418,6 +419,10 @@ function! s:set_defaults()
 		let g:notmuch_reply_quote_format = s:notmuch_reply_quote_format_default
 	endif
 
+	if !exists('g:notmuch_reply_quote_datetime_format')
+		let g:notmuch_reply_quote_datetime_format = s:notmuch_reply_quote_datetime_format_default
+	endif
+
 	if !exists('g:notmuch_reader')
 		if exists('g:notmuch_rb_reader')
 			let g:notmuch_reader = g:notmuch_rb_reader
@@ -600,12 +605,17 @@ ruby << EOF
 			name = addr.local + "@" if name.nil? && !addr.local.nil?
 			name_format = VIM::evaluate('g:notmuch_reply_quote_format')
 			name = name_format % [name, addr.address] if !addr.address.nil?
+			date_format = VIM::evaluate('g:notmuch_reply_quote_datetime_format')
+			quote_datetime = orig.date.strftime(date_format) if !date_format.empty? and orig.date
 		else
 			name = orig[:from]
 		end
 		name = "somebody" if name.nil?
 
-		body_lines << "%s wrote:" % name
+		quote = []
+		quote << "On %s" % quote_datetime if quote_datetime
+		quote << "%s wrote:" % name
+		body_lines << quote.join(', ')
 		part = orig.find_first_text
 		part.convert.each_line do |l|
 			body_lines << "> %s" % l.chomp
-- 
2.31.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: