Skip to content

jupyter-inspect-at-point does not work after latest commits #585

Open
@aseltmann

Description

@aseltmann

I tried updating my emacs packages today and I noticed that jupyter-inspect-at-point did not work in org source blocks for e.g. jupyter-python blocks. I recently tried to setup eglot with pyright, and now ruff-flymake, and I am using doom emacs, so I am not always sure where my problems come from. But I suspect some change in emacs-jupyter, because if I leave everything as-is and pin the jupyter package to fcb9c7e (last december), inspection still works.

Any help is appreciated.

This is the debugger output if I run jupyter-inspect-at-point in an org src block in the current commit 3615c2de16988c4dd9d1978bfa10ee3092e85b33

doom debugger output
 jupyter-org--set-src-block-cache()
  jupyter-org-src-block-params()
  jupyter-org--with-src-block-client(#f(compiled-function () #<bytecode -0xf4d98e1312d7b15>))
  #f(compiled-function (cl--cnm &rest ignore) #<bytecode 0xbb7682625171d17>)(#f(compiled-function (&rest args) #<bytecode 0x19825e8719c8aca5>) "print(\"test\")" 5 nil 0)
  apply(#f(compiled-function (cl--cnm &rest ignore) #<bytecode 0xbb7682625171d17>) #f(compiled-function (&rest args) #<bytecode 0x19825e8719c8aca5>) ("print(\"test\")" 5 nil 0))
  #f(compiled-function (&rest ignore) #<bytecode -0x7797c9ea4cd07db>)("print(\"test\")" 5 nil 0)
  apply(#f(compiled-function (&rest ignore) #<bytecode -0x7797c9ea4cd07db>) ("print(\"test\")" 5 nil 0))
  jupyter-inspect("print(\"test\")" 5 nil 0)
  jupyter-inspect-at-point(nil 0 t)
  funcall-interactively(jupyter-inspect-at-point nil 0 t)
  call-interactively(jupyter-inspect-at-point)
  (and (require 'jupyter nil t) (call-interactively #'jupyter-inspect-at-point) (display-buffer (help-buffer)) 'deferred)
  (cond ((string-prefix-p "jupyter-" (car info)) (and (require 'jupyter nil t) (call-interactively #'jupyter-inspect-at-point) (display-buffer (help-buffer)) 'deferred)) ((and (eq mode 'emacs-lisp-mode) (fboundp '+emacs-lisp-lookup-documentation)) (+emacs-lisp-lookup-documentation identifier) 'deferred) ((user-error "Documentation lookup in SRC blocks isn't supported yet")))
  (let ((mode (org-src-get-lang-mode (or (org-eldoc-get-src-lang) (user-error "No lang specified for this src block")))) (info (org-babel-get-src-block-info t))) (cond ((string-prefix-p "jupyter-" (car info)) (and (require 'jupyter nil t) (call-interactively #'jupyter-inspect-at-point) (display-buffer (help-buffer)) 'deferred)) ((and (eq mode 'emacs-lisp-mode) (fboundp '+emacs-lisp-lookup-documentation)) (+emacs-lisp-lookup-documentation identifier) 'deferred) ((user-error "Documentation lookup in SRC blocks isn't supported yet"))))
  (progn (let ((mode (org-src-get-lang-mode (or (org-eldoc-get-src-lang) (user-error "No lang specified for this src block")))) (info (org-babel-get-src-block-info t))) (cond ((string-prefix-p "jupyter-" (car info)) (and (require 'jupyter nil t) (call-interactively #'jupyter-inspect-at-point) (display-buffer (help-buffer)) 'deferred)) ((and (eq mode 'emacs-lisp-mode) (fboundp '+emacs-lisp-lookup-documentation)) (+emacs-lisp-lookup-documentation identifier) 'deferred) ((user-error "Documentation lookup in SRC blocks isn't supported yet")))))
  (if (org-in-src-block-p t) (progn (let ((mode (org-src-get-lang-mode (or (org-eldoc-get-src-lang) (user-error "No lang specified for this src block")))) (info (org-babel-get-src-block-info t))) (cond ((string-prefix-p "jupyter-" (car info)) (and (require 'jupyter nil t) (call-interactively #'jupyter-inspect-at-point) (display-buffer (help-buffer)) 'deferred)) ((and (eq mode 'emacs-lisp-mode) (fboundp '+emacs-lisp-lookup-documentation)) (+emacs-lisp-lookup-documentation identifier) 'deferred) ((user-error "Documentation lookup in SRC blocks isn't supported yet"))))))
  +org-lookup-documentation-handler("print")
  funcall(+org-lookup-documentation-handler "print")
  (if (commandp handler) (call-interactively handler) (funcall handler identifier))
  +lookup--run-handler(+org-lookup-documentation-handler "print")
  (condition-case e (+lookup--run-handler handler identifier) ((debug error) (if (and (not doom-inhibit-log) (or (not noninteractive) (<= 2 doom-log-level))) (progn (doom--log 2 "Lookup handler %S threw an error: %s" handler e))) 'fail))
  (let ((wconf (current-window-configuration)) (result (condition-case e (+lookup--run-handler handler identifier) ((debug error) (if (and (not doom-inhibit-log) (or ... ...)) (progn (doom--log 2 "Lookup handler %S threw an error: %s" handler e))) 'fail)))) (cond ((eq result 'fail) (set-window-configuration wconf) nil) ((or (get handler '+lookup-async) (eq result 'deferred))) ((or result (null origin) (/= (point-marker) origin)) (prog1 (point-marker) (set-window-configuration wconf)))))
  (condition-case e (let ((wconf (current-window-configuration)) (result (condition-case e (+lookup--run-handler handler identifier) ((debug error) (if (and ... ...) (progn ...)) 'fail)))) (cond ((eq result 'fail) (set-window-configuration wconf) nil) ((or (get handler '+lookup-async) (eq result 'deferred))) ((or result (null origin) (/= (point-marker) origin)) (prog1 (point-marker) (set-window-configuration wconf))))) ((debug error user-error) (message "Lookup handler %S: %s" handler e) nil))
  +lookup--run-handlers(+org-lookup-documentation-handler "print" #<marker at 88 in *doom:scratch*>)
  run-hook-wrapped(+lookup--run-handlers +org-lookup-documentation-handler "print" #<marker at 88 in *doom:scratch*>)
  (if arg (let* ((handler (and t (intern-soft (completing-read "Select lookup handler: " (delete-dups ...) nil t))))) (if handler (+lookup--run-handlers handler identifier origin) (user-error "No lookup handler selected"))) (run-hook-wrapped handlers #'+lookup--run-handlers identifier origin))
  (let* ((origin (point-marker)) (handlers (plist-get (list :definition '+lookup-definition-functions :implementations '+lookup-implementations-functions :type-definition '+lookup-type-definition-functions :references '+lookup-references-functions :documentation '+lookup-documentation-functions :file '+lookup-file-functions) prop)) (result (if arg (let* ((handler (and t ...))) (if handler (+lookup--run-handlers handler identifier origin) (user-error "No lookup handler selected"))) (run-hook-wrapped handlers #'+lookup--run-handlers identifier origin)))) (unwind-protect (if (cond ((null result) (message "No lookup handler could find %S" identifier) nil) ((markerp result) (funcall (or display-fn #'switch-to-buffer) (marker-buffer result)) (goto-char result) result) (result)) (progn (save-current-buffer (set-buffer (marker-buffer origin)) (better-jumper-set-jump (marker-position origin))) result)) (set-marker origin nil)))
  +lookup--jump-to(:documentation "print" pop-to-buffer nil)
  (cond ((+lookup--jump-to :documentation identifier #'pop-to-buffer arg)) ((user-error "Couldn't find documentation for %S" (substring-no-properties identifier))))
  +lookup/documentation("print" nil)
  funcall-interactively(+lookup/documentation "print" nil)
  command-execute(+lookup/documentation)
version info

emacs-version

GNU Emacs 30.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.49, cairo version 1.18.4)

doom/version

GNU Emacs     v30.1            nil
Doom core     v3.0.0-pre       HEAD -> master, _upgrade/master, _upgrade/HEAD, _upgrade_master ca7e226e 2025-04-30 04:00:23 -0400
Doom modules  v25.05.0-pre     HEAD -> master, _upgrade/master, _upgrade/HEAD, _upgrade_master ca7e226e 2025-04-30 04:00:23 -0400

doom/info

generated  Apr 30, 2025 13:54:02
system     "Manjaro Linux" Linux 6.13.9-1-MANJARO x86_64 x
emacs      30.1 EMACSDIR=~/.config/emacs/ EMACS=/usr/bin/emacs
doom       3.0.0-pre PROFILE=_default@0 HEAD -> master, _upgrade/master,
           _upgrade/HEAD, _upgrade_master ca7e226e 2025-04-30 04:00:23 -0400
           ~/.config/doom/
shell      /bin/bash
features   ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
           LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY
           PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
           TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB
traits     gui server-running envvar-file
modules    :config use-package :completion company (corfu +orderless +icons +dabbrev)
           (vertico +icons) :ui deft doom doom-dashboard (emoji +unicode) hl-todo
           minimap modeline nav-flash ophints (popup +defaults) treemacs (vc-gutter
           +pretty) vi-tilde-fringe workspaces zen :editor (evil +everywhere)
           file-templates fold format snippets :emacs dired electric (undo +tree) vc
           :checkers syntax :tools (eval +overlay) lookup (lsp +eglot) magit pdf
           tree-sitter :lang data emacs-lisp (ess +tree-sitter +stan) (latex +latexmk
           +cdlatex +fold +lsp) ledger (markdown +grip) (org +dragndrop +journal
           +jupyter +hugo +pandoc +pomodoro +present +pretty +roam2) (python +conda
           +cython +lsp +pyright +tree-sitter) (sh +fish +lsp +powershell
           +tree-sitter) (web +lsp +tree-sitter) (yaml +lsp +tree-sitter) :config
           literate (default +bindings +smartparens)
packages   (flymake-ruff) (jupyter) (ob-tmux) (org-transclusion) (ox-twbs)
           (rainbow-identifiers) (zetteldeft) (zotxt)
jupyter --version
Selected Jupyter core packages...
IPython          : 9.1.0
ipykernel        : 6.29.5
ipywidgets       : 8.1.6
jupyter_client   : 8.6.3
jupyter_core     : 5.7.2
jupyter_server   : 2.15.0
jupyterlab       : 4.4.0
nbclient         : 0.10.2
nbconvert        : 7.16.6
nbformat         : 5.10.4
notebook         : 7.4.0
qtconsole        : not installed
traitlets        : 5.14.3

additional configs for jupyter in doom emacs:
https://github.com/doomemacs/doomemacs/blob/master/modules/lang/org/contrib/jupyter.el

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions