From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Madhu Newsgroups: gmane.emacs.devel Subject: Re: ielm automatic saving of history -- bug 67000 Date: Wed, 16 Oct 2024 09:55:42 +0530 (IST) Message-ID: <20241016.095542.548863482055227550.enometh@meer.net> References: <864j5dsgot.fsf@gnu.org> <20241015.230011.595343732756221115.enometh@meer.net> <86jze9ql81.fsf@gnu.org> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31312"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: eliz@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 16 06:26:50 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 1t0vcX-0007x6-7d for ged-emacs-devel@m.gmane-mx.org; Wed, 16 Oct 2024 06:26:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t0vba-0000Yg-1P; Wed, 16 Oct 2024 00:25:50 -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 1t0vbT-0000YP-1q for emacs-devel@gnu.org; Wed, 16 Oct 2024 00:25:43 -0400 Original-Received: from smtp7.ctinetworks.com ([205.166.61.237]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0vbP-00032s-St; Wed, 16 Oct 2024 00:25:42 -0400 X-ctinetworks-Watermark: 1729916736.67214@wsyhTmV+z5HuUHZXpkEDng X-ctinetworks-Envelope-From: enometh@meer.net X-ctinetworks-VirusCheck: Found to be clean X-ctinetworks-Message-ID: 35739ECB1.A391F Original-Received: from localhost (unknown [117.254.36.119]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: enometh@meer.net) by smtp7.ctinetworks.com (Postfix) with ESMTPSA id 35739ECB1; Wed, 16 Oct 2024 00:25:33 -0400 (EDT) In-Reply-To: <86jze9ql81.fsf@gnu.org> X-Mailer: Mew version 6.9 on Emacs 31.0.50 Received-SPF: pass client-ip=205.166.61.237; envelope-from=enometh@meer.net; helo=smtp7.ctinetworks.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:324606 Archived-At: * Eli Zaretskii <86jze9ql81.fsf@gnu.org> Wrote on Tue, 15 Oct 2024 21:23:10 +0300 >> my ~/.ielm-history (which gets read into comint-input-ring) has this >> line (but with raw characters) >> >> ``` >> (rfc2047-encode-string "foo \303\200 bar") >> ``` >> >> (funcall ielm--exit) in the ielm buffer causes the coding system warning: >> >> "These default coding systems were tried to encode the >> following[...].. utf-8-unix" >> >> However >> >> ``` >> (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. Apparently using utf-8-unix is sufficient to encode the contents of the buffer beings saved without any loss of data. The file written is identical to the file which was read. (let ((comint-input-ring-file-name "/dev/shm/f") (coding-system-for-write 'utf-8-unix)) (comint-write-input-ring)) >> but coding-system-for-write is still 'utf-8-unix and not >> 'utf-8-emacs-unix so I think I still need an explanation, please. > > I'm not sure what to explain. utf-8-unix will not correctly write out > raw bytes and some other characters outside of the Unicode range, > whereas utf-8-emacs-unix will correctly write all of them, because it > uses the same encoding as the internal representation of characters > within Emacs. > > If this is still not clear, please ask specific questions. 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? from your response above I think the answer is: "yes, but it may clobber it". 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.