[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ielm automatic saving of history -- bug 67000
From: |
Madhu |
Subject: |
Re: ielm automatic saving of history -- bug 67000 |
Date: |
Thu, 17 Oct 2024 07:34:04 +0530 (IST) |
* Simen Heggestøyl <simenheg@runbox.com> <877ca8vv59.fsf@runbox.com>
Wrote on Wed, 16 Oct 2024 19:02:10 +0200
> I don't have time to devote to this issue on the short term (that is,
> before the release of Emacs 30.1). However I see that the discussion has
> carried on since you sent me this question. It would be good if you find
> a way to improve it enough in time to ship with Emacs 30.1, otherwise
> reverting my commit is also fine, and I may have the time to help
> improve the feature for a later release.
I am attaching a patch (not fully tested) where I tried to fix the
most important issues with the history mechanism. Perhaps Eli could
review and commit parts of as he sees fit (maybe dropping the change
to the default value). btw I don't think it is possible to stick file
local variables into the file read by comint-read-input-ring
Or alternatively maybe bug67000 should be reopened and this should be
continued there. -- Best Regards. Madhu
>From fe78a75cc3d322b3b8f2df24d50dca1b1216d894 Mon Sep 17 00:00:00 2001
From: Madhu <enometh@net.meer>
Date: Fri, 11 Oct 2024 21:16:46 +0530
Subject: [PATCH] fix some issues in the persistent ielm history mechanism
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
this fixes some issues in commit 60cff1ac9d21. (bug 67000)
* lisp/elm.el: (ielm-history-file-name): initially
nil. (inferior-emacs-lisp-mode): do not invoke the machinery at all if
ielm-history-file-name is nil. use add-hook on kill-buffer-hook instead
of replacing kill-buffer-hook. bind coding-system-for-read around call
to comint-read-input-ring. (ielm-input-history-writer): bind
coding-system-on-write around call to comint-write-input-ring.
---
lisp/ielm.el | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/lisp/ielm.el b/lisp/ielm.el
index f62db7510de..000ba48ba68 100644
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -111,7 +111,8 @@ ielm-dynamic-multiline-inputs
:type 'boolean)
(defcustom ielm-history-file-name
- (locate-user-emacs-file "ielm-history.eld")
+ (if t nil
+ (locate-user-emacs-file "ielm-history.eld"))
"If non-nil, name of the file to read/write IELM input history."
:type '(choice (const :tag "Disable input history" nil)
file)
@@ -520,7 +521,9 @@ ielm--input-history-writer
"Return a function writing IELM input history to BUF."
(lambda ()
(with-current-buffer buf
- (comint-write-input-ring))))
+ (let ((coding-system-for-write 'utf-8-emacs-unix))
+ ;; cannot add a file-local section when using comint.
+ (comint-write-input-ring)))))
;;; Major mode
@@ -623,17 +626,19 @@ inferior-emacs-lisp-mode
(add-hook 'comint-indirect-setup-hook
#'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 ielm--exit (ielm--input-history-writer (current-buffer)))
- (setq-local kill-buffer-hook
+ (when ielm-history-file-name
+ ;; Input history
+ (setq-local comint-input-ring-file-name ielm-history-file-name)
+ (setq-local ielm--exit (ielm--input-history-writer (current-buffer)))
+ (add-hook 'kill-buffer-hook
(lambda ()
(funcall ielm--exit)
- (remove-hook 'kill-emacs-hook ielm--exit)))
- (unless noninteractive
- (add-hook 'kill-emacs-hook ielm--exit))
- (comint-read-input-ring t)
+ (remove-hook 'kill-emacs-hook ielm--exit))
+ nil t)
+ (unless noninteractive
+ (add-hook 'kill-emacs-hook ielm--exit))
+ (let ((coding-system-for-read 'utf-8-unix))
+ (comint-read-input-ring t)))
;; A dummy process to keep comint happy. It will never get any input
(unless (comint-check-proc (current-buffer))
--
2.46.0.27.gfa3b914457
- Re: ielm automatic saving of history -- bug 67000, (continued)
- Re: ielm automatic saving of history -- bug 67000, Eli Zaretskii, 2024/10/14
- Re: ielm automatic saving of history -- bug 67000, Madhu, 2024/10/15
- Re: ielm automatic saving of history -- bug 67000, Eli Zaretskii, 2024/10/15
- Re: ielm automatic saving of history -- bug 67000, Madhu, 2024/10/15
- Re: ielm automatic saving of history -- bug 67000, Eli Zaretskii, 2024/10/15
- Re: ielm automatic saving of history -- bug 67000, Madhu, 2024/10/16
- Re: ielm automatic saving of history -- bug 67000, Eli Zaretskii, 2024/10/16
- Re: ielm automatic saving of history -- bug 67000, Madhu, 2024/10/16
- Re: ielm automatic saving of history -- bug 67000, Eli Zaretskii, 2024/10/16
Re: ielm automatic saving of history -- bug 67000, Simen Heggestøyl, 2024/10/16
- Re: ielm automatic saving of history -- bug 67000,
Madhu <=