From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.devel Subject: Re: ielm automatic saving of history -- bug 67000 Date: Mon, 14 Oct 2024 08:23:09 +0200 Message-ID: <878qurkxte.fsf@gmail.com> References: <86v7xwtu3i.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2007"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Madhu , Simen =?utf-8?Q?Heggest=C3=B8yl?= , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 14 08:24:29 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 1t0EVI-0000PO-7I for ged-emacs-devel@m.gmane-mx.org; Mon, 14 Oct 2024 08:24:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t0EUQ-0000q2-E7; Mon, 14 Oct 2024 02:23:34 -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 1t0EU8-0000oh-Iz for emacs-devel@gnu.org; Mon, 14 Oct 2024 02:23:16 -0400 Original-Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t0EU6-00009t-JJ; Mon, 14 Oct 2024 02:23:16 -0400 Original-Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a99b1f43aceso521336666b.0; Sun, 13 Oct 2024 23:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728886992; x=1729491792; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=X0JX3NP8p10CMRVZiNMzWFrcbCAUnj78Wm+Jv1f/RyI=; b=SN7oU8gv40VWobWGxgSeuWwpYtBKOv/7GXIIUTgmPOYgZiYq+dCX64uyMaol0Zu0UX usAXgkdvhaW2xJlPvZfoXE93MzjP17OylbQaGQMx/+lKJAFPaEC9D1WkTfKvWBC/Ba5S AcemP47mGrMGphSKz+gxNaENS+RBY6d4b+FHGLNei3a+T54RN5lYTcspmhueAswlLEGr VdSRkmZuks7NQZI0bE+NMIUkVvx9OyE7Sduc/35smx0N1CZVkq1zr21e/n0cZ0VdgZRM 6mTFwqqEG05e+Dcf56Mw2iaTWfDki3aumKhlMkVcHYGplBgojNWZGKOAOWaz1YaY2ihV j+5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728886992; x=1729491792; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=X0JX3NP8p10CMRVZiNMzWFrcbCAUnj78Wm+Jv1f/RyI=; b=cARHY9ciFR5YOd1NBqJM3yUF7bda3TjB84mar3gfsKNH8iAU+KLg+eIKj7ybChcOeU AFB4xOjmJcCfPxXRdMrzfBIt0pxDSzu0S+KEMzabuPwH2fPb1ikKvel+hsWvRndc22d3 5G0yexxYj9Yocz50WANMEA5yAWfDourkXpo49PE5qNZyy9kcJvfsA4IjJ1TN5w5IRNsA 2AGGAcCWicDBnWfNljYsQ98B/iVk2fEB+3vXGtoxhytkIS46xlr8vgpjlQd2AE43Sjq3 TR+yMtNIYx5knOGvmTl/hh61v8bodGNYVY+2xbqwYTsNpwEXVYIu4IPY9Q7P7X3n9s9Y LgkA== X-Forwarded-Encrypted: i=1; AJvYcCVhV4YxDc0bxmU7aGBL0fQxU3iKs4YzaonwmjkBRXSMQFFxKlEi8sTDejjSvhstq14DlFjFDeefa2lHzQ==@gnu.org X-Gm-Message-State: AOJu0YwHMj9Jx4ue046z5aCJ+1hWcrNUW6nl0H0CxwYRE3HIX+KuDAQA zGYQR8XBnpenAwliLWY9zuNVzwKAcWl+jU63rKaPc1boa0pKDRw7+w0Dag== X-Google-Smtp-Source: AGHT+IE7fNRnf3UyTRFNVDL6UcFHNDs28axhxmKcnFvfk+/AzOPFBf9xljKZLVSTUrBwzcZJm4imLQ== X-Received: by 2002:a17:907:ea9:b0:a99:f5d8:726 with SMTP id a640c23a62f3a-a99f5d80ac6mr463357266b.23.1728886991643; Sun, 13 Oct 2024 23:23:11 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8a87:ff00::d6f6]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a1572a75esm43526766b.174.2024.10.13.23.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 23:23:10 -0700 (PDT) In-Reply-To: <86v7xwtu3i.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 13 Oct 2024 09:06:25 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=arstoffel@gmail.com; helo=mail-ej1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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:324559 Archived-At: On Sun, 13 Oct 2024 at 09:06, Eli Zaretskii wrote: >> personally I've used code (derived from sly so not probably fsf license) >> in ielm-mode-hook to set up merge and save multiline forms using comint, >> I'm attaching this file here, for reference. However the currenlty >> installed implementation in (inferior-emacs-lisp-mode) does not play >> well with the this: It unconditionally touches comint history variables, >> my code also has to set the comint variables to use the comint history >> mechanism, and these are picked up with exit hooks. >> >> Maybe others using the facility will have some opinions on this. My own >> takeaway is it is not desirable to 1) force history saving mechanisms 2) >> use opaque closures for implementing hook functions. > > Simen, any comments or suggestions? This feature is new in Emacs 30, > so it isn't too late to improve it before we release Emacs 30.1. I have a different suggestion. I think IELM should use savehist-mode to preserve its history. When loading ielm.el: (cl-pushnew 'ielm-history savehist-minibuffer-history-variables) When starting an IELM buffer: (setq comint-input-ring (make-ring comint-input-ring-size)) (dolist (cmd (take comint-input-ring-size ielm-history)) (ring-insert-at-beginning comint-input-ring cmd)) After each evaluation: (add-to-history 'ielm-history code comint-input-ring-size) I use this approach in my dREPL package and it works nicely. One advantage (in my opinion) is that there is new configuration variable to discover and set; IELM history would be preserved if and only if the user enabled savehist-mode.