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

From: Noam Postavsky <[email-masked]>
Date: Tue, 07 May 2019 08:26:59 -0400

Eli Zaretskii <[email-masked]> writes:

>> From: Daniel Kahn Gillmor <[email-masked]>
>> Date: Sun, 21 Apr 2019 21:55:38 -0400
>> Cc: [email-masked], [email-masked], [email-masked]
>> 
>> Do you have any recommendation for how an external emacs module (which
>> aims to work with at emacs 25 as well at least) should handle this?
>
> Just remove any uses of it.  Why are you using it now?

Should we remove the remaining uses of it from Emacs too?

>From a3dca9511e1639ccfdf06bced16af5babb5078de Mon Sep 17 00:00:00 2001
From: Noam Postavsky <[email-masked]>
Date: Tue, 7 May 2019 08:18:49 -0400
Subject: [PATCH] Stop using message-default-charset (Bug#35370)

In 2016-02-14 "Remove compat code for older Emacsen",
message-default-charset was obsoleted, and a couple of uses were
removed, but others were left behind.
* lisp/gnus/message.el (message-send-mail)
(message-send-news, message-do-fcc)
(message-encode-message-body):
* lisp/gnus/mml.el (mml-to-mime): Stop using message-default-charset.
---
 lisp/gnus/message.el | 13 ++++---------
 lisp/gnus/mml.el     |  4 +---
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index c8b6f0ee68..2c2122d89a 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -4588,8 +4588,7 @@ (defun message-send-mail (&optional _)
 	      (message-generate-headers '(Lines)))
 	    ;; Remove some headers.
 	    (message-remove-header message-ignored-mail-headers t)
-	    (let ((mail-parse-charset message-default-charset))
-	      (mail-encode-encoded-word-buffer)))
+            (mail-encode-encoded-word-buffer))
 	  (goto-char (point-max))
 	  ;; require one newline at the end.
 	  (or (= (preceding-char) ?\n)
@@ -4962,8 +4961,7 @@ (defun message-send-news (&optional arg)
 		  (message-generate-headers '(Lines)))
 		;; Remove some headers.
 		(message-remove-header message-ignored-news-headers t)
-		(let ((mail-parse-charset message-default-charset))
-		  (mail-encode-encoded-word-buffer)))
+                (mail-encode-encoded-word-buffer))
 	      (goto-char (point-max))
 	      ;; require one newline at the end.
 	      (or (= (preceding-char) ?\n)
@@ -5441,8 +5439,7 @@ (defun message-do-fcc ()
 	  (while (setq file (message-fetch-field "fcc" t))
 	    (push file list)
 	    (message-remove-header "fcc" nil t))
-	  (let ((mail-parse-charset message-default-charset)
-		(rfc2047-header-encoding-alist
+          (let ((rfc2047-header-encoding-alist
 		 (cons '("Newsgroups" . default)
 		       rfc2047-header-encoding-alist)))
 	    (mail-encode-encoded-word-buffer)))
@@ -8101,9 +8098,7 @@ (defun message-clone-locals (buffer &optional varstr)
 
 (defun message-encode-message-body ()
   (unless message-inhibit-body-encoding
-    (let ((mail-parse-charset (or mail-parse-charset
-				  message-default-charset))
-	  (case-fold-search t)
+    (let ((case-fold-search t)
 	  lines content-type-p)
       (message-goto-body)
       (save-restriction
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index f6d358dfc0..7a99a0dc46 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -48,7 +48,6 @@ (autoload 'message-mail-p         "message")
 
 (defvar gnus-article-mime-handles)
 (defvar gnus-newsrc-hashtb)
-(defvar message-default-charset)
 (defvar message-deletable-headers)
 (defvar message-options)
 (defvar message-posting-charset)
@@ -1015,8 +1014,7 @@ (defun mml-to-mime ()
     ;; Skip past any From_ headers.
     (while (looking-at "From ")
       (forward-line 1))
-    (let ((mail-parse-charset message-default-charset))
-      (mail-encode-encoded-word-buffer)))
+    (mail-encode-encoded-word-buffer))
   (message-encode-message-body))
 
 (defun mml-insert-mime (handle &optional no-markup)
-- 
2.11.0