GNU bug report logs - #31326
eshell/clear goes into infinite loop with eshell-smart-initialize

Previous Next

Package: emacs;

Reported by: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>

Date: Tue, 1 May 2018 06:15:02 UTC

Severity: normal

Tags: confirmed, fixed, patch

Merged with 37198

Found in versions 25, 26.2, 27.0.50

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 31326 <at> debbugs.gnu.org (full text, mbox):

From: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>
To: 31326 <at> debbugs.gnu.org, npostavs <at> gmail.com
Subject: Re: bug#31326: 27.0.50; eshell/clear exceeds max-lisp-eval-depth
Date: Wed, 2 May 2018 23:09:55 -0500

On 05/01/2018 07:21 AM, Noam Postavsky wrote:
> retitle 31326 eshell/clear goes into infinite loop with eshell-smart-initialize
> found 31326 25
> tags 31326 + confirmed
> quit
>
> Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org> writes:
>
>> The eshell/clear elisp function seems to go into an infinite loop before
>> ending in an error when the eshell smart display functionality is
>> enabled in eshell-mode-hook. Several "Error during redisplay" messages
>> are printed to *Messages* buffer.
>>
>> Steps to reproduce:
>> 1. ./emacs -Q
>> 2. In the scratch buffer evaluate:
>> (require 'em-smart)
>> (add-hook 'eshell-mode-hook 'eshell-smart-initialize)
>> 4. M-x eshell
>> 5. type "clear" in eshell and press RET
> This reproduces back to 25.3; it doesn't happen in 24.5, but "clear"
> seems to do nothing in that version.  I caught a backtrace (attached)
> with M-x toggle-debug-on-quit and quickly hitting C-g.
>

I did a little more investigation into this issue. While I don't fully 
understand all the code paths of how it works, I found that let binding 
eshell-input-filter-functions to nil stops the infinite looping.

Before issuing the clear command in eshell, 
eshell-input-filter-functions contains this list:
    (eshell-smart-display-setup eshell-add-to-history)

The original eshell/clear implementation just removes 
eshell-add-to-history, so eshell-input-filter-functions is just this 
list (which results in infinite looping):
    (eshell-smart-display-setup)

Here's a diff for the change that works for me:

diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index bbb74c3d86..9f854c7d90 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -884,8 +884,7 @@ eshell/clear
   (interactive)
   (if scrollback
       (eshell/clear-scrollback)
-    (let ((eshell-input-filter-functions
-           (remq 'eshell-add-to-history eshell-input-filter-functions)))
+    (let ((eshell-input-filter-functions nil))
       (insert (make-string (window-size) ?\n))
       (eshell-send-input))))

-- 
Jonathan Kyle Mitchell





This bug report was last modified 5 years and 268 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.