emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ielm automatic saving of history -- bug 67000


From: Augusto Stoffel
Subject: Re: ielm automatic saving of history -- bug 67000
Date: Mon, 14 Oct 2024 08:23:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]