This repository has been archived by the owner on Jul 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpackages.el
89 lines (78 loc) · 2.88 KB
/
packages.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
;;; packages.el --- jupyter layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; Author: Benedikt Tissot <benedikt.tissot@googlemail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;;; Commentary:
;; See the Spacemacs documentation and FAQs for instructions on how to implement
;; a new layer:
;;
;; SPC h SPC layers RET
;;
;;
;; Briefly, each package to be installed or configured by this layer should be
;; added to `jupyter-packages'. Then, for each package PACKAGE:
;;
;; - If PACKAGE is not referenced by any other Spacemacs layer, define a
;; function `jupyter/init-PACKAGE' to load and initialize the package.
;; - Otherwise, PACKAGE is already referenced by another Spacemacs layer, so
;; define the functions `jupyter/pre-init-PACKAGE' and/or
;; `jupyter/post-init-PACKAGE' to customize the package as it is loaded.
;;; Code:
(defconst jupyter-packages
'(
org
company
jupyter
smartparens
(ox-ipynb :location (recipe
:fetcher github
:repo "jkitchin/ox-ipynb"))
))
(defun jupyter/init-jupyter ()
(if (executable-find "jupyter")
(use-package jupyter
:defer t
:init
(progn
(spacemacs/set-leader-keys
"aja" 'jupyter-repl-associate-buffer
"ajc" 'jupyter-connect-repl
"ajr" 'jupyter-run-repl
"ajs" 'jupyter-server-list-kernels
)
(spacemacs/set-leader-keys-for-major-mode 'jupyter-repl-mode
"i" 'jupyter-inspect-at-point
"l" 'jupyter-load-file
"s" 'jupyter-repl-scratch-buffer
"I" 'jupyter-repl-interrupt-kernel
"R" 'jupyter-repl-restart-kernel)
;; TODO for some reason this does not work in hybrid mode
(evil-define-key '(insert normal emacs) jupyter-repl-mode-map
(kbd "C-j") 'jupyter-repl-history-next
(kbd "C-k") 'jupyter-repl-history-previous
(kbd "M-j") 'jupyter-repl-forward-cell
(kbd "M-k") 'jupyter-repl-backward-cell
(kbd "C-l") 'jupyter-repl-clear-cells
(kbd "C-s") 'jupyter-repl-scratch-buffer
(kbd "C-R") 'isearch-forward
(kbd "C-r") 'isearch-backward)))
(message "jupyter was not found in your path, jupyter is not loaded")))
(defun jupyter/post-init-company ()
(spacemacs|add-company-backends :backends company-capf :modes jupyter-repl-mode))
(defun jupyter/post-init-smartparens ()
(add-hook 'jupyter-repl-mode-hook 'smartparens-mode))
(defun jupyter/post-init-org ()
;; ;; (with-eval-after-load 'org (jupyter/ox-ipynb-emacs-jupyter)))
(add-hook 'org-mode-hook #'jupyter/ox-ipynb-emacs-jupyter))
(defun jupyter/init-ox-ipynb ()
(use-package ox-ipynb
:defer t
:after jupyter org
))
;;; packages.el ends here