|  | 
| 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" ()) | 
|  | 36 | +(defvar julia-latexsub-abbrev-table) | 
|  | 37 | +(defvar julia-force-tab-complete) | 
| 37 | 38 | 
 | 
| 38 | 39 | (cl-defmethod jupyter-load-file-code (file &context (jupyter-lang julia)) | 
| 39 | 40 |   (format "include(\"%s\");" file)) | 
| 40 | 41 | 
 | 
| 41 | 42 | ;;; Completion | 
| 42 | 43 | 
 | 
|  | 44 | +(define-abbrev-table 'jupyter-julia-abbrev-table () | 
|  | 45 | +  "Abbrev table for IJulia kernel with jupyter." | 
|  | 46 | +  :parents (list julia-latexsub-abbrev-table)) | 
|  | 47 | + | 
| 43 | 48 | (cl-defmethod jupyter-completion-prefix (&context (jupyter-lang julia)) | 
| 44 | 49 |   (cond | 
| 45 | 50 |    ;; Completing argument lists | 
|  | 
| 68 | 73 |                    (not (memq (char-syntax (char-before (1- beg))) '(?w ?_)))) | 
| 69 | 74 |               (setcar prefix (concat ":" (car prefix)))))))))))) | 
| 70 | 75 | 
 | 
| 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 | 76 | ;;; `markdown-mode' | 
| 84 | 77 | 
 | 
| 85 | 78 | (cl-defmethod jupyter-markdown-follow-link (link-text url _ref-label _title-text _bang | 
| @@ -207,7 +200,15 @@ if !isdefined(Main, :__JUPY_saved_dir) | 
| 207 | 200 |         IJulia.push_posterror_hook(popdir) | 
| 208 | 201 |         IJulia.push_postexecute_hook(popdir) | 
| 209 | 202 |     end | 
| 210 |  | -end"))) | 
|  | 203 | +end")) | 
|  | 204 | +  (add-hook 'completion-at-point-functions | 
|  | 205 | +            #'julia-mode-latexsub-completion-at-point-before nil t) | 
|  | 206 | +  (add-hook 'completion-at-point-functions | 
|  | 207 | +            #'julia-mode-latexsub-completion-at-point-around nil t) | 
|  | 208 | +  (setq local-abbrev-table jupyter-julia-abbrev-table) | 
|  | 209 | +  (when julia-force-tab-complete | 
|  | 210 | +    (setq-local tab-always-indent 'complete) | 
|  | 211 | +    (abbrev-mode 1))) | 
| 211 | 212 | 
 | 
| 212 | 213 | (cl-defmethod jupyter-repl-after-init (&context (jupyter-lang julia)) | 
| 213 | 214 |   (add-function | 
|  | 
0 commit comments