From d50e3226b1a6234830e7946518f31c99669915cb Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 25 May 2024 09:12:42 +0300 Subject: [PATCH] Fix encoding of text when saving a gpg-encoded file * lisp/epa-file.el (epa-file-write-region): Revert inadvertent change from July 15, 2020 which broke selection of a correct encoding for stuff sent to 'gpg'. (Bug#71080) --- lisp/epa-file.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/epa-file.el b/lisp/epa-file.el index a4942e78de7..90cc91e99a0 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el @@ -267,7 +267,14 @@ encryption is used." (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)))