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