unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Madhu <enometh@meer.net>
Cc: emacs-devel@gnu.org
Subject: Re: ielm automatic saving of history -- bug 67000
Date: Wed, 16 Oct 2024 09:04:51 +0300	[thread overview]
Message-ID: <865xpsr3b0.fsf@gnu.org> (raw)
In-Reply-To: <20241016.095542.548863482055227550.enometh@meer.net> (message from Madhu on Wed, 16 Oct 2024 09:55:42 +0530 (IST))

> Date: Wed, 16 Oct 2024 09:55:42 +0530 (IST)
> Cc: emacs-devel@gnu.org
> From: Madhu <enometh@meer.net>
> 
> >> (let ((coding-system-for-write 'utf-8-unix)) (funcall ielm--exit))
> >> ```
> >>
> >> saves the history according to the code in ielm--exit without the
> >> coding system error.
> >
> > And loses some of those bytes as part of that.  This is exactly why I
> > suggest to use utf-8-emacs-unix.
> 
> In this case there was no loss of bytes.

There was, trust me.

> Apparently using utf-8-unix
> is sufficient to encode the contents of the buffer beings saved
> without any loss of data.

It is not.  It can only safely encode characters that are inside the
Unicode codepoint space, and raw bytes are outside that range.

> The file written is identical to the file which was read.

I don't understand what you mean.  AFAIU, IELM history records what
you typed, so what file was read here?

> I think the question I wanted to ask was: does specifying
> coding-system-for-write (to any non-nil acceptable value)
> unconditionally suppress the "coding system warning" error?

No.  It is only sufficient if Emacs has some way of dealing with the
characters which prompted the coding system warning in the first
place.  That is not always the case.

> from your
> response above I think the answer is: "yes, but it may clobber it".

It might clobber them, but in some cases it will actually be unable to
do even that.

> The second issue is that the coding system warning which is printed
> when emacs prompts for a suitable coding system isn't entire accurate.
> it says the default coding system which was tried, to encode ".."  is
> utf-8-unix and cannot encode these characters etc. but if it is
> sufficient, and if i type utf-8-unix into the prompt, the file is
> encoded and saved.

See above: it means cannot encode safely.



  reply	other threads:[~2024-10-16  6:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-13  4:17 ielm automatic saving of history -- bug 67000 Madhu
2024-10-13  6:06 ` Eli Zaretskii
2024-10-13  9:49   ` Madhu
2024-10-14  6:23   ` Augusto Stoffel
2024-10-14 14:05     ` Eli Zaretskii
2024-10-15  4:46       ` Madhu
2024-10-15 12:18         ` Eli Zaretskii
2024-10-15 17:30           ` Madhu
2024-10-15 18:23             ` Eli Zaretskii
2024-10-16  4:25               ` Madhu
2024-10-16  6:04                 ` Eli Zaretskii [this message]
2024-10-16  9:03                   ` Madhu
2024-10-16 18:36                     ` Eli Zaretskii
2024-10-16 17:02   ` Simen Heggestøyl
2024-10-17  2:04     ` Madhu

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=865xpsr3b0.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=enometh@meer.net \
    /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).