]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix encoding of text when saving a gpg-encoded file
authorEli Zaretskii <eliz@gnu.org>
Sat, 25 May 2024 06:12:42 +0000 (09:12 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sun, 26 May 2024 05:56:59 +0000 (07:56 +0200)
* 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)

lisp/epa-file.el

index a4942e78de736bd8847b9bd2a57406c4f48d99fd..90cc91e99a0774bffd0bf373aa165f29ce92adfa 100644 (file)
@@ -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)))