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

classic Classic list List threaded Threaded
4 messages Options
Jules Aguillon Jules Aguillon
Reply | Threaded
Open this post in threaded view
|

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

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 -- [hidden email]
To unsubscribe send an email to [hidden email]
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

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

Jules Aguillon <[hidden email]> writes:

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

I believe this problem was fixed in a different way by Felipe's patch
applied as 8af4cd16

d
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Felipe Contreras Felipe Contreras
Reply | Threaded
Open this post in threaded view
|

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

On Sun, May 2, 2021 at 5:43 AM David Bremner <[hidden email]> wrote:

>
> Jules Aguillon <[hidden email]> writes:
>
> > 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.
>
> I believe this problem was fixed in a different way by Felipe's patch
> applied as 8af4cd16

Indeed, but Jules' patch may be a better solution, I will investigate.

--
Felipe Contreras
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Jules Aguillon Jules Aguillon
Reply | Threaded
Open this post in threaded view
|

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

Hi !

This is indeed fixed on master. My patch has the advantage of removing the extraneous "to string" and "parsing" steps but that's not a big deal.
Thanks!

On Sun, May 2, 2021 at 11:51 PM Felipe Contreras <[hidden email]> wrote:
On Sun, May 2, 2021 at 5:43 AM David Bremner <[hidden email]> wrote:
>
> Jules Aguillon <[hidden email]> writes:
>
> > 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.
>
> I believe this problem was fixed in a different way by Felipe's patch
> applied as 8af4cd16

Indeed, but Jules' patch may be a better solution, I will investigate.

--
Felipe Contreras

_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]