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: Tue, 15 Oct 2024 23:00:11 +0530 (IST) Message-ID: <20241015.230011.595343732756221115.enometh@meer.net> References: <86r08isrtg.fsf@gnu.org> <20241015.101633.2219948655969771381.enometh@meer.net> <864j5dsgot.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="23250"; mail-complaints-to="usenet@ciao.gmane.io" Cc: arstoffel@gmail.com, simenheg@runbox.com, emacs-devel@gnu.org To: eliz@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 15 19:31:00 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 1t0lNs-0005nk-7a for ged-emacs-devel@m.gmane-mx.org; Tue, 15 Oct 2024 19:31:00 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t0lN6-0005NU-4H; Tue, 15 Oct 2024 13:30:12 -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 1t0lN4-0005NK-DM for emacs-devel@gnu.org; Tue, 15 Oct 2024 13:30:10 -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 1t0lN1-0005XA-Us; Tue, 15 Oct 2024 13:30:10 -0400 X-ctinetworks-Watermark: 1729877404.34078@n2KAgI2dPeo+BoxdvH+/ig X-ctinetworks-Envelope-From: enometh@meer.net X-ctinetworks-VirusCheck: Found to be clean X-ctinetworks-Message-ID: 8392FECB1.A4A1C Original-Received: from localhost (unknown [117.254.37.23]) (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 8392FECB1; Tue, 15 Oct 2024 13:30:01 -0400 (EDT) In-Reply-To: <864j5dsgot.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:324603 Archived-At: * Eli Zaretskii <864j5dsgot.fsf@gnu.org> Wrote on Tue, 15 Oct 2024 15:18:10 +0300 >> Date: Tue, 15 Oct 2024 10:16:33 +0530 (IST) >> From: Madhu [re: savehist for ielm history] >> I think that part is covered. if you see the top of ~/.emacs.d/history >> the coding system is specified, the savehist-coding-system mechanism >> takes care of this to you. But I haven't tried this idea out yet (to >> see the interactions with comint). > > The problem, AFAIU, is not the specification of the encoding when the > file is written, the problem is to select the right encoding to begin > with. utf-8-emacs-unix is how characters are represented in Emacs > internally, so it by definition can encode any character in the > history; this is not true for any other encoding. I believe this > issue was what prevented you from existing Emacs, the issue you > described in your original post. Apologies if I misunderstood. The point I wanted to make was that savehist-save binds coding-system-for-write (to 'utf-8-unix) and this seems to work without throwing a "coding system error". 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. 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. (Also I think I forgot to mention the code in ielm-mode presently sets kill-buffer-hook to a function rather than adding the function to the hook variable)