[PATCH 09/13] vim: option to add email address to reply quote

Subject: [PATCH 09/13] vim: option to add email address to reply quote

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

To: notmuch@notmuchmail.org

Cc: Aaron Borden

From: Felipe Contreras


From: Aaron Borden <adborden@live.com>

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

diff --git a/vim/notmuch.txt b/vim/notmuch.txt
index c98f2b53..b658020d 100644
--- a/vim/notmuch.txt
+++ b/vim/notmuch.txt
@@ -133,6 +133,12 @@ You can do the same for the thread view:
 >
 	let g:notmuch_datetime_format = '%d.%m.%y %H:%M:%S'
 <
+						*g:notmuch_reply_quote_format*
+
+If you want to change the reply quote format to show the email address:
+>
+	let g:notmuch_reply_quote_format = '%s <%s>'
+<
 
 						*g:notmuch_folders_count_threads*
 
diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 7a448467..59914a76 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -56,6 +56,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_reader_default = 'mutt -f %s'
 let s:notmuch_sendmail_default = 'sendmail'
 let s:notmuch_folders_count_threads_default = 0
@@ -413,6 +414,10 @@ function! s:set_defaults()
 		endif
 	endif
 
+	if !exists('g:notmuch_reply_quote_format')
+		let g:notmuch_reply_quote_format = s:notmuch_reply_quote_format_default
+	endif
+
 	if !exists('g:notmuch_reader')
 		if exists('g:notmuch_rb_reader')
 			let g:notmuch_reader = g:notmuch_rb_reader
@@ -593,6 +598,8 @@ ruby << EOF
 			addr = Mail::Address.new(orig[:from].value)
 			name = addr.name
 			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?
 		else
 			name = orig[:from]
 		end
-- 
2.31.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: