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
@@ -187,6 +174,7 @@ nil."
187
174
; ;; `jupyter-repl-after-init'
188
175
189
176
(defun jupyter-julia--setup-hooks (client )
177
+ (require 'julia-mode )
190
178
(let ((jupyter-inhibit-handlers t ))
191
179
(jupyter-send-execute-request client
192
180
:store-history nil
@@ -207,7 +195,18 @@ if !isdefined(Main, :__JUPY_saved_dir)
207
195
IJulia.push_posterror_hook(popdir)
208
196
IJulia.push_postexecute_hook(popdir)
209
197
end
210
- end" )))
198
+ end" ))
199
+ (add-hook 'completion-at-point-functions
200
+ #'julia-mode-latexsub-completion-at-point-before nil t )
201
+ (add-hook 'completion-at-point-functions
202
+ #'julia-mode-latexsub-completion-at-point-around nil t )
203
+ (define-abbrev-table 'jupyter-julia-abbrev-table ()
204
+ " Abbrev table for IJulia kernel with jupyter."
205
+ :parents (list julia-latexsub-abbrev-table))
206
+ (setq local-abbrev-table jupyter-julia-abbrev-table)
207
+ (when julia-force-tab-complete
208
+ (setq-local tab-always-indent 'complete )
209
+ (abbrev-mode 1 )))
211
210
212
211
(cl-defmethod jupyter-repl-after-init (&context (jupyter-lang julia))
213
212
(add-function
0 commit comments