unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history
@ 2023-11-08 15:11 Simen Heggestøyl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-12-15  1:06 ` Stefan Kangas
  0 siblings, 1 reply; 13+ messages in thread
From: Simen Heggestøyl via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-11-08 15:11 UTC (permalink / raw)
  To: 67000

[-- Attachment #1: Type: text/plain, Size: 87 bytes --]

Attached is a proposed patch that adds input history read/write
capabilities to IELM.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-support-for-reading-writing-IELM-input-history.patch --]
[-- Type: text/x-diff, Size: 1869 bytes --]

From 190a88ae55bb4a47de64cb50f2706798a100704b 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.
---
 lisp/ielm.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lisp/ielm.el b/lisp/ielm.el
index e51c46054b4..618cd033055 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.el")
+  "Name of the file to read/write IELM input history.")
+
 (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))
+
 (defun ielm-get-old-input nil
   ;; Return the previous input surrounding point
   (save-excursion
-- 
2.39.2


[-- Attachment #3: Type: text/plain, Size: 10 bytes --]


-- Simen

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-02-15  7:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).