unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 71080@debbugs.gnu.org
Subject: bug#71080: 30.0.50; UTF-8 used unconditionally when saving GPG file
Date: Thu, 23 May 2024 16:01:21 +0300	[thread overview]
Message-ID: <86pltc4r8e.fsf@gnu.org> (raw)
In-Reply-To: <jwvle44gpx9.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Mon, 20 May 2024 17:08:25 -0400)

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: 71080@debbugs.gnu.org
> Date: Mon, 20 May 2024 17:08:25 -0400
> 
> \316\273 is the encoding of λ in UTF-8, not in `iso-2022-7bit`, so it
> seems pretty clear that Emacs encoded the buffer using (some version of)
> utf-8, thus disregarding the `coding:` cookie.

AFAICT, this is due to an (unsolicited? at least the log message is
silent about this particular part) change as part of commit
e78c15acf679, 4 years ago.  Reverting that part makes your recipe work
as expected.  Please try the patch below:

diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index a4942e7..90cc91e 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -267,7 +267,14 @@ epa-file-write-region
   (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)))





  reply	other threads:[~2024-05-23 13:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20 15:43 bug#71080: 30.0.50; UTF-8 used unconditionally when saving GPG file Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-20 16:20 ` Eli Zaretskii
2024-05-20 16:38   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-20 18:00     ` Eli Zaretskii
2024-05-20 21:08       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-23 13:01         ` Eli Zaretskii [this message]
2024-05-23 15:44           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-24 20:12             ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-25  6:14               ` Eli Zaretskii
2024-05-25 14:01               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86pltc4r8e.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=71080@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).