millejoh / emacs-ipython-notebook

Jupyter notebook client in Emacs
http://millejoh.github.io/emacs-ipython-notebook/
GNU General Public License v3.0
1.47k stars 122 forks source link

Error (ein): Undo failure diagnostic (with MRE) #670

Closed veprbl closed 4 years ago

veprbl commented 4 years ago

Problem description

Exception pops up when notebook is running, the undo is broken afterwards.

Steps to reproduce the problem

  1. Start Emacs (ein from the current master branch which is at 34e9ef39d161cc60d7cd823d9b2610dc0ad10ed9):
    emacs -Q -f package-initialize --eval "(setq debug-on-error t)"
  2. M-x, ein:notebooklist-login, connect to a jupyter-notebook
  3. Open a new notebook
  4. Enter following into the cell
    import time
    while True:
    for i in range(10):
        print(f"{i}\r", end="")
        time.sleep(0.1)
  5. Execute: C-c C-c
  6. Enter minibuffer and leave: M-x C-g
  7. Observe popup:
    Error (ein): Undo failure diagnostic (nil (nil comint-must-overwrite nil 114 . 115) (6 . 114) (
    . 116) (5 . 114) (
    . 116) (nil comint-must-overwrite t 114 . 115) (nil comint-must-overwrite nil 114 . 115) (4 . 114) (
    . 116) (3 . 114) (
    . 116) (nil comint-must-overwrite t 114 . 115) (nil comint-must-overwrite nil 114 . 115) (2 . 114) (
    . 116) (1 . 114) (
    . 116) (nil comint-must-overwrite t 114 . 115) (nil comint-must-overwrite nil 114 . 115) (0 . 114) (
    . 116) (9 . 114) (
    . 116) (nil comint-must-overwrite t 114 . 115) (nil comint-must-overwrite nil 114 . 115) (8 . 114) (
    . 116) (7 . 114) (
    . 116) (nil comint-must-overwrite t 114 . 115) (nil comint-must-overwrite nil 114 . 115) (6 . 114) (
    . 116) (5 . 114) (
    . 116) (nil comint-must-overwrite t 114 . 115) nil (nil rear-nonsticky nil 112 . 113) (nil fontified nil 10 . 113) (10 . 113) (t . 0)) (1e7d8 1e7d8 1e7d8 1e7d8 1e7d8) | 37
  8. Interrupt notebook
  9. Observe that undo doesn't work anymore
  10. Switch to the *Messages* buffer, observe
    ein: [info] WS action [(error ein:worksheet--jigger-undo-list: aborting)] on-message (ws://127.0.0.1:8888/api/kernels/09aedf37-9456-4fdf-aec0-d93fb59896b9/channels?session_id=9fed7b1a-7aaf-43d0-b2a6-50ba3d36e56c)

System info:

("EIN system info"
 :emacs-version
 "GNU Emacs 26.3 (build 1, x86_64-apple-darwin17.7.0, NS appkit-1561.60 Version 10.13.6 (Build 17G65))"
 :emacs-bzr-version nil
 :window-system ns
 :emacs-variant nil
 :os
 (:uname
  "This is a macOS system"
  :lsb-release nil)
 :notebook nil
 :ipython
 "/nix/store/rrqk34hkyi38kdls1gzizwbpvpncpq6d-emacs-26.3/bin/emacs: /usr/local/bin/ipython: No such file or directory
"
 :image-types
 (svg png gif tiff jpeg xpm xbm pbm)
 :image-types-available
 (svg png gif tiff jpeg xpm xbm pbm)
 :request
 (:backend curl)
 :ein
 (:version "20200219.1501"
       :source-dir
       "/nix/store/m4n0z4kx8rlk762s3j9dzafv3bz1a5zj-emacs-packages-deps/share/emacs/site-lisp/elpa/ein-20200219.1501/")
 :lib
 ((:name "websocket"
     :path
     "/nix/store/m4n0z4kx8rlk762s3j9dzafv3bz1a5zj-emacs-packages-deps/share/emacs/site-lisp/elpa/websocket-20200102.637/websocket.elc"
     :featurep t
     :version-var websocket-version
     :version "1.12")
  (:name "anaphora"
     :path
     "/nix/store/m4n0z4kx8rlk762s3j9dzafv3bz1a5zj-emacs-packages-deps/share/emacs/site-lisp/elpa/anaphora-20180618.2200/anaphora.elc"
     :featurep t
     :version-var nil
     :version nil)
  (:name "request"
     :path
     "/nix/store/m4n0z4kx8rlk762s3j9dzafv3bz1a5zj-emacs-packages-deps/share/emacs/site-lisp/elpa/request-20200219.2257/request.elc"
     :featurep t
     :version-var request-version
     :version "0.3.0")
  (:name "deferred"
     :path
     "/nix/store/m4n0z4kx8rlk762s3j9dzafv3bz1a5zj-emacs-packages-deps/share/emacs/site-lisp/elpa/deferred-20170901.1330/deferred.elc"
     :featurep t
     :version-var deferred:version
     :version "0.5.0")
  (:name "polymode"
     :path
     "/nix/store/m4n0z4kx8rlk762s3j9dzafv3bz1a5zj-emacs-packages-deps/share/emacs/site-lisp/elpa/polymode-20191208.1239/polymode.elc"
     :featurep t
     :version-var nil
     :version nil)
  (:name "dash"
     :path
     "/nix/store/m4n0z4kx8rlk762s3j9dzafv3bz1a5zj-emacs-packages-deps/share/emacs/site-lisp/elpa/dash-20200119.2310/dash.elc"
     :featurep t
     :version-var nil
     :version nil)))
dickmao commented 4 years ago

Thanks for finding this bug and the MRE. 4403b65 should fix. I also added some undo caveats to the README.

veprbl commented 4 years ago

@dickmao I've tested the fix and it appears to be working just fine. Thank you for fixing this!