Skip to content

Commit 8b35409

Browse files
mpereirannicandro
authored andcommitted
Make jupyter-completion-at-point hook DEPTH configurable
1 parent 8ff3b75 commit 8b35409

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

jupyter-repl.el

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,20 @@ as is done when this variable is nil."
156156
:type 'boolean
157157
:group 'jupyter-repl)
158158

159+
(defcustom jupyter-repl-completion-at-point-hook-depth nil
160+
"The DEPTH of `jupyter-completion-at-point' in `completion-at-point-functions'.
161+
162+
`completion-at-point-functions' hooks are tried in order. A value of nil for
163+
this variable means `jupyter-completion-at-point' will be added to the head of
164+
the list, which means it will be tried first on completion attempts. This might
165+
prevent other hooks like `lsp-completion-at-point' from running.
166+
167+
If you'd prefer to give `jupyter-completion-at-point' lower priority, set this
168+
variable to something like 1. Check `add-hook' documentation for more details
169+
about DEPTH."
170+
:type 'integer
171+
:group 'jupyter-repl)
172+
159173
;;; Implementation
160174

161175
(defclass jupyter-repl-client (jupyter-widget-client jupyter-kernel-client)
@@ -1855,7 +1869,10 @@ the `current-buffer' will automatically have
18551869
:init-value nil
18561870
(cond
18571871
(jupyter-repl-interaction-mode
1858-
(add-hook 'completion-at-point-functions 'jupyter-completion-at-point nil t)
1872+
(add-hook 'completion-at-point-functions
1873+
'jupyter-completion-at-point
1874+
jupyter-repl-completion-at-point-hook-depth
1875+
t)
18591876
(add-hook 'after-revert-hook 'jupyter-repl-interaction-mode nil t))
18601877
(t
18611878
(remove-hook 'completion-at-point-functions 'jupyter-completion-at-point t)

0 commit comments

Comments
 (0)