[PATCH] Vim: Fix a deprecated call to the 'mail' gem

Subject: [PATCH] Vim: Fix a deprecated call to the 'mail' gem

Date: Tue, 16 Feb 2021 23:20:29 +0100

To: notmuch@notmuchmail.org

Cc: Jules Aguillon

From: Jules Aguillon


The Field.new function from the 'mail' gem changed recently (since
2.7.0, Nov 2017) and now prints a message on stdout:

> Passing an unparsed header field to Mail::Field.new is deprecated and will be removed in Mail 2.8.0. Use Mail::Field.parse instead.
---
 NEWS            | 5 +++++
 vim/notmuch.vim | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 6484567e..f2d2b43a 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,11 @@ Library
 
 Fix for memory error in notmuch_database_get_config_list
 
+Vim
+---
+
+Fix a deprecation warning since the version 2.7.0 of the 'mail' gem.
+
 Notmuch 0.31.2 (2020-11-08)
 ===========================
 
diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index ad8b7c80..332fefee 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -666,7 +666,7 @@ ruby << EOF
 				date = Time.at(e.newest_date).strftime(date_fmt)
 				subject = e.messages.first['subject']
 				if $mail_installed
-					subject = Mail::Field.new("Subject: " + subject).to_s
+					subject = Mail::Field.new("subject", subject).to_s
 				else
 					subject = subject.force_encoding('utf-8')
 				end
-- 
2.30.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: