bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#71080: 30.0.50; UTF-8 used unconditionally when saving GPG file


From: Eli Zaretskii
Subject: bug#71080: 30.0.50; UTF-8 used unconditionally when saving GPG file
Date: Thu, 23 May 2024 16:01:21 +0300

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: 71080@debbugs.gnu.org
> Date: Mon, 20 May 2024 17:08:25 -0400
> 
> \316\273 is the encoding of λ in UTF-8, not in `iso-2022-7bit`, so it
> seems pretty clear that Emacs encoded the buffer using (some version of)
> utf-8, thus disregarding the `coding:` cookie.

AFAICT, this is due to an (unsolicited? at least the log message is
silent about this particular part) change as part of commit
e78c15acf679, 4 years ago.  Reverting that part makes your recipe work
as expected.  Please try the patch below:

diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index a4942e7..90cc91e 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -267,7 +267,14 @@ epa-file-write-region
   (setq file (expand-file-name file))
   (let* ((coding-system (or coding-system-for-write
                            (if (fboundp 'select-safe-coding-system)
-                               (let ((buffer-file-name file))
+                                ;; This is needed because
+                                ;; `auto-coding-alist' has
+                                ;; `no-conversion' for *.gpg files,
+                                ;; which would otherwise force
+                                ;; `select-safe-coding-system' return
+                                ;; `no-conversion'.
+                               (let ((buffer-file-name
+                                       (file-name-sans-extension file)))
                                  (select-safe-coding-system
                                   (point-min) (point-max)))
                              buffer-file-coding-system)))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]