Skip to content

Commit 5566a1d

Browse files
committed
Add jupyter-repl-interaction-mode-line-format
* jupyter-repl.el: Do it. (jupyter-repl-interaction-mode-line): Use it. (jupyter-repl-completion-at-point-hook-depth): Superfluous documentation change.
1 parent 520ef89 commit 5566a1d

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

jupyter-repl.el

+20-14
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,24 @@ as is done when this variable is nil."
178178

179179
(defcustom jupyter-repl-completion-at-point-hook-depth nil
180180
"The DEPTH of `jupyter-completion-at-point' in `completion-at-point-functions'.
181+
This will be set as the DEPTH argument to the `add-hook' call
182+
when adding Jupyter based completion functionality to
183+
`completion-at-point-functions'. A value of nil means the
184+
default depth of 0, i.e. added as the first entry of
185+
`completion-at-point-functions'. This might prevent other hooks
186+
like `lsp-completion-at-point' from running.
187+
188+
If you'd prefer to give `jupyter-completion-at-point' lower
189+
priority, set this variable to something like 1. See `add-hook'."
190+
:type '(choice (integer :tag "Hook depth")
191+
(const :tag "Default depth of 0" nil))
192+
:group 'jupyter-repl)
181193

182-
`completion-at-point-functions' hooks are tried in order. A value of nil for
183-
this variable means `jupyter-completion-at-point' will be added to the head of
184-
the list, which means it will be tried first on completion attempts. This might
185-
prevent other hooks like `lsp-completion-at-point' from running.
186-
187-
If you'd prefer to give `jupyter-completion-at-point' lower priority, set this
188-
variable to something like 1. Check `add-hook' documentation for more details
189-
about DEPTH."
190-
:type 'integer
194+
(defcustom jupyter-repl-interaction-mode-line-format " JuPy[%s]"
195+
"Format to use when producing the mode line.
196+
The format specifier %s is replaced with the status of the
197+
kernel."
198+
:type 'string
191199
:group 'jupyter-repl)
192200

193201
;;; Implementation
@@ -1960,13 +1968,11 @@ the REPL is connected, `x' means the REPL is disconnected
19601968
from the kernel."
19611969
(pcase jupyter-current-client
19621970
((and client (cl-type jupyter-repl-client))
1963-
(concat " JuPy["
1971+
(format jupyter-repl-interaction-mode-line-format
19641972
(cond
19651973
((not (jupyter-hb-beating-p client)) "x")
1966-
((equal (jupyter-execution-state client) "busy")
1967-
"*")
1968-
(t "-"))
1969-
"]"))))
1974+
((equal (jupyter-execution-state client) "busy") "*")
1975+
(t "-"))))))
19701976

19711977
(defun jupyter-repl-pop-to-buffer ()
19721978
"Switch to the REPL buffer of the `jupyter-current-client'."

0 commit comments

Comments
 (0)