all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Augusto Stoffel <arstoffel@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Madhu <enometh@meer.net>,
	"Simen Heggestøyl" <simenheg@runbox.com>,
	emacs-devel@gnu.org
Subject: Re: ielm automatic saving of history -- bug 67000
Date: Mon, 14 Oct 2024 08:23:09 +0200	[thread overview]
Message-ID: <878qurkxte.fsf@gmail.com> (raw)
In-Reply-To: <86v7xwtu3i.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 13 Oct 2024 09:06:25 +0300")

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.



  parent reply	other threads:[~2024-10-14  6:23 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 [this message]
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
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878qurkxte.fsf@gmail.com \
    --to=arstoffel@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=enometh@meer.net \
    --cc=simenheg@runbox.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.