@@ -118,15 +118,32 @@ timeout, the built-in is-complete handler is used."
118
118
; ;; Implementation
119
119
120
120
(defclass jupyter-repl-client (jupyter-widget-client)
121
- ((buffer :type buffer)
121
+ ((buffer
122
+ :type (or null buffer)
123
+ :initform nil
124
+ :documentation " The REPL buffer whose
125
+ `jupyter-repl-current-client' is this client." )
122
126
(wait-to-clear
123
127
:type boolean :initform nil
124
128
:documentation " Whether or not we should wait to clear the
125
129
current output of the cell. Set when the kernel sends a
126
130
`:clear-output' message." )
127
- (kernel-info :type json-plist :initform nil )
128
- (execution-state :type string :initform " idle" )
129
- (execution-count :type integer :initform 1 )))
131
+ (kernel-info
132
+ :type json-plist
133
+ :initform nil
134
+ :documentation " The saved kernel info created when first
135
+ initializing this client. This is the plist returned from the the
136
+ call to `jupyter-start-new-kernel' when this client was
137
+ created." )
138
+ (execution-state
139
+ :type string
140
+ :initform " idle"
141
+ :documentation " The current state of the kernel. Can be
142
+ either \" idle\" , \" busy\" , or \" starting\" ." )
143
+ (execution-count
144
+ :type integer
145
+ :initform 1
146
+ :documentation " The current execution count of the kernel." )))
130
147
131
148
(defvar jupyter-repl-lang-buffer nil
132
149
" A buffer with the `major-mode' set to the REPL language's `major-mode' ." )
@@ -147,7 +164,7 @@ current output of the cell. Set when the kernel sends a
147
164
See `jupyter-repl-fontify-according-to-mode' ." )
148
165
149
166
(defvar jupyter-repl-use-builtin-is-complete nil
150
- " Whether or not to send is_complete_request 's to a kernel.
167
+ " Whether or not to send `:is-complete-request ' s to a kernel.
151
168
If a Jupyter kernel does not respond to an is_complete_request,
152
169
the buffer local value of this variable is set to t and code in a
153
170
cell is considered complete if the last line in a code cell is a
@@ -159,8 +176,9 @@ Display IDs are implemented by setting the text property,
159
176
`jupyter-display' , to the display ID requested by a
160
177
`:display-data' message. When a display is updated from an
161
178
`:update-display-data' message, the display ID from the initial
162
- `:display-data' is retrieved from this table and used to find the
163
- display in the REPL buffer. See `jupyter-repl-update-display' ." )
179
+ `:display-data' message is retrieved from this table and used to
180
+ find the display in the REPL buffer. See
181
+ `jupyter-repl-update-display' ." )
164
182
165
183
; ;; Macros
166
184
@@ -299,7 +317,7 @@ for the property."
299
317
300
318
; ; Adapted from `org-src-font-lock-fontify-block'
301
319
(defun jupyter-repl-fixup-font-lock-properties ()
302
- " Fixup the text properties in the `curren -buffer' .
320
+ " Fixup the text properties in the `current -buffer' .
303
321
Fixing the text properties of the current buffer involves
304
322
substituting any `face' property with `font-lock-face' for
305
323
insertion into the REPL buffer and adding
@@ -958,7 +976,6 @@ Finalizing a cell involves the following steps:
958
976
(remove-text-properties beg (point ) '(rear-nonsticky))
959
977
; ; font-lock-multiline to avoid improper syntactic elements from
960
978
; ; spilling over to the rest of the buffer.
961
- ; ; TODO: I don't think this is a proper use of this text property
962
979
(add-text-properties beg (point ) '(read-only t font-lock-multiline t ))))
963
980
964
981
(defun jupyter-repl-replace-cell-code (new-code )
@@ -1177,7 +1194,7 @@ found."
1177
1194
(cl-defmethod jupyter-handle-clear-output ((client jupyter-repl-client)
1178
1195
req
1179
1196
wait)
1180
- ; ; TODO: Tale into account json-false elsewhere
1197
+ ; ; TODO: Take into account json-false elsewhere
1181
1198
(unless (oset client wait-to-clear (eq wait t ))
1182
1199
(cond
1183
1200
((eq (jupyter-message-parent-type
@@ -1215,8 +1232,6 @@ buffer to display TEXT."
1215
1232
1216
1233
(cl-defmethod jupyter-handle-stream ((client jupyter-repl-client) req name text)
1217
1234
(if (null req)
1218
- ; ; Otherwise the stream request is due to someone else, pop up a buffer.
1219
- ; ; TODO: Make this configurable so that we can just ignore output.
1220
1235
(jupyter-repl-display-other-output client name text)
1221
1236
(cond
1222
1237
((eq (jupyter-message-parent-type
@@ -1602,8 +1617,6 @@ is used for completion."
1602
1617
1603
1618
))
1604
1619
; ; When a type is supplied add it as an annotation
1605
- ; ; TODO: Customize annotation types, when an annotation type "function"
1606
- ; ; appears, substitute "λ".
1607
1620
(when types
1608
1621
(let ((max-len (apply #'max (mapcar #'length matches))))
1609
1622
(cl-mapc
@@ -2258,14 +2271,14 @@ purposes and SYNTAX-TABLE is the syntax table of MODE."
2258
2271
2259
2272
(defun jupyter-repl--new-repl (client )
2260
2273
" Initialize a new REPL buffer based on CLIENT.
2261
- CLIENT is a `jupyter-repl-client' already connected to its
2262
- kernel and should have a non-nil kernel-info slot.
2274
+ CLIENT is a `jupyter-repl-client' already connected to its kernel
2275
+ and has a non-nil kernel-info slot.
2263
2276
2264
2277
A new REPL buffer communicating with CLIENT's kernel is created
2265
- and set as CLIENT'sthis case, if MANAGER will be the buffer slot.
2266
- If CLIENT already has a non-nil buffer slot, raise an error."
2278
+ and set as CLIENT's buffer slot. If CLIENT already has a non-nil
2279
+ buffer slot, raise an error."
2267
2280
(if (slot-boundp client 'buffer ) (error " Client already has a REPL buffer " )
2268
- (unless (ignore-errors ( oref client kernel-info) )
2281
+ (unless (oref client kernel-info)
2269
2282
(error " Client needs to have valid kernel-info " ))
2270
2283
(cl-destructuring-bind (&key language_info
2271
2284
banner
@@ -2306,8 +2319,6 @@ Otherwise, in a non-interactive call, return the
2306
2319
(setq kernel-name (caar (jupyter-find-kernelspecs kernel-name))))
2307
2320
(unless kernel-name
2308
2321
(error " No kernel found for prefix (%s ) " kernel-name))
2309
- ; ; The manager is set as the client's manager slot in
2310
- ; ; `jupyter-start-new-kernel'
2311
2322
(cl-destructuring-bind (_manager client info)
2312
2323
(jupyter-start-new-kernel kernel-name 'jupyter-repl-client )
2313
2324
(oset client kernel-info info)
0 commit comments