From: Stefan Kangas <stefankangas@gmail.com>
To: "Simen Heggestøyl" <simenheg@runbox.com>
Cc: 67000@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history
Date: Mon, 8 Jan 2024 11:51:39 -0800 [thread overview]
Message-ID: <CADwFkmmBXn2eYvKUmXMnc5LejAKo3k2dn4mOT_aaRZ44E2zQoA@mail.gmail.com> (raw)
In-Reply-To: <87y1d0p9ic.fsf@runbox.com>
Simen Heggestøyl <simenheg@runbox.com> writes:
> From a2322770acb6bceab36224989cbbe9b777312997 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= <simenheg@runbox.com>
> Date: Wed, 8 Nov 2023 16:08:08 +0100
> Subject: [PATCH] Add support for reading/writing IELM input history
>
> * lisp/ielm.el (inferior-emacs-lisp-mode): Add support for
> reading/writing input history.
> (ielm--history-file-name): Name of the file to read/write IELM input
> history.
> ---
> etc/NEWS | 5 +++++
> lisp/ielm.el | 12 ++++++++++++
> 2 files changed, 17 insertions(+)
>
> diff --git a/etc/NEWS b/etc/NEWS
> index c3d777b971f..b62976143d2 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -1228,6 +1228,11 @@ chat buffers use by default.
> *** New command 'customize-dirlocals'.
> This command pops up a buffer to edit the settings in ".dir-locals.el".
>
> +** IELM
> +
> +---
> +*** IELM now remembers input history between sessions.
> +
> \f
> * New Modes and Packages in Emacs 30.1
>
> diff --git a/lisp/ielm.el b/lisp/ielm.el
> index 777aebb70cf..6d4a11c1c28 100644
> --- a/lisp/ielm.el
> +++ b/lisp/ielm.el
> @@ -152,6 +152,10 @@ ielm-header
> \\[describe-mode] for help.\n"
> "Message to display when IELM is started.")
>
> +(defvar ielm--history-file-name
> + (locate-user-emacs-file "ielm-history.eld")
> + "Name of the file to read/write IELM input history.")
On closer thought, I think this should be a defcustom.
See `lua-ts-inferior-history' and `sql-input-ring-file-name' for
example.
I also think nil might as well be a valid value which disables history
altogether (maybe users don't want that for some reason, let's say
privacy or whatever).
And the defcustom should be mentioned in NEWS, too.
> (defvaralias 'inferior-emacs-lisp-mode-map 'ielm-map)
> (defvar-keymap ielm-map
> :doc "Keymap for IELM mode."
> @@ -605,6 +609,11 @@ inferior-emacs-lisp-mode
> #'ielm-indirect-setup-hook 'append t)
> (setq comint-indirect-setup-function #'emacs-lisp-mode)
>
> + ;; Input history
> + (setq-local comint-input-ring-file-name ielm--history-file-name)
> + (setq-local kill-buffer-hook #'comint-write-input-ring)
> + (comint-read-input-ring t)
> +
> ;; A dummy process to keep comint happy. It will never get any input
> (unless (comint-check-proc (current-buffer))
> ;; Was cat, but on non-Unix platforms that might not exist, so
> @@ -631,6 +640,9 @@ inferior-emacs-lisp-mode
> (set-marker comint-last-input-start (ielm-pm))
> (set-process-filter (get-buffer-process (current-buffer)) 'comint-output-filter)))
>
> +(unless noninteractive
> + (add-hook 'kill-emacs-hook #'comint-write-input-ring))
> +
I'm not so sure about this part. If this is correct, why should it be
defined here, and not, say, in comint.el? It seems like a separate,
unrelated change. What am I missing?
> (defun ielm-get-old-input nil
> ;; Return the previous input surrounding point
> (save-excursion
> --
> 2.39.2
next prev parent reply other threads:[~2024-01-08 19:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-08 15:11 bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Simen Heggestøyl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-15 1:06 ` Stefan Kangas
2024-01-04 7:46 ` Simen Heggestøyl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-05 20:17 ` Stefan Kangas
2024-01-08 7:30 ` Simen Heggestøyl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-08 19:51 ` Stefan Kangas [this message]
2024-01-12 16:09 ` Simen Heggestøyl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-13 7:08 ` Stefan Kangas
2024-01-19 7:48 ` Simen Heggestøyl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-28 15:09 ` Stefan Kangas
2024-02-07 14:02 ` Simen Heggestøyl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-10 11:28 ` Stefan Kangas
2024-02-15 7:53 ` Simen Heggestøyl via Bug reports for GNU Emacs, the Swiss army knife of text editors
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=CADwFkmmBXn2eYvKUmXMnc5LejAKo3k2dn4mOT_aaRZ44E2zQoA@mail.gmail.com \
--to=stefankangas@gmail.com \
--cc=67000@debbugs.gnu.org \
--cc=eliz@gnu.org \
--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.