29
29
(eval-when-compile (require 'subr-x ))
30
30
(require 'jupyter-repl )
31
31
32
- (declare-function julia-latexsub-or-indent " ext:julia-mode" (arg))
33
-
34
- (cl-defmethod jupyter-indent-line (&context (major-mode julia-mode))
35
- " Call `julia-latexsub-or-indent' ."
36
- (call-interactively #'julia-latexsub-or-indent ))
32
+ (declare-function julia-mode-latexsub-completion-at-point-before
33
+ " ext:julia-mode" ())
34
+ (declare-function julia-mode-latexsub-completion-at-point-around
35
+ " ext:julia-mode" ())
37
36
38
37
(cl-defmethod jupyter-load-file-code (file &context (jupyter-lang julia))
39
38
(format " include(\" %s \" ); " file))
68
67
(not (memq (char-syntax (char-before (1- beg))) '(?w ?_ ))))
69
68
(setcar prefix (concat " :" (car prefix))))))))))))
70
69
71
- (cl-defmethod jupyter-completion-post-completion (candidate
72
- &context (jupyter-lang julia))
73
- " Insert the unicode representation of a LaTeX completion."
74
- (if (eq (aref candidate 0 ) ?\\ )
75
- (when (get-text-property 0 'annot candidate)
76
- (search-backward candidate)
77
- (delete-region (point ) (match-end 0 ))
78
- ; ; Alternatively use `julia-latexsub-or-indent' , but I have found
79
- ; ; problems with that.
80
- (insert (string-trim (get-text-property 0 'annot candidate))))
81
- (cl-call-next-method )))
82
-
83
70
; ;; `markdown-mode'
84
71
85
72
(cl-defmethod jupyter-markdown-follow-link (link-text url _ref-label _title-text _bang
@@ -188,6 +175,7 @@ nil."
188
175
; ;; `jupyter-repl-after-init'
189
176
190
177
(defun jupyter-julia--setup-hooks (client )
178
+ (require 'julia-mode )
191
179
(let ((jupyter-inhibit-handlers t ))
192
180
(jupyter-send-execute-request client
193
181
:store-history nil
@@ -208,7 +196,18 @@ if !isdefined(Main, :__JUPY_saved_dir)
208
196
IJulia.push_posterror_hook(popdir)
209
197
IJulia.push_postexecute_hook(popdir)
210
198
end
211
- end" )))
199
+ end" ))
200
+ (add-hook 'completion-at-point-functions
201
+ #'julia-mode-latexsub-completion-at-point-before nil t )
202
+ (add-hook 'completion-at-point-functions
203
+ #'julia-mode-latexsub-completion-at-point-around nil t )
204
+ (define-abbrev-table 'jupyter-julia-abbrev-table ()
205
+ " Abbrev table for IJulia kernel with jupyter."
206
+ :parents (list julia-latexsub-abbrev-table))
207
+ (setq local-abbrev-table jupyter-julia-abbrev-table)
208
+ (when julia-force-tab-complete
209
+ (setq-local tab-always-indent 'complete )
210
+ (abbrev-mode 1 )))
212
211
213
212
(cl-defmethod jupyter-repl-after-init (&context (jupyter-lang julia))
214
213
(add-function
0 commit comments