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)
This commit is contained in:
Eli Zaretskii 2024-05-25 09:12:42 +03:00
parent 984fb346fd
commit d50e3226b1

View 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)))