Subject: bug#35370: notmuch-emacs: avoiding deprecated message-default-charset

From: Noam Postavsky <[email-masked]>
Date: Sun, 21 Apr 2019 18:05:19 -0400

Daniel Kahn Gillmor <[email-masked]> writes:

>>> In notmuch-maildir-setup-message-for-saving:
>>> emacs/notmuch-maildir-fcc.el:172:31:Warning: ‘message-default-charset’ is an
>>>     obsolete variable (as of 26.1); The default charset comes from the
>>>     language environment
>>>
>>> I'm not enough of an emacs guru to know the right way to avoid this
>>> warning, but i'm hoping that someonen else can take a stab at it, since
>>> extraneous warnings make it easier to ignore real problems.
>>
>> Good question. I looked at message.el in emacs master and it
>>
>>      1) Obsoletes message-default-charset as in 26.1
>>      2) Still uses it in exactly the construction we do.
>
> interesting, thanks for digging that up.
>
>> I'm not sure if it's exactly a reportable bug in emacs, but it is a bit
>> annoying.
>
> seems reportable, if not exactly high-severity.  what does upstream
> expect downstream users of message-default-charset to do?  I'm
> (trying to) forward this to the emacs upstream bugtracker; maybe we can
> get guidance from them on what to do.

The commit which marks this variable as obsolete, has a couple hunks
that just remove uses of it.  Not clear why other uses were left in.
Oversight?

[1: 66d9ef95c0]: 2016-02-14 17:07:48 +1100
  Remove compat code for older Emacsen
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=66d9ef95c0f9407d2a6d26bcd7ed84a303294b53

--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -777,8 +777,7 @@ (defun gnus-request-accept-article (group &optional gnus-command-method last
       (message-options-set-recipient)
       (save-restriction
 	(message-narrow-to-head)
-	(let ((mail-parse-charset message-default-charset))
-	  (mail-encode-encoded-word-buffer)))
+	(mail-encode-encoded-word-buffer))
       (message-encode-message-body)))
   (let ((gnus-command-method (or gnus-command-method
 				 (gnus-find-method-for-group group)))
@@ -800,8 +799,7 @@ (defun gnus-request-replace-article (article group buffer &optional no-encode)
       (message-options-set-recipient)
       (save-restriction
 	(message-narrow-to-head)
-	(let ((mail-parse-charset message-default-charset))
-	  (mail-encode-encoded-word-buffer)))
+	(mail-encode-encoded-word-buffer))
       (message-encode-message-body)))
   (let* ((func (car (gnus-group-name-to-method group)))
          (result (funcall (intern (format "%s-request-replace-article" func))