From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#67000: 30.0.50; [PATCH] Add support for reading/writing IELM input history Date: Thu, 14 Dec 2023 17:06:10 -0800 Message-ID: References: <87sf5ge0v6.fsf@runbox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20872"; mail-complaints-to="usenet@ciao.gmane.io" To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= , 67000@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 15 02:07:11 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rDwfX-0005ER-M1 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Dec 2023 02:07:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDwfQ-0001TU-4R; Thu, 14 Dec 2023 20:07:04 -0500 Original-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 1rDwfO-0001T6-P2 for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2023 20:07:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rDwfO-0005Fi-Gu for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2023 20:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rDwfO-0001zc-1i for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2023 20:07:02 -0500 X-Loop: help-debbugs@gnu.org 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 Original-Received: via spool by 67000-submit@debbugs.gnu.org id=B67000.17026023797608 (code B ref 67000); Fri, 15 Dec 2023 01:07:02 +0000 Original-Received: (at 67000) by debbugs.gnu.org; 15 Dec 2023 01:06:19 +0000 Original-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 Original-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 Original-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) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 14 Dec 2023 17:06:10 -0800 In-Reply-To: <87sf5ge0v6.fsf@runbox.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276240 Archived-At: 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