From unknown Thu Sep 11 23:18:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Nov 2023 15:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 67000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 67000@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.169945636914239 (code B ref -1); Wed, 08 Nov 2023 15:13:01 +0000 Received: (at submit) by debbugs.gnu.org; 8 Nov 2023 15:12:49 +0000 Received: from localhost ([127.0.0.1]:46126 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0kEa-0003hb-MG for submit@debbugs.gnu.org; Wed, 08 Nov 2023 10:12:48 -0500 Received: from lists.gnu.org ([2001:470:142::17]:38590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0kEX-0003hO-Ta for submit@debbugs.gnu.org; Wed, 08 Nov 2023 10:12:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0kDp-0000rO-M6 for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 10:12:01 -0500 Received: from mailtransmit05.runbox.com ([2a0c:5a00:149::26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0kDl-0006nk-Bs for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 10:12:01 -0500 Received: from mailtransmit02.runbox ([10.9.9.162] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1r0kDT-00Fzs5-9O for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 16:11:39 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector2; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=NRwvg5BW2bCzz/IUBisE4ebxmTk9NGrnSW/eMn8exZU=; b=hYE05oSDyr3Ktlao0Y+a9eFgL mHDb9ArIp8bTnk7oZhMvRFWf8KSBMZMeXx0Dy2CiwhhBCrLyULsk2pzlZljQ+6DOUrGkblm+TeijO 2WpfsNF/rYrlrakUQVW8Ewwo3GPxC+6hANIL3qJyqQQjPwfx8FUMWXP1KqAbeMMxsjl32NUja5MC/ OzvVtY6hYsfJKhDKC1axq2dv8hkYw5+Jn3sQiOTjiTFdeOhbWr1VEpgXeoE9vghOukEfHFZzZTB43 x1e0ThDXyOth5pWtGajf2NemdguGVs50cWzFLqPjWRHOqgSewbzzWcSzPhBXClSKilg4R+oYAUBlh kfLj+bRqA==; Received: from [10.9.9.73] (helo=submission02.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1r0kDR-00023p-3D for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 16:11:38 +0100 Received: by submission02.runbox with esmtpsa [Authenticated ID (963757)] (TLS1.2:ECDHE_SECP256R1__RSA_SHA256__AES_256_GCM:256) (Exim 4.93) id 1r0kDG-000OjY-T4 for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 16:11:26 +0100 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Date: Wed, 08 Nov 2023 16:11:25 +0100 Message-ID: <87sf5ge0v6.fsf@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a0c:5a00:149::26; envelope-from=simenheg@runbox.com; helo=mailtransmit05.runbox.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 2.9 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Attached is a proposed patch that adds input history read/write capabilities to IELM. From 190a88ae55bb4a47de64cb50f2706798a100704b Mon Sep 17 00:00:00 2001 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Date: Wed, 8 Nov 2023 16:08:08 +0100 Subject: [PATCH] Add support for reading/writing [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (simenheg[at]runbox.com) 0.9 SPF_FAIL SPF: sender does not match SPF record (fail) [SPF failed: Please see http://www.openspf.org/Why?s=mfrom; id=simenheg%40runbox.com; ip=2001%3A470%3A142%3A%3A17; r=debbugs.gnu.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 2.0 SPOOFED_FREEMAIL No description available. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Attached is a proposed patch that adds input history read/write capabilities to IELM. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-support-for-reading-writing-IELM-input-history.patch >From 190a88ae55bb4a47de64cb50f2706798a100704b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= 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 --=-=-= Content-Type: text/plain -- Simen --=-=-=-- From unknown Thu Sep 11 23:18:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Dec 2023 01:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= , 67000@debbugs.gnu.org Received: via spool by 67000-submit@debbugs.gnu.org id=B67000.17026023797608 (code B ref 67000); Fri, 15 Dec 2023 01:07:02 +0000 Received: (at 67000) by debbugs.gnu.org; 15 Dec 2023 01:06:19 +0000 Received: from localhost ([127.0.0.1]:51299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDweh-0001yd-5Q for submit@debbugs.gnu.org; Thu, 14 Dec 2023 20:06:19 -0500 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]:43172) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDwee-0001yN-G5 for 67000@debbugs.gnu.org; Thu, 14 Dec 2023 20:06:17 -0500 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-551ee7d5214so2414402a12.0 for <67000@debbugs.gnu.org>; Thu, 14 Dec 2023 17:06:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702602371; x=1703207171; darn=debbugs.gnu.org; h=content-transfer-encoding:to:subject:message-id:date:mime-version :references:in-reply-to:from:from:to:cc:subject:date:message-id :reply-to; bh=kF/fRxZip0xbzU072m2tH1OQefwtMGvRn7zI15b5TyM=; b=G3WOnztOz7mLT2rHFaYt8DaXqMEWPtrr8V/t/e1bpvyPWFbeqbTD8dAGKp9YqxUFDG GQbFRsvdPjdVSrSH1EREPDQfi6mkG8UTupcae0lcWWzO2LasQunv0vrK2wZjgTy4JZsI 5hbSwLh3AcCTAtjFGw9+YNj8Jh01Bu3C8jt0k5Fz+zcgAnDPeteaPj8i28rWLhiHq7BT jjtiQG8XG2xFTGW6hM82jZGAvROsqPiR6hlHUIfs5SUFoHYiXay8zFAJOzaasi9tep5S Ncf/xSPtK4gbkn3466ZmJb0p300JR927NVXOG4aw1KERrdly258G6yIEmCY+GtLjB37s sf5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702602371; x=1703207171; h=content-transfer-encoding:to:subject:message-id:date:mime-version :references:in-reply-to:from:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=kF/fRxZip0xbzU072m2tH1OQefwtMGvRn7zI15b5TyM=; b=C6tysvuuwq8ByvOLW7sfkGjuvFuwEH3C/FRMYFr+1+KOanMGA2TfgLkz+dGW8Zyurm x10pTsL7Sc2N+LM5E2STENB4O6NFSdnhOM4DLFhiFsBh9YvA9Ix5SGZ8Vozs2S9DaT5q Aryv7P0dC/4JjeAUYYio411Lg+mQHMxmpsimCKfO9awRWXKgkoNcv956BEd8J2bcZoHU bh5dGIUfEqljOEoeXdBA9Q7YQwb5J4P5o+4f7DoiM/eWed6HWxcNPMS02ztK12Gwm45B jgkmySwP3JsG9MZdHZpX2iEv/8yL/F3HiN6Z+LIRx1WS2oQXOrQoYhUXwgHucz5g4oXS UvBQ== X-Gm-Message-State: AOJu0Yy9PNHlM1H1I58GkUkLahu4dVaip6moH6EfWxLyghKnjm3UHWrM m8gxgUgtROLxjtF2nIgCKJJjsaZeCRA/lC2LfbhCBSCadpbm1A== X-Google-Smtp-Source: AGHT+IEwxU0z4Zt6ll854yMk3PaSDHGdpjI5H4IRZGvibrHDDFDOIrPtk+X4TGOx5eAPpF5qPbf3VJHGau7ZB5WLQrs= X-Received: by 2002:a17:906:6a18:b0:a1d:bef8:cea9 with SMTP id qw24-20020a1709066a1800b00a1dbef8cea9mr14636312ejc.29.1702602370941; Thu, 14 Dec 2023 17:06:10 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 14 Dec 2023 17:06:10 -0800 From: Stefan Kangas In-Reply-To: <87sf5ge0v6.fsf@runbox.com> References: <87sf5ge0v6.fsf@runbox.com> MIME-Version: 1.0 Date: Thu, 14 Dec 2023 17:06:10 -0800 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Simen Heggest=C3=B8yl via "Bug reports for GNU Emacs, the Swiss army knife = of text editors" writes: > Attached is a proposed patch that adds input history read/write > capabilities to IELM. Thanks. This feature makes sense to me. - This should be called out in NEWS. - Does it need any other documentation changes? - Do we usually provide options to disable this stuff? > From 190a88ae55bb4a47de64cb50f2706798a100704b Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Simen=3D20Heggest=3DC3=3DB8yl?=3D > 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") Shouldn't that be .eld? > + "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-ou= tput-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 > > > -- Simen From unknown Thu Sep 11 23:18:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 04 Jan 2024 07:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas Cc: 67000@debbugs.gnu.org Received: via spool by 67000-submit@debbugs.gnu.org id=B67000.170435439325296 (code B ref 67000); Thu, 04 Jan 2024 07:47:02 +0000 Received: (at 67000) by debbugs.gnu.org; 4 Jan 2024 07:46:33 +0000 Received: from localhost ([127.0.0.1]:53564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLIQy-0006Ys-IH for submit@debbugs.gnu.org; Thu, 04 Jan 2024 02:46:33 -0500 Received: from mailtransmit04.runbox.com ([2a0c:5a00:149::25]:35306) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLIQp-0006Lc-M6 for 67000@debbugs.gnu.org; Thu, 04 Jan 2024 02:46:31 -0500 Received: from mailtransmit02.runbox ([10.9.9.162] helo=aibo.runbox.com) by mailtransmit04.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1rLIQd-001mln-Nm for 67000@debbugs.gnu.org; Thu, 04 Jan 2024 08:46:11 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector1; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From; bh=HISgdEG8zPpUYEtQY+VtWR7KGfoCmFUR+AHxvdo/iro=; b=VpNIVM7sDgNGbfm4IkZ8W6LxWP Hqux+Q+QcLljcfwZIONwsv0MLEsJ8BQOsfNkQ96+4v3DE2TIeetY54dwQGjP4GH5PCJPjAPQZDEjE tUQeaqYckq8iZusce52r1fXMYBpBxnPOfDeVlpRgCDC0Ff9q9bMdE/426Y7saE4M2jP0C8uMIsMht wIMb+gZ2nQcGLAWg8pYNHmokD4s0vfVhfR7ajKdyLYvIgz6trf+hRERVD5YEz4gY9jiWYXZj7Z6Nl 38A37f0u69r3o3Dh3mMj4D05/H2TF0lcqyt+qQenF9d6N6wkUZDE9jCPcFlZSvPfDCc456dgVONLE 6oAaiCTw==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1rLIQd-0005zX-7d; Thu, 04 Jan 2024 08:46:11 +0100 Received: by submission03.runbox with esmtpsa [Authenticated ID (963757)] (TLS1.2:ECDHE_SECP256R1__RSA_SHA256__AES_256_GCM:256) (Exim 4.93) id 1rLIQc-00AWxF-6n; Thu, 04 Jan 2024 08:46:10 +0100 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= In-Reply-To: (Stefan Kangas's message of "Thu, 14 Dec 2023 17:06:10 -0800") References: <87sf5ge0v6.fsf@runbox.com> Date: Thu, 04 Jan 2024 08:46:09 +0100 Message-ID: <87a5pl1qym.fsf@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain Hi Stefan, thank you for your response. Stefan Kangas writes: > - This should be called out in NEWS. Yup, done in the revised patch attached. > - Does it need any other documentation changes? I don't think so; IELM is only mentioned briefly in the Emacs manual. > - Do we usually provide options to disable this stuff? Not as far as I can tell. >> +(defvar ielm--history-file-name >> + (locate-user-emacs-file "ielm-history.el") > > Shouldn't that be .eld? Hm, the file will contain actual Lisp expressions, so I'd think that .el is fitting? -- Simen --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-support-for-reading-writing-IELM-input-history.patch >From 3ac85190a90fd85bb7a960cd4895c3bd4e41b085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= 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 1cdb12c3958..f65d53e4827 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1216,6 +1216,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. + * New Modes and Packages in Emacs 30.1 diff --git a/lisp/ielm.el b/lisp/ielm.el index 777aebb70cf..46a2a1799da 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 --=-=-=-- From unknown Thu Sep 11 23:18:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Jan 2024 20:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 67000@debbugs.gnu.org, Eli Zaretskii Received: via spool by 67000-submit@debbugs.gnu.org id=B67000.170448586124527 (code B ref 67000); Fri, 05 Jan 2024 20:18:01 +0000 Received: (at 67000) by debbugs.gnu.org; 5 Jan 2024 20:17:41 +0000 Received: from localhost ([127.0.0.1]:58004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLqdR-0006NX-J3 for submit@debbugs.gnu.org; Fri, 05 Jan 2024 15:17:41 -0500 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]:50452) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLqdP-0006NJ-5K for 67000@debbugs.gnu.org; Fri, 05 Jan 2024 15:17:40 -0500 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-55569b59f81so2286156a12.1 for <67000@debbugs.gnu.org>; Fri, 05 Jan 2024 12:17:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704485849; x=1705090649; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=lLD+4BcL10ppBaSP7AIy4XDhPBcEyzBUaUWSjG+duhg=; b=ewlntPpeFu9OTAp/EjhFqmFTqyghrZej/NOOYFxWFuKj8z8XMgXtTloGTJOl5L4/hY xgdsNIRRd7ZMVaz3Te53TmblAZak5Xej5J/g4q4k38EdHtkOa+7mnDV85Bl9InBE5c9/ ut3l0n6Updswg6zJPun/06UVjUUYQ+RdA0bJNplpKWMPGDJsixawVw2O29Ghb5VuqvKW nay3tlrqdiW9ERubsiJT0eIWDtDa2+lfj0r6YcBXe6U4EJgvM6B3EKy+DKo+R9mjW32t cQzJ9qU4fLSNsOI8ueJ44/MLM0f2ik7fhw2NKU1Fc2mXvErOBNjwzR9QyVUFvaYAvO8J MiYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704485849; x=1705090649; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=lLD+4BcL10ppBaSP7AIy4XDhPBcEyzBUaUWSjG+duhg=; b=a9fT/A3Ok/9ElVOjNIN8M1zBnehP4DFwG+K+ad9uN5A4Xyzz/dJSDNErH1VkbaNI2T ogG5+M5ZZs46280WkyzV9/ESYW1fLCFYP2MHZ+A27Xe06FpzjabxQHfmuotjzQOgRz94 rDfUNOltfs+pVQtbdrhCIvspoAyE2Nm4ntOdt4qNS3NkkBofwcBkqIbsklJ5RuxFrofT 2WZoVnxLf9PKZxctcjU735cr3iQJgV+EpXUj5Mdmk+XqOfVWJAX/LN/EPEoQ+ouFxFTb JNIWiDbUJm07Kj8aG/zG/6W50Y3eDTGXl7d6wYXpLFRs912eletk+dCOjpmb6NjVy8XV jomQ== X-Gm-Message-State: AOJu0Yy6HX/fWq8T0MySx2Y04DLniuDeVcd3etEtVdzQfq2O0dZ1MWkK MUVuXLvMZ686AAm2h6PmK2/yDMSFHJwneuTPh+k= X-Google-Smtp-Source: AGHT+IGzoBGediDCtYwjHDC3RxniSl8cVsPU/DpaQH6A8g/a1J56OyPs9XuuCkNp1qYbyeGUCjMZ+toE1H6pAVOlOyw= X-Received: by 2002:a50:d757:0:b0:54c:4837:8b6e with SMTP id i23-20020a50d757000000b0054c48378b6emr1401586edj.60.1704485848858; Fri, 05 Jan 2024 12:17:28 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 5 Jan 2024 12:17:28 -0800 From: Stefan Kangas In-Reply-To: <87a5pl1qym.fsf@runbox.com> References: <87sf5ge0v6.fsf@runbox.com> <87a5pl1qym.fsf@runbox.com> MIME-Version: 1.0 Date: Fri, 5 Jan 2024 12:17:28 -0800 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Simen Heggest=C3=B8yl writes: >>> +(defvar ielm--history-file-name >>> + (locate-user-emacs-file "ielm-history.el") >> >> Shouldn't that be .eld? > > Hm, the file will contain actual Lisp expressions, so I'd think that .el > is fitting? I'm not so sure. We don't really intend for users to use it the way you'd expect from an .el file, like byte-compiling or loading it. So while these are, hopefully, valid Lisp expressions (barring typos, which frequently happens at a REPL), it's not really a file containing meaningful code either. From unknown Thu Sep 11 23:18:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Jan 2024 07:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas Cc: 67000@debbugs.gnu.org, Eli Zaretskii Received: via spool by 67000-submit@debbugs.gnu.org id=B67000.17046990654050 (code B ref 67000); Mon, 08 Jan 2024 07:32:01 +0000 Received: (at 67000) by debbugs.gnu.org; 8 Jan 2024 07:31:05 +0000 Received: from localhost ([127.0.0.1]:34875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMk6C-00012U-CE for submit@debbugs.gnu.org; Mon, 08 Jan 2024 02:31:05 -0500 Received: from mailtransmit05.runbox.com ([2a0c:5a00:149::26]:40472) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMk69-0000pR-ER for 67000@debbugs.gnu.org; Mon, 08 Jan 2024 02:31:02 -0500 Received: from mailtransmit02.runbox ([10.9.9.162] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1rMk5x-00A1vC-BX; Mon, 08 Jan 2024 08:30:49 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector1; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From; bh=Yo4AzCBoN4zS205zf1IFo/JmznbDLSsH6f41cKCmR2s=; b=IrDb4+w0daEPZ1QCmSlzWt+Rpw MpOH0IBasjFMGMHfTTpN81RwpOIKsY0VOTirfPo4Pj+NDZwq8kpireqwUTxfXj18fU167Ea8qcH5K kbeGHl4dMgHEhBt99Jizygh/xdxex/y4IjqoEbAPQSboV4rGUPd51WGUoRJRzVOnGhaUQ3Hg59hoZ N5BZirgLLQLUHFbWGJbTWOSOTeLsikkhQPMJjgT7I0q7wK5vVIxaMh6kEMWJdCOOsFOhSNozZC0VQ JIMpb4RNVIVYaCZX66U5HS0yMPl3YtkHGqIyqYpZO4aJi0M6Ku8xKA6+fpUHMpIg0VF0TZPervyJn CtOjn9Hg==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1rMk5w-0007tQ-UY; Mon, 08 Jan 2024 08:30:49 +0100 Received: by submission03.runbox with esmtpsa [Authenticated ID (963757)] (TLS1.2:ECDHE_SECP256R1__RSA_SHA256__AES_256_GCM:256) (Exim 4.93) id 1rMk5k-00GYVJ-Ch; Mon, 08 Jan 2024 08:30:36 +0100 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= In-Reply-To: (Stefan Kangas's message of "Fri, 5 Jan 2024 12:17:28 -0800") References: <87sf5ge0v6.fsf@runbox.com> <87a5pl1qym.fsf@runbox.com> Date: Mon, 08 Jan 2024 08:30:35 +0100 Message-ID: <87y1d0p9ic.fsf@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Stefan Kangas writes: > Simen Heggest=C3=B8yl writes: > >>>> +(defvar ielm--history-file-name >>>> + (locate-user-emacs-file "ielm-history.el") >>> >>> Shouldn't that be .eld? >> >> Hm, the file will contain actual Lisp expressions, so I'd think that .el >> is fitting? > > I'm not so sure. We don't really intend for users to use it the way > you'd expect from an .el file, like byte-compiling or loading it. > > So while these are, hopefully, valid Lisp expressions (barring typos, > which frequently happens at a REPL), it's not really a file containing > meaningful code either. Okay, fair points. Updated patch attached! -- Simen --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-support-for-reading-writing-IELM-input-history.patch >From a2322770acb6bceab36224989cbbe9b777312997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= 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. + * 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.") + (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 --=-=-=-- From unknown Thu Sep 11 23:18:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Jan 2024 19:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 67000@debbugs.gnu.org, Eli Zaretskii Received: via spool by 67000-submit@debbugs.gnu.org id=B67000.170474351524360 (code B ref 67000); Mon, 08 Jan 2024 19:52:02 +0000 Received: (at 67000) by debbugs.gnu.org; 8 Jan 2024 19:51:55 +0000 Received: from localhost ([127.0.0.1]:37661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMvf8-0006Kp-RV for submit@debbugs.gnu.org; Mon, 08 Jan 2024 14:51:55 -0500 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]:44082) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMvf7-0006Kc-AU for 67000@debbugs.gnu.org; Mon, 08 Jan 2024 14:51:54 -0500 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2cd0f4797aaso23534191fa.0 for <67000@debbugs.gnu.org>; Mon, 08 Jan 2024 11:51:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704743501; x=1705348301; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=/buqsVkuX87v+hbzr0NrI/s574kCG5JWExYyaYwyCN8=; b=Q3/q3jDFT0ErWWANAJqM+jpCzPN2Vupb6k5SSOz5zTXuWVQSHOH5gbW1Sdzfl56Ay+ QneY+SB2A7eTOEZl8k7dx5ThsACuNND9vukqDGSLbu/JHz/JNxUl5pszokWX9b0vmwjZ hX8HOCV+PZwCTNI+4t6JQQxVsWrtQw7YNoZNAW1L4GZ9ZIB3rDnXGgjSsnDv+NP8YogY QHfk5kwXSt3CspzZalyuU4ucj0IM/s9m057wyKH2CXb6PoHTljsDsig1qxxgx20hPpFF JJo/59FIU8gIjZwt/JJh+8agmR8Jf9uLZAFyYsn5vZCZHGI7M6r7wtiCpRmndveNFX8l AZVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704743501; x=1705348301; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=/buqsVkuX87v+hbzr0NrI/s574kCG5JWExYyaYwyCN8=; b=cag6gmrkbNadt28TpTwsnIW4isRLoH+TGk47N+hVvMkhkVG58z/pNE5KVI96WHY9lk 8oKEJpOnPWcYeLsICRGERwfC6omoLsDghwkfGyisIw4NRGCG//GKHJ1udszWO53ZlwIP MWadCfbf1TB9CVhbh3sPdInKrk2Y8DpdcO7uR7+x+rKDiP0sAysml97B70XMSntFpxek V5O+cyRgRopDwPwyLyaZLzygeJl890ARhvc1V71fFQi59QZTCfxTvUSuHQykYPgDYPVi FFYDClSAzk3/TdTtO3HHeyp5wnA/CkreAd5eaOC2HCi28wNzsZxHmMrPQYR4J1mZQup6 xhZQ== X-Gm-Message-State: AOJu0Yy4wXQGdPED5F22elFKKM9oujCrpK3nmikgQg7MKJrOur0TqPCD epEwroPF4htRWpJyT9zr9ta1FrM3tJ/iuq9gPzE= X-Google-Smtp-Source: AGHT+IGQ9lFPj2Ry9hrAdt3Srq6QbH+YAyV8FfVTQkFCmWBSCMT+CIkwnCQJohfqmcniSLtjybQI19nTcMNFNVk94zY= X-Received: by 2002:a2e:be08:0:b0:2cd:5519:35e2 with SMTP id z8-20020a2ebe08000000b002cd551935e2mr1004692ljq.5.1704743500744; Mon, 08 Jan 2024 11:51:40 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 8 Jan 2024 11:51:39 -0800 From: Stefan Kangas In-Reply-To: <87y1d0p9ic.fsf@runbox.com> References: <87sf5ge0v6.fsf@runbox.com> <87a5pl1qym.fsf@runbox.com> <87y1d0p9ic.fsf@runbox.com> MIME-Version: 1.0 Date: Mon, 8 Jan 2024 11:51:39 -0800 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Simen Heggest=C3=B8yl writes: > From a2322770acb6bceab36224989cbbe9b777312997 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Simen=3D20Heggest=3DC3=3DB8yl?=3D > 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. > + > =0C > * 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-ou= tput-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 From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 10 12:50:53 2024 Received: (at control) by debbugs.gnu.org; 10 Jan 2024 17:50:53 +0000 Received: from localhost ([127.0.0.1]:42921 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNcj6-0002oS-V9 for submit@debbugs.gnu.org; Wed, 10 Jan 2024 12:50:53 -0500 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]:61856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNcj5-0002o5-SH for control@debbugs.gnu.org; Wed, 10 Jan 2024 12:50:52 -0500 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2cc7d2c1ff0so50748331fa.3 for ; Wed, 10 Jan 2024 09:50:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704909047; x=1705513847; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=jClmdYnPbyCzfLIM2R/Xf9Vmou1nQalCAbIh3FJw5C0=; b=NF+1BBabMA9oeFEjDoodeDerRuhrrD84TX7aXUHBDWQ5KrtruJR9+EjRHPojJ6ch1I 2lLixBiZmLZZBjGOSDgNOZzfQDC3B+4appbi4be1btQQXsyl/uPUZB0eyz4yQEcAe08d 9AaQT4+BCAC+sWBlgLIuSGLencMxkr64tDerSb/mm8kFkU69j8lFAuLSUCLWYr3Hwvkn y4OMLqEyO2fcHJpRansFEQOl7JAuLqdJ9MYAj7HglT8bYm2MDmcmRmGaPAHRgCQ2G7lU gseJjo7LyZbIytkvdIPTDBpGjiC3+nss3Ccmetq29BVKUm7vVUq9SosPySBiMIHjSnnP ujxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704909047; x=1705513847; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jClmdYnPbyCzfLIM2R/Xf9Vmou1nQalCAbIh3FJw5C0=; b=EejRmZz/K4+YYkCGWwYuHG5sqMjXDa1lwhiCe5BwJ6SKNFXc/euiu7dWlZWAKvbZrr 4RolNp84J+/MgPGVr3KfyF+98x7OeDZ8p1RP44P5h1ZJ3lTYgPSDZyHTiYgqhZxpya/F Xls2Ng5mIIwYkhimkHbkm1EAmmkJ22FJCN4+ga0nyMP8zMMY12RPg+UCGitDnx8jmw+V ZmvWAvdhliM9ZHwIiyV+fRXqITZS4arhrCTMSLR+eobrjje6A5Sd7w4Li9qakrEmZGLE u95W4dBN6Dl6X/GMc40M5K44pUVneDxVCkIfluEOQXpwdkBUhYV5d7tWsSTzaTbgrGyk JSnQ== X-Gm-Message-State: AOJu0YzfcYt3L8rO7oUnMj5s2imoUjiry152ua3d5KQlgMFKpxD8sT7R wGiV4aqWM6rHLSn2aqi0EW9yI/IxV6nuo2j+Rw7PGMfd3zpIFQ== X-Google-Smtp-Source: AGHT+IFki6ZZ8nLYgzAI6YvH7Mb+EfDVIjCKbVNqM88kXwFPk5nqg/Bx/rAKlQ04Nmdi8wnf/YzWRqsVZgpudewGzO0= X-Received: by 2002:a2e:9bc3:0:b0:2cd:c45:a2bd with SMTP id w3-20020a2e9bc3000000b002cd0c45a2bdmr938120ljj.37.1704909046981; Wed, 10 Jan 2024 09:50:46 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 10 Jan 2024 09:50:46 -0800 From: Stefan Kangas MIME-Version: 1.0 Date: Wed, 10 Jan 2024 09:50:46 -0800 Message-ID: Subject: control message for bug #67000 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) severity 67000 wishlist quit From unknown Thu Sep 11 23:18:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Jan 2024 16:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas Cc: 67000@debbugs.gnu.org, Eli Zaretskii Received: via spool by 67000-submit@debbugs.gnu.org id=B67000.170507579410795 (code B ref 67000); Fri, 12 Jan 2024 16:10:01 +0000 Received: (at 67000) by debbugs.gnu.org; 12 Jan 2024 16:09:54 +0000 Received: from localhost ([127.0.0.1]:37345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOK6U-0002o2-3x for submit@debbugs.gnu.org; Fri, 12 Jan 2024 11:09:54 -0500 Received: from mailtransmit04.runbox.com ([2a0c:5a00:149::25]:43708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOK6S-0002nk-5K for 67000@debbugs.gnu.org; Fri, 12 Jan 2024 11:09:53 -0500 Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by mailtransmit04.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1rOK6M-004gTe-F9 for 67000@debbugs.gnu.org; Fri, 12 Jan 2024 17:09:46 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector1; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From; bh=KSvDFEhXcPnQuniQbaxyMHBCdOnpBhxuScmZtqD9yH0=; b=bc9xdgY7VsAB4pA1J3vDF9M/ZS GxC3KtoIdRQYPxRUuLdEqRzR8aP7QF2yoXrGde0uRCi2sVueFKlFTsqXFNpz6VPs/E5TpJE+3TN6b Bw4XKDCIYEuVdGaaH66kwvgok1E5LmiKxrHrNomypLGI4eHJ9tx+q9J9UTGAM2n80bHU7V2Dvr5GD YGgCUNCBpTDg52tuyALcRFEYrxiSul82xbmAr8QoIvm37X7BRf8gmbNtZbfuQwQ7ocVYbHiPmg+gL E/Si8y2D6a+Ra0g3s6CsNGayvynn5/KS+j0l5leqfDc+XXsry2BGVy5ix06Mg3io5jysXup3FRoq0 i9hEyKCA==; Received: from [10.9.9.72] (helo=submission01.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1rOK6L-0004Ye-DU; Fri, 12 Jan 2024 17:09:45 +0100 Received: by submission01.runbox with esmtpsa [Authenticated ID (963757)] (TLS1.2:ECDHE_SECP256R1__RSA_SHA256__AES_256_GCM:256) (Exim 4.93) id 1rOK62-00FtKM-Kg; Fri, 12 Jan 2024 17:09:26 +0100 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= In-Reply-To: (Stefan Kangas's message of "Mon, 8 Jan 2024 11:51:39 -0800") References: <87sf5ge0v6.fsf@runbox.com> <87a5pl1qym.fsf@runbox.com> <87y1d0p9ic.fsf@runbox.com> Date: Fri, 12 Jan 2024 17:09:25 +0100 Message-ID: <874jfibkju.fsf@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain Stefan Kangas writes: > 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. Thanks, makes sense. Updated in the attached patch! >> (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? Usually comint-derived modes use a process sentinel to listen to some external process and call `comint-write-input-ring' when the process exists, which works both the buffer is killed or Emacs itself is quit. For IELM there is no such process to listen to, so I hook into `kill-buffer-hook' and `kill-emacs-hook' to achieve the same things. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-support-for-reading-writing-IELM-input-history.patch >From fdfb18c16d1d38a197bc1143d2704aefa7fe9daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= 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 | 11 +++++++++++ lisp/ielm.el | 15 +++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index bce33f96aee..c20d34b39ad 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1243,6 +1243,17 @@ 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. + +--- +*** New variable 'ielm-history-file-name'. +If non-nil, name of the file to read/write IELM input history. Set to +nil to revert IELM to the old behavior of not remembering input +history between sessions. + * New Modes and Packages in Emacs 30.1 diff --git a/lisp/ielm.el b/lisp/ielm.el index 777aebb70cf..cfb51b7a94e 100644 --- a/lisp/ielm.el +++ b/lisp/ielm.el @@ -110,6 +110,13 @@ ielm-dynamic-multiline-inputs such as `edebug-defun' to work with such inputs." :type 'boolean) +(defcustom ielm-history-file-name + (locate-user-emacs-file "ielm-history.eld") + "If non-nil, name of the file to read/write IELM input history." + :type '(choice (const :tag "nil" nil) + file) + :version "30.1") + (defvaralias 'inferior-emacs-lisp-mode-hook 'ielm-mode-hook) (defcustom ielm-mode-hook nil "Hooks to be run when IELM (`inferior-emacs-lisp-mode') is started." @@ -605,6 +612,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 +643,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.42.0 --=-=-= Content-Type: text/plain -- Simen --=-=-=-- From unknown Thu Sep 11 23:18:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Jan 2024 07:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 67000@debbugs.gnu.org, Eli Zaretskii Received: via spool by 67000-submit@debbugs.gnu.org id=B67000.170512973810495 (code B ref 67000); Sat, 13 Jan 2024 07:09:01 +0000 Received: (at 67000) by debbugs.gnu.org; 13 Jan 2024 07:08:58 +0000 Received: from localhost ([127.0.0.1]:38244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOY8Y-0002jC-00 for submit@debbugs.gnu.org; Sat, 13 Jan 2024 02:08:58 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:48376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOY8U-0002ix-7B for 67000@debbugs.gnu.org; Sat, 13 Jan 2024 02:08:56 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40e69b31365so6601565e9.0 for <67000@debbugs.gnu.org>; Fri, 12 Jan 2024 23:08:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705129730; x=1705734530; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=BpdwNPoTPze2zfLXaj48khfJ7pVg2GVGi8XhfvQ31Ck=; b=cFGDlYf43K4p918I2lRjBe1LLM/j528UEUSOla8yFYQ4m/H+Iiq4CRcZXgmU8nWI3+ jUniHgL+3X2szskx6W8VwbwtN8HaBS9vp75oNOTHExYtY8+X0dMqkONE2fl3MDilZ80O VEHXocDJCVZVo1DEoJjKqKO2RsrKZBplAdGfQucnv1N4HvCWi7wFOettbAweZ/VgDWmA aWB5KQz6GF3pQTr6XIPelwgLj4Kue4L1UtHMdY5rCDitn1Q//mo/23Q8wkYjzi6XltDW +sPMjXfgPgtxJ4WmtXdF1fmVeP/UW1iuwBShTw1V3JkeZ15jPMR8oFJzzETFM1l6f8Pf hy9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705129730; x=1705734530; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=BpdwNPoTPze2zfLXaj48khfJ7pVg2GVGi8XhfvQ31Ck=; b=pHFQ3nV0Yo2wJ5MYIux5ZojvnMacXtg/W8MZzhhZAXjSMGxEltjTEeiRfsLgsEPJls vqodp92a32UBB8TsVV93cUWZJMbIJOfegvEPlDF4iHq/LemBt/LAOtOPYRZZMN8g0bMX /Y8o3mvTCbNf2e42qdBMF9f3kTN21eC+QCYtcAueUGC0Wy79Y4hjh4CQj5F+QDTbr78y bg6g0RWlq6fjH/VwvXiAiGsDTc+q+l5wcN9L7JRGte8TfUVByX+k3Pk9LuxYLxdkDoG4 dn3Cr5vbTx1enoxE9QTPJN0+uUjuKYCY3cq6mQbyChVo58YqxNehRXb5bzQHyo33sj7U QN3g== X-Gm-Message-State: AOJu0YxPtkbB+4Z5sBxmKi3FSRUjTG1BUjcrZFOA4ZBwy9FARgGZhda1 67ITg9SNMb1T5ly0b3R8p4QGMcv80j6HmvPn6os= X-Google-Smtp-Source: AGHT+IEMxdmShol1JMNS3B0m29U6T0CEfw/rX/rYLPy6g9w9Ppt++4hEFLxf9qguuQ4Cn47+qCdEuH9TjrAcgjVuag8= X-Received: by 2002:a05:600c:3544:b0:40e:50ac:d25c with SMTP id i4-20020a05600c354400b0040e50acd25cmr1110714wmq.92.1705129729709; Fri, 12 Jan 2024 23:08:49 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 13 Jan 2024 01:08:49 -0600 From: Stefan Kangas In-Reply-To: <874jfibkju.fsf@runbox.com> References: <87sf5ge0v6.fsf@runbox.com> <87a5pl1qym.fsf@runbox.com> <87y1d0p9ic.fsf@runbox.com> <874jfibkju.fsf@runbox.com> MIME-Version: 1.0 Date: Sat, 13 Jan 2024 01:08:49 -0600 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Simen Heggest=C3=B8yl writes: >>> +(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? > > Usually comint-derived modes use a process sentinel to listen to some > external process and call `comint-write-input-ring' when the process > exists, which works both the buffer is killed or Emacs itself is quit. > > For IELM there is no such process to listen to, so I hook into > `kill-buffer-hook' and `kill-emacs-hook' to achieve the same things. I'm not against adding a hook to `kill-emacs-hook', but it should be added when you start IELM and not on top-level. We want to avoid any side effects from merely loading a file. I don't think this will work in its current form either: AFAICT, `comint-write-input-ring' saves it for the current buffer, and that's not guaranteed to be the *ielm* buffer when `kill-emacs-hook' runs. So you'd want to first switch to that buffer, I think. It could also have been renamed meanwhile, so I think you want to save the actual buffer and not it's name (i.e. use `get-buffer'). From unknown Thu Sep 11 23:18:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Jan 2024 07:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas Cc: 67000@debbugs.gnu.org, Eli Zaretskii Received: via spool by 67000-submit@debbugs.gnu.org id=B67000.170565054711278 (code B ref 67000); Fri, 19 Jan 2024 07:50:02 +0000 Received: (at 67000) by debbugs.gnu.org; 19 Jan 2024 07:49:07 +0000 Received: from localhost ([127.0.0.1]:57380 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQjch-0002vp-3x for submit@debbugs.gnu.org; Fri, 19 Jan 2024 02:49:07 -0500 Received: from mailtransmit04.runbox.com ([2a0c:5a00:149::25]:58708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQjce-0002vK-IS for 67000@debbugs.gnu.org; Fri, 19 Jan 2024 02:49:05 -0500 Received: from mailtransmit02.runbox ([10.9.9.162] helo=aibo.runbox.com) by mailtransmit04.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1rQjcW-004t2t-EF; Fri, 19 Jan 2024 08:48:56 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector1; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From; bh=Q614xSZE2oU9SPGB4H4QpoiaF4pUWCHS4HZw+24krho=; b=rJhpRz6nHyOYTtMEuaFYj1fHVh ArlCQNhslBbyYFZsR0w4uIQnh+YJNagEVPzHvoDl7QmrBOCOdacGYQUBHn+vUbaUheegphFZV/83P r6FAx+N6jNdQlBXg7eqREL2hO+zoCqIFDpC25pe02jVb/nGHo+mgvFAuA6zFcyLh1mvibxaPqZx2p iiDvKbQ1/kojcTwldMPgrlDvndxR+QEyLEWi5ldz9OEtkYjQk6tct9l2vy2CQfXESZAkjDvhIeTvP efcvlZnBbOYUM7iSdCQahp5qaG2Ufp0Iybof6BLbJTG0I80EjzaYY5+1VYDdHn/cUY93KBx/QjE8t 3w6l3Jug==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1rQjcV-0007G4-OK; Fri, 19 Jan 2024 08:48:55 +0100 Received: by submission03.runbox with esmtpsa [Authenticated ID (963757)] (TLS1.2:ECDHE_SECP256R1__RSA_SHA256__AES_256_GCM:256) (Exim 4.93) id 1rQjcT-002yNw-4G; Fri, 19 Jan 2024 08:48:53 +0100 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= In-Reply-To: (Stefan Kangas's message of "Sat, 13 Jan 2024 01:08:49 -0600") References: <87sf5ge0v6.fsf@runbox.com> <87a5pl1qym.fsf@runbox.com> <87y1d0p9ic.fsf@runbox.com> <874jfibkju.fsf@runbox.com> Date: Fri, 19 Jan 2024 08:48:51 +0100 Message-ID: <87eded2270.fsf@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain Stefan Kangas writes: > I'm not against adding a hook to `kill-emacs-hook', but it should be > added when you start IELM and not on top-level. We want to avoid any > side effects from merely loading a file. Fixed. > I don't think this will work in its current form either: AFAICT, > `comint-write-input-ring' saves it for the current buffer, and that's > not guaranteed to be the *ielm* buffer when `kill-emacs-hook' runs. > > So you'd want to first switch to that buffer, I think. It could also > have been renamed meanwhile, so I think you want to save the actual > buffer and not it's name (i.e. use `get-buffer'). Right, good catch. New attempt in the attached patch! --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-support-for-reading-writing-IELM-input-history.patch >From 738801b3126e78cf893d58e47fa156aeeec84cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= Date: Tue, 16 Jan 2024 08:21:41 +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. (ielm--exit): Holds a function to call when Emacs is killed to write out the input history. (ielm--input-history-writer): Helper function for writing the IELM input history out to file. --- etc/NEWS | 11 +++++++++++ lisp/ielm.el | 29 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 735a05f6579..b87ba93f456 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1254,6 +1254,17 @@ 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. + +--- +*** New variable 'ielm-history-file-name'. +If non-nil, name of the file to read/write IELM input history. Set to +nil to revert IELM to the old behavior of not remembering input +history between sessions. + * New Modes and Packages in Emacs 30.1 diff --git a/lisp/ielm.el b/lisp/ielm.el index 777aebb70cf..54da62c4359 100644 --- a/lisp/ielm.el +++ b/lisp/ielm.el @@ -110,6 +110,13 @@ ielm-dynamic-multiline-inputs such as `edebug-defun' to work with such inputs." :type 'boolean) +(defcustom ielm-history-file-name + (locate-user-emacs-file "ielm-history.eld") + "If non-nil, name of the file to read/write IELM input history." + :type '(choice (const :tag "nil" nil) + file) + :version "30.1") + (defvaralias 'inferior-emacs-lisp-mode-hook 'ielm-mode-hook) (defcustom ielm-mode-hook nil "Hooks to be run when IELM (`inferior-emacs-lisp-mode') is started." @@ -503,6 +510,17 @@ ielm--expand-ellipsis (funcall pp-default-function beg end) end)) +;;; Input history + +(defvar ielm--exit + "Function to call when Emacs is killed.") + +(defun ielm--input-history-writer (buf) + "Return a function writing IELM input history to BUF." + (lambda () + (with-current-buffer buf + (comint-write-input-ring)))) + ;;; Major mode (define-derived-mode inferior-emacs-lisp-mode comint-mode "IELM" @@ -605,6 +623,17 @@ 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 ielm--exit (ielm--input-history-writer (current-buffer))) + (setq-local 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) + ;; 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 -- 2.39.2 --=-=-= Content-Type: text/plain -- Simen --=-=-=-- From unknown Thu Sep 11 23:18:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Jan 2024 15:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 67000@debbugs.gnu.org, Eli Zaretskii Received: via spool by 67000-submit@debbugs.gnu.org id=B67000.170645456829914 (code B ref 67000); Sun, 28 Jan 2024 15:10:02 +0000 Received: (at 67000) by debbugs.gnu.org; 28 Jan 2024 15:09:28 +0000 Received: from localhost ([127.0.0.1]:58188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rU6ml-0007mP-QK for submit@debbugs.gnu.org; Sun, 28 Jan 2024 10:09:28 -0500 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]:53545) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rU6mj-0007m9-Gz for 67000@debbugs.gnu.org; Sun, 28 Jan 2024 10:09:26 -0500 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-55cc182da17so1828440a12.3 for <67000@debbugs.gnu.org>; Sun, 28 Jan 2024 07:09:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706454551; x=1707059351; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=VYDWxn41aJTk6z9hpAy8mIU9HrzwMk38AymAtGx2rYU=; b=lJXL2dZQTYem5EG5m/W5fL8uVYyyULi+hKnzPW3AXSQGW+mzd1SKIJFVB5R20pdoXB aUmgj6qrH02IMaah35+7b57uNsboyGlBvPM2j/RyzQ7ZpnNHOst/KVgeoI9gJ4qN+4aF ahoVGW8sG7dPI2yNOzRbyoCg1XYb9zqDj8kj8ke6Ja1Se7sK+ToFiu6rZTXFQqMHgD+1 2gscrvLRzOyAT/FwP9FYXHtT8qpCG+3ankhjig0cpbojE8m+drouc/qhgA0lt/Qkj1YL kT882TphBSv8YgWK8Gg6g6xbg9H02WkVlbWwWbHkebO+54HDo/f7xp1unhd4/RZD6wMo weHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706454551; x=1707059351; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=VYDWxn41aJTk6z9hpAy8mIU9HrzwMk38AymAtGx2rYU=; b=YXd87Sa9yxTUak4ZeAj2JBsF6Os7C3MNUTD/DfSd7zF9aY/QSxRUpW67lm5cNqbG5C U4TjnvhnUSOt8yRYVdiz1ljhu/YzuqUFYehoHAlZo6V8WMd7Q4fxw+Diyy9dnAPp54uD 2RYL2yuS9RHvrQYl8j5gj2hirZ5Cav4joKuc1q38lAdJ48gBvq82ktOfsPOmmmIVke8W BwlXja4neHMocveeIkUMEWPsDD2t/7oOzxD+xS2zoTlT2Xfh2govZPg6877Xeg5AU/TF 4km8joN6viAqcLc29IkkEK48Wc5EW3Mq3hLtLgM+ot6/04Ax3B3j9jQqpj7lmS95awOc 9ReQ== X-Gm-Message-State: AOJu0Yxe3P0ArN4H7FnFAk1R9NhPE/rSIBJJQg5sXfvfSffcGawhKkLl PZJcV2rdSI8KC1U+BdX43nqbTPeToRlmTiZW9TAJv4q0LYArUbJWgRGZ92atxuhhDmvaNnrJmMI 3yFIhqk4TdZscwCgsGDpMo12WKRE= X-Google-Smtp-Source: AGHT+IHB3AUGkb3xkRLvpyGeKbCLuTJFs6+cF1EGfm0qvqpeW+5D788OBpGFx13aGj/JYfAWvFA4ekzLzI0ht8JlC6E= X-Received: by 2002:a05:6402:2692:b0:55c:85be:f280 with SMTP id w18-20020a056402269200b0055c85bef280mr2663898edd.9.1706454551099; Sun, 28 Jan 2024 07:09:11 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 28 Jan 2024 07:09:10 -0800 From: Stefan Kangas In-Reply-To: <87eded2270.fsf@runbox.com> References: <87sf5ge0v6.fsf@runbox.com> <87a5pl1qym.fsf@runbox.com> <87y1d0p9ic.fsf@runbox.com> <874jfibkju.fsf@runbox.com> <87eded2270.fsf@runbox.com> MIME-Version: 1.0 Date: Sun, 28 Jan 2024 07:09:10 -0800 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Simen Heggest=C3=B8yl writes: > Right, good catch. New attempt in the attached patch! Thanks, please find some comments below. > +--- > +*** IELM now remembers input history between sessions. > + > +--- > +*** New variable 'ielm-history-file-name'. > +If non-nil, name of the file to read/write IELM input history. Set to > +nil to revert IELM to the old behavior of not remembering input > +history between sessions. I would probably make this into one entry, like so: *** IELM now remembers input history between sessions. The new user option 'ielm-history-file-name' is the name of the file where IELM input history will be saved. Customize it to nil to revert to the old behavior of not remembering input history between sessions. > +(defcustom ielm-history-file-name > + (locate-user-emacs-file "ielm-history.eld") > + "If non-nil, name of the file to read/write IELM input history." > + :type '(choice (const :tag "nil" nil) The tag here should be "Disable input history" or something like that. > + file) > + :version "30.1") > + > (defvaralias 'inferior-emacs-lisp-mode-hook 'ielm-mode-hook) > (defcustom ielm-mode-hook nil > "Hooks to be run when IELM (`inferior-emacs-lisp-mode') is started." > @@ -503,6 +510,17 @@ ielm--expand-ellipsis > (funcall pp-default-function beg end) > end)) > > +;;; Input history > + > +(defvar ielm--exit This should read (defvar ielm--exit nil or the below docstring will instead be its value. > + "Function to call when Emacs is killed.") > + > +(defun ielm--input-history-writer (buf) > + "Return a function writing IELM input history to BUF." > + (lambda () > + (with-current-buffer buf > + (comint-write-input-ring)))) > + > ;;; Major mode > > (define-derived-mode inferior-emacs-lisp-mode comint-mode "IELM" > @@ -605,6 +623,17 @@ 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 ielm--exit (ielm--input-history-writer (current-buffer))) > + (setq-local 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) There are some complications here: You can get more than one IELM buffer using M-x ielm RET M-x rename-buffer RET foo RET M-x ielm RET What happens if there is more than one IELM buffer? It will save only the history from the last one, or something like that? Perhaps the kill-emacs-hook should look for all buffers that are using `ielm-mode' and save the history from all of them? > + > ;; 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 > -- > 2.39.2 > > > -- Simen From unknown Thu Sep 11 23:18:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Feb 2024 14:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas Cc: 67000@debbugs.gnu.org, Eli Zaretskii Received: via spool by 67000-submit@debbugs.gnu.org id=B67000.170731461814983 (code B ref 67000); Wed, 07 Feb 2024 14:04:02 +0000 Received: (at 67000) by debbugs.gnu.org; 7 Feb 2024 14:03:38 +0000 Received: from localhost ([127.0.0.1]:55910 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXiWX-0003tZ-9i for submit@debbugs.gnu.org; Wed, 07 Feb 2024 09:03:37 -0500 Received: from mailtransmit05.runbox.com ([2a0c:5a00:149::26]:43698) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXiWU-0003tI-0O for 67000@debbugs.gnu.org; Wed, 07 Feb 2024 09:03:36 -0500 Received: from mailtransmit02.runbox ([10.9.9.162] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1rXiW8-00GxKo-SO for 67000@debbugs.gnu.org; Wed, 07 Feb 2024 15:03:12 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector1; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From; bh=FuQS0XrIufku/Wgs73w66uR7PNYztVlcDxR/7Bgg0kQ=; b=2UmNqoeSthMNyIF1OMg8ClWJlT GeMiA+2HRR6tNmxkKHkSp0UnbMKORIGAVYb1vcIpwteZh9xT/rsH3VchiKrfz9dEaYyufVaGEkDuZ FX7LVL+Q16U9tugHRLGEJsifoGgP0sB/Bq4Xw1rQ0yLlLY12mgbFT35ZX7SB0FCjjnhfEhp6g4EJ+ uWwkvTitnh0zmUtL+h1yfJpH9e0Lrglyam9vLh6iZQ9SvxDXBNy+2JSgd6/dcr68UhCCS0hT+CDmW hc9JZsoe/kmz7EpZecFbrKZc+rJUSa+5/72A4fdadj0eyRmOu+5F50/D30GwLIn8LolBaZOlejFUu Tawgg6Og==; Received: from [10.9.9.72] (helo=submission01.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1rXiW7-0001Rk-SP; Wed, 07 Feb 2024 15:03:12 +0100 Received: by submission01.runbox with esmtpsa [Authenticated ID (963757)] (TLS1.2:ECDHE_SECP256R1__RSA_SHA256__AES_256_GCM:256) (Exim 4.93) id 1rXiVu-004X3T-HT; Wed, 07 Feb 2024 15:02:58 +0100 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= In-Reply-To: (Stefan Kangas's message of "Sun, 28 Jan 2024 07:09:10 -0800") References: <87sf5ge0v6.fsf@runbox.com> <87a5pl1qym.fsf@runbox.com> <87y1d0p9ic.fsf@runbox.com> <874jfibkju.fsf@runbox.com> <87eded2270.fsf@runbox.com> Date: Wed, 07 Feb 2024 15:02:56 +0100 Message-ID: <87sf24l6cv.fsf@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Stefan, thanks for your feedback. An updated patch is attached. Stefan Kangas writes: > Simen Heggest=C3=B8yl writes: > >> +--- >> +*** IELM now remembers input history between sessions. >> + >> +--- >> +*** New variable 'ielm-history-file-name'. >> +If non-nil, name of the file to read/write IELM input history. Set to >> +nil to revert IELM to the old behavior of not remembering input >> +history between sessions. > > I would probably make this into one entry, like so: > > *** IELM now remembers input history between sessions. > The new user option 'ielm-history-file-name' is the name of the file > where IELM input history will be saved. Customize it to nil to revert > to the old behavior of not remembering input history between sessions. Aight, changed! >> +(defcustom ielm-history-file-name >> + (locate-user-emacs-file "ielm-history.eld") >> + "If non-nil, name of the file to read/write IELM input history." >> + :type '(choice (const :tag "nil" nil) > > The tag here should be "Disable input history" or something like that. Ok. Should it be updated for `comint-input-ring-file-name' too then (I copied it from there)? > This should read > > (defvar ielm--exit nil > > or the below docstring will instead be its value. Of course, thanks. >> + "Function to call when Emacs is killed.") >> + >> +(defun ielm--input-history-writer (buf) >> + "Return a function writing IELM input history to BUF." >> + (lambda () >> + (with-current-buffer buf >> + (comint-write-input-ring)))) >> + >> ;;; Major mode >> >> (define-derived-mode inferior-emacs-lisp-mode comint-mode "IELM" >> @@ -605,6 +623,17 @@ 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 ielm--exit (ielm--input-history-writer (current-buffer))) >> + (setq-local 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) > > There are some complications here: > > You can get more than one IELM buffer using > > M-x ielm RET > M-x rename-buffer RET foo RET > M-x ielm RET > > What happens if there is more than one IELM buffer? It will save only > the history from the last one, or something like that? Yes. Though I think that's kind of expected; that's how Eshell for instance also works. > Perhaps the kill-emacs-hook should look for all buffers that are using > `ielm-mode' and save the history from all of them? It would also need to be handled in the kill-buffer hooks I guess, updating the remaining buffers' histories when one buffer is killed. Sounds kind of messy though, I think I'd prefer the more simple approach suggested here. -- Simen --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0001-Add-support-for-reading-writing-IELM-input-history.patch Content-Transfer-Encoding: quoted-printable >From fe91c4f3aaefc109135c48ba26f8f21e87db465e Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Simen=3D20Heggest=3DC3=3DB8yl?=3D Date: Tue, 16 Jan 2024 08:21:41 +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. (ielm--exit): Holds a function to call when Emacs is killed to write out the input history. (ielm--input-history-writer): Helper function for writing the IELM input history out to file. --- etc/NEWS | 8 ++++++++ lisp/ielm.el | 29 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index ee7462cb2aa..2c98a805582 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1328,6 +1328,14 @@ characters, such as =C2=BD (U+00BD VULGAR FRACTION O= NE HALF), are also recognized as rational fractions. They have been since 2004, but it looks like it was never mentioned in the NEWS, or even the manual. =20 +** IELM + +--- +*** IELM now remembers input history between sessions. +The new user option 'ielm-history-file-name' is the name of the file +where IELM input history will be saved. Customize it to nil to revert +to the old behavior of not remembering input history between sessions. + * New Modes and Packages in Emacs 30.1 =20 diff --git a/lisp/ielm.el b/lisp/ielm.el index 777aebb70cf..e583e0fe32c 100644 --- a/lisp/ielm.el +++ b/lisp/ielm.el @@ -110,6 +110,13 @@ ielm-dynamic-multiline-inputs such as `edebug-defun' to work with such inputs." :type 'boolean) =20 +(defcustom ielm-history-file-name + (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) + :version "30.1") + (defvaralias 'inferior-emacs-lisp-mode-hook 'ielm-mode-hook) (defcustom ielm-mode-hook nil "Hooks to be run when IELM (`inferior-emacs-lisp-mode') is started." @@ -503,6 +510,17 @@ ielm--expand-ellipsis (funcall pp-default-function beg end) end)) =20 +;;; Input history + +(defvar ielm--exit nil + "Function to call when Emacs is killed.") + +(defun ielm--input-history-writer (buf) + "Return a function writing IELM input history to BUF." + (lambda () + (with-current-buffer buf + (comint-write-input-ring)))) + ;;; Major mode =20 (define-derived-mode inferior-emacs-lisp-mode comint-mode "IELM" @@ -605,6 +623,17 @@ inferior-emacs-lisp-mode #'ielm-indirect-setup-hook 'append t) (setq comint-indirect-setup-function #'emacs-lisp-mode) =20 + ;; 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 + (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) + ;; 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 --=20 2.39.2 --=-=-=-- From unknown Thu Sep 11 23:18:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Feb 2024 11:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 67000@debbugs.gnu.org, Eli Zaretskii Received: via spool by 67000-submit@debbugs.gnu.org id=B67000.170756453223726 (code B ref 67000); Sat, 10 Feb 2024 11:29:02 +0000 Received: (at 67000) by debbugs.gnu.org; 10 Feb 2024 11:28:52 +0000 Received: from localhost ([127.0.0.1]:34036 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYlXQ-0006Ab-1y for submit@debbugs.gnu.org; Sat, 10 Feb 2024 06:28:52 -0500 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]:53444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYlXN-00069G-Tf for 67000@debbugs.gnu.org; Sat, 10 Feb 2024 06:28:51 -0500 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-5600c43caddso2180369a12.2 for <67000@debbugs.gnu.org>; Sat, 10 Feb 2024 03:28:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707564508; x=1708169308; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=cmkRTLQ1dlZFdm+ynp0FOau1trYppZ1RQ302rkRmayk=; b=ldVebGw+8yWRxpcnmGxzBttRP05jt7gVx3Bp7qNfNvmDurE7pazqx+GhfrOYlJQFAm J61US3d1HjgiPVlQ9tIJ6lyDzBGlc6KnJvqNcf9aXrPilJttgi7ehyJ3Q5fFNyRvYj4g 4b4lI+Zzann7u/gDZgEQwCVKipC/CWBTiN8Ze0K+0M/2UUgb/usxaaTazlT/DZHTNM8j pVCCLP9MDG4i2H27sg6cyNu0i6lMAcjv33uEHSUQ4KUkgYWhaGGGaZsb/nhFf8S4UKfv E/Run2my9oHX6IKYPo6VOBPMdCjGrwHxkp7izBRHvo8WZviZpLrERbszhpWN8GVP7FUW SxKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707564508; x=1708169308; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=cmkRTLQ1dlZFdm+ynp0FOau1trYppZ1RQ302rkRmayk=; b=Fx93DCxFKb3NSXS1QEeA1MqtfdeNPo5m1oi75TGTfBmQXrcQCF8fJbH8IvhInVFzYm VfZ8cMteCGGhVpzQHVTBQ/QaMsVQimOn+xUVOJ+HROXjv/GPHpIY6f+QHFoHXdjC0yh0 xrG+zlXepIP8FfLsArK571zFSHGBdkVuQ7B9XBrkWe1LQ28ZkbX/EDDBk/Pqa3OTjACZ pDYFKR5E6x621ATYDyYXYDOmHwOYmBQOiPO/lhSCk2QjNzqQpITrv9mTYgDKsX7aiGuL uHvniRx7ErRLj6HVWeRiEXNc3iOzD12YJrb2N1g4Os1NbBOe10UlfitC4eLwSuIE+X3g CZ9w== X-Gm-Message-State: AOJu0YyCeVOjagpXx/RECZZpZmgIFE9uMQHTgnN20PYjQmC+6th6bjSU 0WnNqIdw3i1D5KFgMZt1tVt2qhTlT2q3WJCCyiA2wqe7jM5+RlK/V71Lcp5Oo2V/O+qoulEx8+R Qgu7GkHJY2LKur3OznEdlKDVrho8KDW0VERc= X-Google-Smtp-Source: AGHT+IELhx0Wv+vFQkc2/X+ZNU3IrzAgW2VTXo35rMzJ8PhzTCvc0VyPLo99/z7FpRd4SytzFuUaf9J4u8zcsyzojb0= X-Received: by 2002:a50:ee8b:0:b0:560:799:f802 with SMTP id f11-20020a50ee8b000000b005600799f802mr920870edr.21.1707564508547; Sat, 10 Feb 2024 03:28:28 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 10 Feb 2024 05:28:27 -0600 From: Stefan Kangas In-Reply-To: <87sf24l6cv.fsf@runbox.com> References: <87sf5ge0v6.fsf@runbox.com> <87a5pl1qym.fsf@runbox.com> <87y1d0p9ic.fsf@runbox.com> <874jfibkju.fsf@runbox.com> <87eded2270.fsf@runbox.com> <87sf24l6cv.fsf@runbox.com> MIME-Version: 1.0 Date: Sat, 10 Feb 2024 05:28:27 -0600 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Simen Heggest=C3=B8yl writes: > Hi Stefan, thanks for your feedback. An updated patch is attached. LGTM, please install. Feel free to handle the minor comments below as you think is best, or disregard them. Thanks! >>> +(defcustom ielm-history-file-name >>> + (locate-user-emacs-file "ielm-history.eld") >>> + "If non-nil, name of the file to read/write IELM input history." >>> + :type '(choice (const :tag "nil" nil) >> >> The tag here should be "Disable input history" or something like that. > > Ok. Should it be updated for `comint-input-ring-file-name' too then (I > copied it from there)? Yes, that could be improved too. > From fe91c4f3aaefc109135c48ba26f8f21e87db465e Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Simen=3D20Heggest=3DC3=3DB8yl?=3D > Date: Tue, 16 Jan 2024 08:21:41 +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. How about: "Add support for saving input history to a file" > (ielm--history-file-name): Name of the file to read/write IELM input > history. Maybe: "New variable indicating IELM input history file. > +(defcustom ielm-history-file-name > + (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) > + :version "30.1") Maybe `file' should have a tag too? From unknown Thu Sep 11 23:18:32 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Subject: bug#67000: closed (Re: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history) Message-ID: References: <87o7ciupsz.fsf@runbox.com> <87sf5ge0v6.fsf@runbox.com> X-Gnu-PR-Message: they-closed 67000 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 67000@debbugs.gnu.org Date: Thu, 15 Feb 2024 07:56:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1707983762-30962-1" This is a multi-part message in MIME format... ------------=_1707983762-30962-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 67000@debbugs.gnu.org. --=20 67000: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D67000 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1707983762-30962-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 67000-done) by debbugs.gnu.org; 15 Feb 2024 07:55:46 +0000 Received: from localhost ([127.0.0.1]:53913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raWaw-00082v-Fg for submit@debbugs.gnu.org; Thu, 15 Feb 2024 02:55:46 -0500 Received: from mailtransmit05.runbox.com ([185.226.149.38]:58252) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raWau-00082g-Co for 67000-done@debbugs.gnu.org; Thu, 15 Feb 2024 02:55:45 -0500 Received: from mailtransmit02.runbox ([10.9.9.162] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1raWYO-003d9O-RL for 67000-done@debbugs.gnu.org; Thu, 15 Feb 2024 08:53:08 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector1; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From; bh=4xQF56DpY7xF7JfOJHaLtGGTdswnTjNSHhUMF8CeMf4=; b=t8MMxrrO6v+7CzXqVij7S63ZLz p7q8IiFA5BJpnaywqGr9pc3rr+bICwxC/dCX+tTRFBvrTxVL+piNvFJnKyMTFrm7nDwFttj6SzIj8 Pz/5glSruAWQLvgAUHMhJyJp3f+69sFyI2QrKi92Nvn28gGgHNULmQqQDuo/YP+k7SiU9CGn3PO1k zB2Kjasjf+OZLdIg0gJXJJEbJ7Bfrk0i4V3rYwm//yBWGPGa6ZdaWHbIu01Vj1VLZuLsncQC6dPPO 0268349LjzXkP54RZejYvV/be1sKy8AH0Wy5qEABO7S5ChmLAojBCtfWFRRiDWtZE/j7PNKPMLlTF i2s/29EQ==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1raWYO-00057d-80; Thu, 15 Feb 2024 08:53:08 +0100 Received: by submission03.runbox with esmtpsa [Authenticated ID (963757)] (TLS1.2:ECDHE_SECP256R1__RSA_SHA256__AES_256_GCM:256) (Exim 4.93) id 1raWYG-00C0z4-Q6; Thu, 15 Feb 2024 08:53:00 +0100 From: =?utf-8?Q?Simen_Heggest=C3=B8yl?= To: Stefan Kangas Subject: Re: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history In-Reply-To: (Stefan Kangas's message of "Sat, 10 Feb 2024 05:28:27 -0600") References: <87sf5ge0v6.fsf@runbox.com> <87a5pl1qym.fsf@runbox.com> <87y1d0p9ic.fsf@runbox.com> <874jfibkju.fsf@runbox.com> <87eded2270.fsf@runbox.com> <87sf24l6cv.fsf@runbox.com> Date: Thu, 15 Feb 2024 08:53:00 +0100 Message-ID: <87o7ciupsz.fsf@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 67000-done Cc: 67000-done@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) Stefan Kangas writes: > LGTM, please install. Done! Thanks again for reviewing. >>>> +(defcustom ielm-history-file-name >>>> + (locate-user-emacs-file "ielm-history.eld") >>>> + "If non-nil, name of the file to read/write IELM input history." >>>> + :type '(choice (const :tag "nil" nil) >>> >>> The tag here should be "Disable input history" or something like that. >> >> Ok. Should it be updated for `comint-input-ring-file-name' too then (I >> copied it from there)? > > Yes, that could be improved too. Done. >> From fe91c4f3aaefc109135c48ba26f8f21e87db465e Mon Sep 17 00:00:00 2001 >> From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= >> Date: Tue, 16 Jan 2024 08:21:41 +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. > > How about: > > "Add support for saving input history to a file" Changed. >> (ielm--history-file-name): Name of the file to read/write IELM input >> history. > > Maybe: > > "New variable indicating IELM input history file. Changed. >> +(defcustom ielm-history-file-name >> + (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) >> + :version "30.1") > > Maybe `file' should have a tag too? The label in the Custom menu says "File", which seems fine to me? Though I never use Custom, so I'm not sure what's customary here. I installed the above without changes, but please feel free to change it. -- Simen ------------=_1707983762-30962-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 8 Nov 2023 15:12:49 +0000 Received: from localhost ([127.0.0.1]:46126 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0kEa-0003hb-MG for submit@debbugs.gnu.org; Wed, 08 Nov 2023 10:12:48 -0500 Received: from lists.gnu.org ([2001:470:142::17]:38590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0kEX-0003hO-Ta for submit@debbugs.gnu.org; Wed, 08 Nov 2023 10:12:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0kDp-0000rO-M6 for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 10:12:01 -0500 Received: from mailtransmit05.runbox.com ([2a0c:5a00:149::26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0kDl-0006nk-Bs for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 10:12:01 -0500 Received: from mailtransmit02.runbox ([10.9.9.162] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1r0kDT-00Fzs5-9O for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 16:11:39 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector2; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=NRwvg5BW2bCzz/IUBisE4ebxmTk9NGrnSW/eMn8exZU=; b=hYE05oSDyr3Ktlao0Y+a9eFgL mHDb9ArIp8bTnk7oZhMvRFWf8KSBMZMeXx0Dy2CiwhhBCrLyULsk2pzlZljQ+6DOUrGkblm+TeijO 2WpfsNF/rYrlrakUQVW8Ewwo3GPxC+6hANIL3qJyqQQjPwfx8FUMWXP1KqAbeMMxsjl32NUja5MC/ OzvVtY6hYsfJKhDKC1axq2dv8hkYw5+Jn3sQiOTjiTFdeOhbWr1VEpgXeoE9vghOukEfHFZzZTB43 x1e0ThDXyOth5pWtGajf2NemdguGVs50cWzFLqPjWRHOqgSewbzzWcSzPhBXClSKilg4R+oYAUBlh kfLj+bRqA==; Received: from [10.9.9.73] (helo=submission02.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1r0kDR-00023p-3D for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 16:11:38 +0100 Received: by submission02.runbox with esmtpsa [Authenticated ID (963757)] (TLS1.2:ECDHE_SECP256R1__RSA_SHA256__AES_256_GCM:256) (Exim 4.93) id 1r0kDG-000OjY-T4 for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 16:11:26 +0100 From: =?utf-8?Q?Simen_Heggest=C3=B8yl?= To: bug-gnu-emacs@gnu.org Subject: 30.0.50; [PATCH] Add support for reading/writing IELM input history Date: Wed, 08 Nov 2023 16:11:25 +0100 Message-ID: <87sf5ge0v6.fsf@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a0c:5a00:149::26; envelope-from=simenheg@runbox.com; helo=mailtransmit05.runbox.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 2.9 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Attached is a proposed patch that adds input history read/write capabilities to IELM. From 190a88ae55bb4a47de64cb50f2706798a100704b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= Date: Wed, 8 Nov 2023 16:08:08 +0100 Subject: [PATCH] Add support for reading/writing [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (simenheg[at]runbox.com) 0.9 SPF_FAIL SPF: sender does not match SPF record (fail) [SPF failed: Please see http://www.openspf.org/Why?s=mfrom; id=simenheg%40runbox.com; ip=2001%3A470%3A142%3A%3A17; r=debbugs.gnu.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 2.0 SPOOFED_FREEMAIL No description available. X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Attached is a proposed patch that adds input history read/write capabilities to IELM. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-support-for-reading-writing-IELM-input-history.patch >From 190a88ae55bb4a47de64cb50f2706798a100704b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= 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 --=-=-= Content-Type: text/plain -- Simen --=-=-=-- ------------=_1707983762-30962-1--