From: Eli Zaretskii Date: Sat, 25 May 2024 06:12:42 +0000 (+0300) Subject: Fix encoding of text when saving a gpg-encoded file X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=090949703ed73210d1c6d59c7329f802b41e37e9;p=emacs.git 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) (cherry picked from commit d50e3226b1a6234830e7946518f31c99669915cb) --- 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)))