From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 26 07:45:27 2025 Received: (at submit) by debbugs.gnu.org; 26 Feb 2025 12:45:27 +0000 Received: from localhost ([127.0.0.1]:51399 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tnGn1-0007UP-Ac for submit@debbugs.gnu.org; Wed, 26 Feb 2025 07:45:27 -0500 Received: from lists.gnu.org ([2001:470:142::17]:38478) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tnGmy-0007NZ-Uy for submit@debbugs.gnu.org; Wed, 26 Feb 2025 07:45:25 -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 1tnGmb-0005u5-Gk for bug-gnu-emacs@gnu.org; Wed, 26 Feb 2025 07:45:01 -0500 Received: from dancol.org ([2600:3c01:e000:3d8::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tnGmZ-0003tU-Hg for bug-gnu-emacs@gnu.org; Wed, 26 Feb 2025 07:45:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From:Sender: Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=UwSYGfsBGa3uodYc/xxwfFm0DjJJLAif4gfz3Ns5Io8=; b=K19ZjDHg2dzsCfL2oARAtg+BqH Mgep5N2hMGH1tu749onGiXh0ceuhxnAKDwBTchFzAV6qqO4XL6X1ksOqlWbgB//xinAE5R6MCZ4R1 nt+iCvtAtreibMkOwKTM+90BGd5g3OeERUbzQx6TfKiuuUF6WAEHjAIuaT97xhSKD56SSoffB8GU+ SLfDqqbDPiEHF9JOarnVpWOBqz5cEzo/28iL7Mq8+BHzjTOoBhrAxKL+uQDaCl0WyLctOrxRX5IuG ekxB7Bb6RBY+Dx44u152dMj4uknd2keN5cVfrvzMebUcklNHYD+fCW8YJ0xRaqsAwy7nzW/wNSnLQ 6ohXBW/Q==; Received: from dancol by dancol.org with local (Exim 4.96) (envelope-from ) id 1tnGmQ-001Aum-03 for bug-gnu-emacs@gnu.org; Wed, 26 Feb 2025 07:44:50 -0500 From: Daniel Colascione To: bug-gnu-emacs@gnu.org Subject: ielm clobbers history on C-c C-c, C-d User-Agent: mu4e 1.12.8; emacs 31.0.50 Date: Wed, 26 Feb 2025 07:44:54 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2600:3c01:e000:3d8::1; envelope-from=dancol@dancol.org; helo=dancol.org X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 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, GAPPY_SUBJECT=0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) 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.0 (/) When the ielm inferior dummy process exits, we don't save its history: when we next start ielm, we reload its history from the save file, losing any entries between last history save and the present. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 26 10:58:50 2025 Received: (at 76585) by debbugs.gnu.org; 26 Feb 2025 15:58:50 +0000 Received: from localhost ([127.0.0.1]:54950 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tnJo9-0001sw-Vt for submit@debbugs.gnu.org; Wed, 26 Feb 2025 10:58:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45854) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tnJo5-0001sd-GS for 76585@debbugs.gnu.org; Wed, 26 Feb 2025 10:58:48 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tnJnz-0004wZ-Np; Wed, 26 Feb 2025 10:58:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=DX+ExpwrqDU9LAeT2gZxnGvC1fqVywDua0w+qLJdN/k=; b=JGt/rgT45VNk X/ur7Z5xsFEXzfYnlz2RcUpgiZp3nD/t37fJ8Lh9l/wJxuiD2b71gwCq05QWuf/68OCyAGaEyts0b mEmALPmEsxZA+0EgJHRKPgRDpViWE5Uy6supEtemv4wkkJuwNAEMIupZElwPJyDSgkFpeepp2dvg4 SgQn3sSIy19OHnnidAd3vKhhW0ktbzBOy0DAFoqM/1ul1EGL8Wvl9xrV+Q0D+H53x+XxgPCTm+SP7 lpHGNFdto1KET3j0Q9QqTnVTN+3c/HKKTcTx5UdtmLsY/i0CSRWyTHAbmhW+vyRw1oIQSVnpO0JVy LGTZA5Z9XEl1vqundeJEzg==; Date: Wed, 26 Feb 2025 17:58:25 +0200 Message-Id: <86jz9cvgta.fsf@gnu.org> From: Eli Zaretskii To: Daniel Colascione In-Reply-To: (message from Daniel Colascione on Wed, 26 Feb 2025 07:44:54 -0500) Subject: Re: bug#76585: ielm clobbers history on C-c C-c, C-d References: X-Spam-Score: -2.2 (--) X-Debbugs-Envelope-To: 76585 Cc: 76585@debbugs.gnu.org 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: -3.2 (---) > From: Daniel Colascione > Date: Wed, 26 Feb 2025 07:44:54 -0500 > > When the ielm inferior dummy process exits, we don't save its history: > when we next start ielm, we reload its history from the save file, > losing any entries between last history save and the present. I don't use IELM too often, so apologies if what I ask below makes no sense or is silly: you are saying that ielm--input-history-writer is not called when the dummy process exits, is that right? From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 26 19:09:22 2025 Received: (at 76585) by debbugs.gnu.org; 27 Feb 2025 00:09:22 +0000 Received: from localhost ([127.0.0.1]:56249 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tnRSs-0004Ko-4a for submit@debbugs.gnu.org; Wed, 26 Feb 2025 19:09:22 -0500 Received: from dancol.org ([2600:3c01:e000:3d8::1]:37798) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tnRSp-0004Kc-0S for 76585@debbugs.gnu.org; Wed, 26 Feb 2025 19:09:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Auxi92acS5s/t+QiXuoCpLydAQkg4jbsHxvrQcpBQwc=; b=U6AtbnNGUmAdg8Bm4evdCyZy+l 0pLB5+l2yI81tahisGCuoqJ/aq/dWb+LRA/C2Y5Q99TWHg4lukHZVemHbvgkJwiNrywNirsJO4wSh HJ/tpDXGJLGJBXwbuJ3Va07jTbJWlyOW6G715l7V8O2Fmy4FwNZQ/IrdXbc4kkokd77gdvE63MOE4 N/DjMT/m3jKH6xcPm6QpzNfLsE6m99PxUY91ut6GKx8Bcas/ayhesresU8yng9eKg7VoVFYk+Q+gQ kaZwIrcNamClm+G0oYh+2B+TwcDf1vldJL+UHYNElQxEdJcL+VwvT2z9jRf5BejFgg8TC+Uo3DYqF EST/nvaQ==; Received: from dancol by dancol.org with local (Exim 4.96) (envelope-from ) id 1tnRSh-001DPt-1w; Wed, 26 Feb 2025 19:09:11 -0500 From: Daniel Colascione To: Eli Zaretskii Subject: Re: bug#76585: ielm clobbers history on C-c C-c, C-d In-Reply-To: <86jz9cvgta.fsf@gnu.org> References: <86jz9cvgta.fsf@gnu.org> User-Agent: mu4e 1.12.8; emacs 31.0.50 Date: Wed, 26 Feb 2025 19:09:16 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 76585 Cc: 76585@debbugs.gnu.org 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.9 (/) Eli Zaretskii writes: >> From: Daniel Colascione >> Date: Wed, 26 Feb 2025 07:44:54 -0500 >> >> When the ielm inferior dummy process exits, we don't save its history: >> when we next start ielm, we reload its history from the save file, >> losing any entries between last history save and the present. > > I don't use IELM too often, Is there something better? > so apologies if what I ask below makes no > sense or is silly: you are saying that ielm--input-history-writer is > not called when the dummy process exits, is that right? When I start Emacs, if I type M-x ielm, then M-p through history, I might observe (most recent first) history entries C, B, and A, with the three entries coming from the ielm history file. If I type additional ielm commands D and E, then at the next prompt after E, if I hit M-p, I see E, and if I hit M-p again, I get D, then C, and so on. If I hit C-c C-c, killing the ielm subprocess, then M-x ielm again, then press M-p, I see C, B, A --- as if my D, E session had never happened. From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 27 09:13:50 2025 Received: (at 76585) by debbugs.gnu.org; 27 Feb 2025 14:13:50 +0000 Received: from localhost ([127.0.0.1]:60568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tnee5-0006zh-M3 for submit@debbugs.gnu.org; Thu, 27 Feb 2025 09:13:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41356) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tnee2-0006zK-Rv for 76585@debbugs.gnu.org; Thu, 27 Feb 2025 09:13:47 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tnedw-0002S3-3H; Thu, 27 Feb 2025 09:13:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=YfG1PvKygs4LFq16SkOAFJQWVL42ihP48tSUydxO7hM=; b=QDGakO3WLcFA Nb3hh2K0eLZsAlGW+DZKSEIPzwDWUWH87wfZew+Dq/RNn26vQ5N5+oGIiLvD/8s+K3IWZMFsJDTQq tHh/hYWU50J9brn3t65JA8i9C9Js/LH0+rWmiZOMpKo57lskv+E3aJePZPemt/LhvvYti6VEV6bKe 9qo2AvhUs6+S1YTSHTgLuf4kb+gPVd0VHZ2Ez20QequBlfAWifinjL5jj181fZAhDMKkRe8wd+u4s Y/KyebgPTbaHJeHyTSgqzORwGjyhLYopOJ9g8WzWZiN8v2/sAEbGrnHaep9xg2PLx7XfiDWkqgilK bOJFxa/nS1KseHHTbc5jjQ==; Date: Thu, 27 Feb 2025 16:13:35 +0200 Message-Id: <86ikovtr00.fsf@gnu.org> From: Eli Zaretskii To: Daniel Colascione In-Reply-To: (message from Daniel Colascione on Wed, 26 Feb 2025 19:09:16 -0500) Subject: Re: bug#76585: ielm clobbers history on C-c C-c, C-d References: <86jz9cvgta.fsf@gnu.org> X-Spam-Score: -2.2 (--) X-Debbugs-Envelope-To: 76585 Cc: 76585@debbugs.gnu.org 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: -3.2 (---) > From: Daniel Colascione > Cc: 76585@debbugs.gnu.org > Date: Wed, 26 Feb 2025 19:09:16 -0500 > > Eli Zaretskii writes: > > > I don't use IELM too often, > > Is there something better? Not necessarily better, but simpler: "M-:". > When I start Emacs, if I type M-x ielm, then M-p through history, I > might observe (most recent first) history entries C, B, and A, with the > three entries coming from the ielm history file. If I type additional > ielm commands D and E, then at the next prompt after E, if I hit M-p, I > see E, and if I hit M-p again, I get D, then C, and so on. If I hit C-c > C-c, killing the ielm subprocess, then M-x ielm again, then press M-p, I > see C, B, A --- as if my D, E session had never happened. Thanks. Does the below give good results? diff --git a/lisp/ielm.el b/lisp/ielm.el index b3cd02b..c651612 100644 --- a/lisp/ielm.el +++ b/lisp/ielm.el @@ -521,6 +521,12 @@ ielm--input-history-writer (with-current-buffer buf (comint-write-input-ring)))) +(defun ielm--write-history-on-interrupt (_proc _group) + "Save the IELM input history when the process is interrupted." + (funcall (ielm--input-history-writer (current-buffer))) + ;; Let the rest of the hook functions run as well. + nil) + ;;; Major mode (define-derived-mode inferior-emacs-lisp-mode comint-mode "IELM" @@ -658,7 +664,9 @@ inferior-emacs-lisp-mode '(rear-nonsticky t field output inhibit-line-move-field-capture t)))) (comint-output-filter (ielm-process) ielm-prompt-internal) (set-marker comint-last-input-start (ielm-pm)) - (set-process-filter (get-buffer-process (current-buffer)) 'comint-output-filter))) + (set-process-filter (get-buffer-process (current-buffer)) 'comint-output-filter) + (add-hook 'interrupt-process-functions + #'ielm--write-history-on-interrupt -1 t))) (defun ielm-get-old-input nil ;; Return the previous input surrounding point From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 28 16:27:10 2025 Received: (at 76585) by debbugs.gnu.org; 28 Feb 2025 21:27:11 +0000 Received: from localhost ([127.0.0.1]:53904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1to7t0-0005ES-Cw for submit@debbugs.gnu.org; Fri, 28 Feb 2025 16:27:10 -0500 Received: from dancol.org ([2600:3c01:e000:3d8::1]:47556) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1to7sx-0005EH-0S for 76585@debbugs.gnu.org; Fri, 28 Feb 2025 16:27:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=zhky96FYeMqpOt006uGyqgJl8pOXKoaXL+sJJ5PaH7k=; b=oiOzZEQO7iZ/oV+w8jTEJRxden jTuhXAVL02jBa20fUTMYJT9wzefEuPhauUqTDwJzhBXAvtB8UDbInCDLTwQRx5Ud6CozA6tOxyVLe 9dGv7h+tO83T7RhRRxOCX0HAkcrvy4k/utSUzWZW9TLFZiw7GHCm5b2Q+sVlP12GcvMT5vcOARwil IqDzkfvIwwpNWqXKsav+A0agSZ+uhB8ZdPBkrZ/z/biaku+z002IdZrgujHUhW68z4y0k9oFg9kJp ziMDE3fC1qjJimObYNcS/EunQlNU0ZJugNLgv1ghSPcL5s5fMcbSGmJ56tnZs0G7OwprR2aI0m5/F OzJJGMcg==; Received: from dancol by dancol.org with local (Exim 4.96) (envelope-from ) id 1to7so-001OWU-0W; Fri, 28 Feb 2025 16:26:58 -0500 From: Daniel Colascione To: Eli Zaretskii Subject: Re: bug#76585: ielm clobbers history on C-c C-c, C-d In-Reply-To: <86ikovtr00.fsf@gnu.org> References: <86jz9cvgta.fsf@gnu.org> <86ikovtr00.fsf@gnu.org> User-Agent: mu4e 1.12.8; emacs 31.0.50 Date: Fri, 28 Feb 2025 16:27:04 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 76585 Cc: 76585@debbugs.gnu.org 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.9 (/) Eli Zaretskii writes: >> From: Daniel Colascione >> Cc: 76585@debbugs.gnu.org >> Date: Wed, 26 Feb 2025 19:09:16 -0500 >> >> Eli Zaretskii writes: >> >> > I don't use IELM too often, >> >> Is there something better? > > Not necessarily better, but simpler: "M-:". > >> When I start Emacs, if I type M-x ielm, then M-p through history, I >> might observe (most recent first) history entries C, B, and A, with the >> three entries coming from the ielm history file. If I type additional >> ielm commands D and E, then at the next prompt after E, if I hit M-p, I >> see E, and if I hit M-p again, I get D, then C, and so on. If I hit C-c >> C-c, killing the ielm subprocess, then M-x ielm again, then press M-p, I >> see C, B, A --- as if my D, E session had never happened. > > Thanks. Does the below give good results? > > diff --git a/lisp/ielm.el b/lisp/ielm.el > index b3cd02b..c651612 100644 > --- a/lisp/ielm.el > +++ b/lisp/ielm.el > @@ -521,6 +521,12 @@ ielm--input-history-writer > (with-current-buffer buf > (comint-write-input-ring)))) > > +(defun ielm--write-history-on-interrupt (_proc _group) > + "Save the IELM input history when the process is interrupted." > + (funcall (ielm--input-history-writer (current-buffer))) > + ;; Let the rest of the hook functions run as well. > + nil) > + > ;;; Major mode > > (define-derived-mode inferior-emacs-lisp-mode comint-mode "IELM" > @@ -658,7 +664,9 @@ inferior-emacs-lisp-mode > '(rear-nonsticky t field output inhibit-line-move-field-capture t)))) > (comint-output-filter (ielm-process) ielm-prompt-internal) > (set-marker comint-last-input-start (ielm-pm)) > - (set-process-filter (get-buffer-process (current-buffer)) 'comint-output-filter))) > + (set-process-filter (get-buffer-process (current-buffer)) 'comint-output-filter) > + (add-hook 'interrupt-process-functions > + #'ielm--write-history-on-interrupt -1 t))) > > (defun ielm-get-old-input nil > ;; Return the previous input surrounding point This works. Thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 01 03:28:57 2025 Received: (at 76585-done) by debbugs.gnu.org; 1 Mar 2025 08:28:57 +0000 Received: from localhost ([127.0.0.1]:60478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1toIDQ-0004Tx-V8 for submit@debbugs.gnu.org; Sat, 01 Mar 2025 03:28:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37722) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1toIDO-0004TF-Fs for 76585-done@debbugs.gnu.org; Sat, 01 Mar 2025 03:28:54 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1toIDI-0004Uw-FP; Sat, 01 Mar 2025 03:28:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=fM7vrLK47J0Wh8OcbT7jtAnevZJVSsT6/AjVLl42bsM=; b=Ttyd5UBi8Md8 /3BCF5YB0x6tEGPjWOXF+swW0mjFBkqdG3NsmfAS/XtsVjA9l31fl+ATEvi0CRs/BF7gmftRugmLs QZKYaFmCtdrQIVeFXznoLDjzdgp2I11Zdpz/2yy661voiazXe5qTdBXsjIgAnGMnTZ2eRO8MfAbd2 t8fAyEqvbHxQLBRLBx3A21oY79jp0eN08EP/N5l3X9CN98vMr5e/cY9IJVQFqfmEPWGrPO9F1xOWn 2rCD1kwJiPq2GGvaLgudBoCfZfAGPS+WUHXzUEpjeMkjsv0mw+WLnQIc/Q19CWrqDuPNqedZcrra2 wC7WUkfVlPbor5RUABG3uA==; Date: Sat, 01 Mar 2025 10:28:43 +0200 Message-Id: <86y0xpqhms.fsf@gnu.org> From: Eli Zaretskii To: Daniel Colascione In-Reply-To: (message from Daniel Colascione on Fri, 28 Feb 2025 16:27:04 -0500) Subject: Re: bug#76585: ielm clobbers history on C-c C-c, C-d References: <86jz9cvgta.fsf@gnu.org> <86ikovtr00.fsf@gnu.org> X-Spam-Score: -2.2 (--) X-Debbugs-Envelope-To: 76585-done Cc: 76585-done@debbugs.gnu.org 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: -3.2 (---) > From: Daniel Colascione > Cc: 76585@debbugs.gnu.org > Date: Fri, 28 Feb 2025 16:27:04 -0500 > > Eli Zaretskii writes: > > > Thanks. Does the below give good results? > > > > diff --git a/lisp/ielm.el b/lisp/ielm.el > > index b3cd02b..c651612 100644 > > --- a/lisp/ielm.el > > +++ b/lisp/ielm.el > > @@ -521,6 +521,12 @@ ielm--input-history-writer > > (with-current-buffer buf > > (comint-write-input-ring)))) > > > > +(defun ielm--write-history-on-interrupt (_proc _group) > > + "Save the IELM input history when the process is interrupted." > > + (funcall (ielm--input-history-writer (current-buffer))) > > + ;; Let the rest of the hook functions run as well. > > + nil) > > + > > ;;; Major mode > > > > (define-derived-mode inferior-emacs-lisp-mode comint-mode "IELM" > > @@ -658,7 +664,9 @@ inferior-emacs-lisp-mode > > '(rear-nonsticky t field output inhibit-line-move-field-capture t)))) > > (comint-output-filter (ielm-process) ielm-prompt-internal) > > (set-marker comint-last-input-start (ielm-pm)) > > - (set-process-filter (get-buffer-process (current-buffer)) 'comint-output-filter))) > > + (set-process-filter (get-buffer-process (current-buffer)) 'comint-output-filter) > > + (add-hook 'interrupt-process-functions > > + #'ielm--write-history-on-interrupt -1 t))) > > > > (defun ielm-get-old-input nil > > ;; Return the previous input surrounding point > > This works. Thanks Thanks, installed on the master branch, and closing the bug. From unknown Fri Jun 20 07:19:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 29 Mar 2025 11:24:45 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator