From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: ielm automatic saving of history -- bug 67000 Date: Wed, 16 Oct 2024 09:04:51 +0300 Message-ID: <865xpsr3b0.fsf@gnu.org> References: <864j5dsgot.fsf@gnu.org> <20241015.230011.595343732756221115.enometh@meer.net> <86jze9ql81.fsf@gnu.org> <20241016.095542.548863482055227550.enometh@meer.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34988"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Madhu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 16 08:05:35 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t0xA7-0008yB-47 for ged-emacs-devel@m.gmane-mx.org; Wed, 16 Oct 2024 08:05:35 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t0x9X-0003xH-Uj; Wed, 16 Oct 2024 02:04:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0x9R-0003wM-U1 for emacs-devel@gnu.org; Wed, 16 Oct 2024 02:04:54 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0x9R-0004zu-JO; Wed, 16 Oct 2024 02:04:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=RZAcyNNypv6SnhExyLTdLMuDbeQk73tNwUdBPn6GUZw=; b=nyLTr8pPWGHv t2Igm7CvCmt+qi6R6drkFHOPiJYWSx8g0ciAlIufOPkcQdsrb2g/wIa0oi9XeA1zyQDaVkGUckNcJ E1pO5TZyLDM8k7ni6UTBRlJPOG5a55zv0oZ3GByPsOjgmjmjJqChbDdhQ5JpjMviRYmoA4bpG0VJF wOfeenCOr5oRW6xo7rR/3UH6xMk9o5G35DjldYEKm0WhD1HfVlXjwZ/d6ywQoa3NgJjZd80MdQeRN gMiuKH0eHMgm8zg2hADFK+Mu/F+wZe3+zRtJVLSGmBe6GcHr0q2p084E33pZXcEV2QwZaUDSa9YHJ 7VpmEsYEABuMqFeIqZvSVQ==; In-Reply-To: <20241016.095542.548863482055227550.enometh@meer.net> (message from Madhu on Wed, 16 Oct 2024 09:55:42 +0530 (IST)) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:324607 Archived-At: > Date: Wed, 16 Oct 2024 09:55:42 +0530 (IST) > Cc: emacs-devel@gnu.org > From: Madhu > > >> (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.