emacs-jupyter / jupyter

An interface to communicate with Jupyter kernels.
GNU General Public License v3.0
935 stars 92 forks source link

Interferance between emacs-jupyter and git-commit #269

Open MasonProtter opened 4 years ago

MasonProtter commented 4 years ago

Hello, so I've been having some trouble with emacs-jupyter whenever magit is loaded. I finally managed to narrow it down to the git-commit package which is required by magit. When both emacs-jupyter and git-commit are loaded if I try to start up a Jupyter session in an org notebook, or via jupyter-run-repl (i've tried both python and Julia kernels), I get the following stack-trace from the debugger:

Debugger entered--Lisp error: (error "Keyword argument :coding-system not one of (:name :buffer :command :coding :noquery :stop :connection-type :filter :sentinel :stderr :file-handler)")
  signal(error ("Keyword argument :coding-system not one of (:name :buffer :command :coding :noquery :stop :connection-type :filter :sentinel :stderr :file-handler)"))
  error("Keyword argument %s not one of (:name :buffer :command :coding :noquery :stop :connection-type :filter :sentinel :stderr :file-handler)" :coding-system)
  make-process--with-editor-process-filter(#<subr make-process> :name "zmq" :buffer #<buffer  *zmq*-862864> :noquery t :connection-type pipe :coding-system no-conversion :filter zmq--subprocess-filter :sentinel zmq--subprocess-sentinel :stderr #<process zmq stderr<4>> :command ("/usr/bin/emacs-26.3" "-Q" "-batch" "-L" "/home/mason/.emacs.d/elpa/zmq-20200305.2345/" "-l" "/home/mason/.emacs.d/elpa/zmq-20200305.2345/zmq.elc" "--eval" "(zmq--init-subprocess nil)"))
  apply(make-process--with-editor-process-filter #<subr make-process> (:name "zmq" :buffer #<buffer  *zmq*-862864> :noquery t :connection-type pipe :coding-system no-conversion :filter zmq--subprocess-filter :sentinel zmq--subprocess-sentinel :stderr #<process zmq stderr<4>> :command ("/usr/bin/emacs-26.3" "-Q" "-batch" "-L" "/home/mason/.emacs.d/elpa/zmq-20200305.2345/" "-l" "/home/mason/.emacs.d/elpa/zmq-20200305.2345/zmq.elc" "--eval" "(zmq--init-subprocess nil)")))
  make-process(:name "zmq" :buffer #<buffer  *zmq*-862864> :noquery t :connection-type pipe :coding-system no-conversion :filter zmq--subprocess-filter :sentinel zmq--subprocess-sentinel :stderr #<process zmq stderr<4>> :command ("/usr/bin/emacs-26.3" "-Q" "-batch" "-L" "/home/mason/.emacs.d/elpa/zmq-20200305.2345/" "-l" "/home/mason/.emacs.d/elpa/zmq-20200305.2345/zmq.elc" "--eval" "(zmq--init-subprocess nil)"))
  zmq-start-process((lambda (ctx) (push "/home/mason/.emacs.d/elpa/jupyter-20200417.1907/" load-path) (require (quote jupyter-ioloop)) (setq jupyter-ioloop-poller (zmq-poller)) (setq jupyter-ioloop-stdin (let ((sock (zmq-socket ctx zmq-PAIR))) (prog1 sock (zmq-connect sock (format "tcp://127.0.0.1:%s" 60948))))) (zmq-poller-add jupyter-ioloop-poller jupyter-ioloop-stdin zmq-POLLIN) (let (events) (condition-case nil (progn (setq jupyter-channel-ioloop-session (jupyter-session :id "d6254143-cad5-4021-abd1-61ec8d92c2d0" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976")) (require (quote jupyter-channel-ioloop)) (require (quote jupyter-zmq-channel-ioloop)) (push (quote jupyter-zmq-channel-ioloop--recv-messages) jupyter-ioloop-post-hook) (cl-loop for channel in (quote (:shell :stdin :iopub)) unless (object-assoc channel :type jupyter-channel-ioloop-channels) do (push (jupyter-zmq-channel :session jupyter-channel-ioloop-session :type channel) jupyter-channel-ioloop-channels)) (setq jupyter-ioloop-pre-hook (mapcar (lambda ... ...) (append jupyter-ioloop-pre-hook ...))) (zmq-prin1 (quote (start))) (let ((on-stdin ...)) (while t (run-hooks ...) (setq events ...) (let ... ...) (run-hook-with-args ... events)))) (quit (mapc (function jupyter-stop-channel) jupyter-channel-ioloop-channels) (zmq-prin1 (quote (quit))))))) :filter #f(compiled-function (event) #<bytecode 0x169d3fd>) :buffer nil)
  #f(compiled-function (arg1 arg2 &rest rest) #<bytecode 0x16b620d>)(#<jupyter-zmq-channel-ioloop jupyter-zmq-channel-ioloop> #<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm> :buffer nil)
  apply(#f(compiled-function (arg1 arg2 &rest rest) #<bytecode 0x16b620d>) (#<jupyter-zmq-channel-ioloop jupyter-zmq-channel-ioloop> #<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm> :buffer nil))
  #f(compiled-function (&rest cnm-args) #<bytecode 0x1679795>)(#<jupyter-zmq-channel-ioloop jupyter-zmq-channel-ioloop> #<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm> :buffer nil)
  #f(compiled-function (arg1 arg2 arg3 arg4 &rest rest) "Start IOLOOP, using SESSION to set the `jupyter-channel-ioloop-session'.\nAdd setup forms to IOLOOP that will initialize the\n`jupyter-channel-ioloop-session' variable to a `jupyter-session'\nbased on SESSION's id and key.  Also add\n`jupyter-ioloop-recv-messages' to `jupyter-ioloop-post-hook'.  In\naddition add the events send, start-channel, and stop-channel\nthat the parent Emacs process can send to the IOLOOP.  See\n`jupyter-channel-ioloop-add-send-event',\n`jupyter-channel-ioloop-add-start-channel-event', and\n`jupyter-ioloop-add-stop-channel-event'.\n\nAfter doing the above initialization, start the IOLOOP.  OBJ and\nBUFFER have the same meaning as in the method definition for\n`jupyter-ioloop'." #<bytecode 0xfc42ad>)(#f(compiled-function (&rest cnm-args) #<bytecode 0x1679795>) #<jupyter-zmq-channel-ioloop jupyter-zmq-channel-ioloop> #s(jupyter-session :conn-info (:kernel_name "julia-1.5" :transport "tcp" :ip "127.0.0.1" :signature_scheme "hmac-sha256" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976" :hb_port 46031 :stdin_port 32889 :control_port 36339 :shell_port 35481 :iopub_port 43957) :id "d6254143-cad5-4021-abd1-61ec8d92c2d0" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976") #<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm>)
  apply(#f(compiled-function (arg1 arg2 arg3 arg4 &rest rest) "Start IOLOOP, using SESSION to set the `jupyter-channel-ioloop-session'.\nAdd setup forms to IOLOOP that will initialize the\n`jupyter-channel-ioloop-session' variable to a `jupyter-session'\nbased on SESSION's id and key.  Also add\n`jupyter-ioloop-recv-messages' to `jupyter-ioloop-post-hook'.  In\naddition add the events send, start-channel, and stop-channel\nthat the parent Emacs process can send to the IOLOOP.  See\n`jupyter-channel-ioloop-add-send-event',\n`jupyter-channel-ioloop-add-start-channel-event', and\n`jupyter-ioloop-add-stop-channel-event'.\n\nAfter doing the above initialization, start the IOLOOP.  OBJ and\nBUFFER have the same meaning as in the method definition for\n`jupyter-ioloop'." #<bytecode 0xfc42ad>) #f(compiled-function (&rest cnm-args) #<bytecode 0x1679795>) (#<jupyter-zmq-channel-ioloop jupyter-zmq-channel-ioloop> #s(jupyter-session :conn-info (:kernel_name "julia-1.5" :transport "tcp" :ip "127.0.0.1" :signature_scheme "hmac-sha256" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976" :hb_port 46031 :stdin_port 32889 :control_port 36339 :shell_port 35481 :iopub_port 43957) :id "d6254143-cad5-4021-abd1-61ec8d92c2d0" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976") #<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm>))
  #f(compiled-function (&rest args) #<bytecode 0x143fef5>)(#<jupyter-zmq-channel-ioloop jupyter-zmq-channel-ioloop> #s(jupyter-session :conn-info (:kernel_name "julia-1.5" :transport "tcp" :ip "127.0.0.1" :signature_scheme "hmac-sha256" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976" :hb_port 46031 :stdin_port 32889 :control_port 36339 :shell_port 35481 :iopub_port 43957) :id "d6254143-cad5-4021-abd1-61ec8d92c2d0" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976") #<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm>)
  apply(#f(compiled-function (&rest args) #<bytecode 0x143fef5>) #<jupyter-zmq-channel-ioloop jupyter-zmq-channel-ioloop> (#s(jupyter-session :conn-info (:kernel_name "julia-1.5" :transport "tcp" :ip "127.0.0.1" :signature_scheme "hmac-sha256" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976" :hb_port 46031 :stdin_port 32889 :control_port 36339 :shell_port 35481 :iopub_port 43957) :id "d6254143-cad5-4021-abd1-61ec8d92c2d0" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976") #<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm>))
  #f(compiled-function (arg &rest args) #<bytecode 0x168f5dd>)(#<jupyter-zmq-channel-ioloop jupyter-zmq-channel-ioloop> #s(jupyter-session :conn-info (:kernel_name "julia-1.5" :transport "tcp" :ip "127.0.0.1" :signature_scheme "hmac-sha256" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976" :hb_port 46031 :stdin_port 32889 :control_port 36339 :shell_port 35481 :iopub_port 43957) :id "d6254143-cad5-4021-abd1-61ec8d92c2d0" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976") #<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm>)
  apply(#f(compiled-function (arg &rest args) #<bytecode 0x168f5dd>) #<jupyter-zmq-channel-ioloop jupyter-zmq-channel-ioloop> #s(jupyter-session :conn-info (:kernel_name "julia-1.5" :transport "tcp" :ip "127.0.0.1" :signature_scheme "hmac-sha256" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976" :hb_port 46031 :stdin_port 32889 :control_port 36339 :shell_port 35481 :iopub_port 43957) :id "d6254143-cad5-4021-abd1-61ec8d92c2d0" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976") #<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm>)
  jupyter-ioloop-start(#<jupyter-zmq-channel-ioloop jupyter-zmq-channel-ioloop> #s(jupyter-session :conn-info (:kernel_name "julia-1.5" :transport "tcp" :ip "127.0.0.1" :signature_scheme "hmac-sha256" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976" :hb_port 46031 :stdin_port 32889 :control_port 36339 :shell_port 35481 :iopub_port 43957) :id "d6254143-cad5-4021-abd1-61ec8d92c2d0" :key "d35099ad-8d9a-420d-bd3d-bad9b5976976") #<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm>)
  #f(compiled-function (comm) #<bytecode 0x16bc559>)(#<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm>)
  apply(#f(compiled-function (comm) #<bytecode 0x16bc559>) #<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm> nil)
  jupyter-comm-start(#<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm>)
  #f(compiled-function (comm obj) #<bytecode 0x128600d>)(#<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm> #<jupyter-org-client jupyter-org-client>)
  apply(#f(compiled-function (comm obj) #<bytecode 0x128600d>) #<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm> #<jupyter-org-client jupyter-org-client>)
  jupyter-comm-add-handler(#<jupyter-channel-ioloop-comm jupyter-channel-ioloop-comm> #<jupyter-org-client jupyter-org-client>)
  #f(compiled-function (client) #<bytecode 0x1292bf9>)(#<jupyter-org-client jupyter-org-client>)
  apply(#f(compiled-function (client) #<bytecode 0x1292bf9>) #<jupyter-org-client jupyter-org-client> nil)
  jupyter-start-channels(#<jupyter-org-client jupyter-org-client>)
  jupyter-start-new-kernel("julia-1.5" jupyter-org-client)
  jupyter-run-repl("julia-1.5" nil nil jupyter-org-client)
  #f(compiled-function (session kernel) "Call `jupyter-run-repl', passing KERNEL as argument." #<bytecode 0x134a37d>)(#s(org-babel-jupyter-session :name "jl2") "julia-1.5")
  apply(#f(compiled-function (session kernel) "Call `jupyter-run-repl', passing KERNEL as argument." #<bytecode 0x134a37d>) (#s(org-babel-jupyter-session :name "jl2") "julia-1.5"))
  #f(compiled-function (&rest cnm-args) #<bytecode 0x1439b6d>)()
  #f(compiled-function (cl--cnm session kernel) "Rename the returned client's REPL buffer to include SESSION's name.\nAlso set `jupyter-include-other-output' to nil for the session so\nthat output produced by other clients do not get handled by the\nclient." #<bytecode 0x1368d95>)(#f(compiled-function (&rest cnm-args) #<bytecode 0x1439b6d>) #s(org-babel-jupyter-session :name "jl2") "julia-1.5")
  apply(#f(compiled-function (cl--cnm session kernel) "Rename the returned client's REPL buffer to include SESSION's name.\nAlso set `jupyter-include-other-output' to nil for the session so\nthat output produced by other clients do not get handled by the\nclient." #<bytecode 0x1368d95>) #f(compiled-function (&rest cnm-args) #<bytecode 0x1439b6d>) (#s(org-babel-jupyter-session :name "jl2") "julia-1.5"))
  #f(compiled-function (&rest args) #<bytecode 0x1697b41>)(#s(org-babel-jupyter-session :name "jl2") "julia-1.5")
  apply(#f(compiled-function (&rest args) #<bytecode 0x1697b41>) #s(org-babel-jupyter-session :name "jl2") "julia-1.5")
  org-babel-jupyter-initiate-client(#s(org-babel-jupyter-session :name "jl2") "julia-1.5")
  org-babel-jupyter-initiate-session-by-key("jl2" ((:colname-names) (:rowname-names) (:result-params "replace" "scalar") (:result-type . value) (:results . "replace scalar") (:exports . "both") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:async . "yes") (:kernel . "julia-1.5") (:session . "jl2")))
  org-babel-jupyter-initiate-session("jl2" ((:colname-names) (:rowname-names) (:result-params "replace" "scalar") (:result-type . value) (:results . "replace scalar") (:exports . "both") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:async . "yes") (:kernel . "julia-1.5") (:session . "jl2")))
  org-babel-execute:jupyter-julia("" ((:colname-names) (:rowname-names) (:result-params "replace" "scalar") (:result-type . value) (:results . "replace scalar") (:exports . "both") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:async . "yes") (:kernel . "julia-1.5") (:session . "jl2")))
  org-babel-execute-src-block(nil ("jupyter-julia" "" ((:colname-names) (:rowname-names) (:result-params "scalar" "replace") (:result-type . value) (:results . "scalar replace") (:exports . "both") (:session . "jl2") (:kernel . "julia-1.5") (:async . "yes") (:tangle . "no") (:hlines . "no") (:noweb . "no") (:cache . "no")) "" nil 47 "(ref:%s)"))
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)

When I don't require git-commit, I do not suffer this issue.

Here's a minimal init.el to reproduce my problem:

(require 'package)
(setq package-enable-at-startup nil)

(setq package-archives
      '(("GNU ELPA"     . "https://elpa.gnu.org/packages/")
        ("MELPA Stable" . "https://stable.melpa.org/packages/")
        ("MELPA"        . "https://melpa.org/packages/"))
      package-archive-priorities
      '(("MELPA Stable" . 10)
        ("GNU ELPA"     . 5)
        ("MELPA"        . 0)))

(package-initialize)

(unless (package-installed-p 'use-package)
    (package-refresh-contents)
    (package-install 'use-package))

(eval-when-compile
  (require 'use-package))

(use-package jupyter
  :ensure t
  :config
  (require 'jupyter-julia))

(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (jupyter . t)))

(use-package git-commit
  :ensure t)

Commenting out the final two lines causes the problem to go away.

caadr commented 4 years ago

See https://github.com/hlissner/doom-emacs/issues/3384

Quick summary:

MasonProtter commented 4 years ago

Ah, nice! Updating magit fixes it now.

arthurcgusmao commented 4 years ago

For those who use straight.el: update the with-editor package (Magit alone won't suffice).