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: Sat, 13 Jan 2024 01:08:49 -0600 Message-ID: References: <87sf5ge0v6.fsf@runbox.com> <87a5pl1qym.fsf@runbox.com> <87y1d0p9ic.fsf@runbox.com> <874jfibkju.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="30005"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67000@debbugs.gnu.org, Eli Zaretskii To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 13 08:09:09 2024 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 1rOY8i-0007ZH-Ct for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Jan 2024 08:09:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOY8f-000431-AA; Sat, 13 Jan 2024 02:09:05 -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 1rOY8e-00042d-Bg for bug-gnu-emacs@gnu.org; Sat, 13 Jan 2024 02:09:04 -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 1rOY8e-0005tD-3G for bug-gnu-emacs@gnu.org; Sat, 13 Jan 2024 02:09:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rOY8b-0002jX-WD for bug-gnu-emacs@gnu.org; Sat, 13 Jan 2024 02:09: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: 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 Original-Received: via spool by 67000-submit@debbugs.gnu.org id=B67000.170512973810495 (code B ref 67000); Sat, 13 Jan 2024 07:09:01 +0000 Original-Received: (at 67000) by debbugs.gnu.org; 13 Jan 2024 07:08:58 +0000 Original-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 Original-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 Original-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) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 13 Jan 2024 01:08:49 -0600 In-Reply-To: <874jfibkju.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:278093 Archived-At: 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').