Skip to content

Commit 58c56f8

Browse files
kassicksmile13241324
authored andcommitted
fix: fix code-cells-mode setup to avoid undefined symbol errors on define-key
Commit 54f12b6 correctly moved code-cells setup to use-package's :init to ensure that python-mode had a hook for code-cells-mode -- otherwise, code-cells would never be loaded automatically with python major mode. A side-effect of this change was that now there was a minor mode keymap for `code-cells-mode` , which may not have been loaded unless emacs has already opened a python file. When calling `describe-key` , the function `help--binding-locus` would iterate over `minor-mode-map-alist` and, when it reached the entry for code-cells-mode, a call to `(symbol-value 'code-cells-mode)` would fail with a `void-variable` error. Despite `code-cells-mode` being an auto-loadeable symbol, `symbol-balue` would not trigger the autoload. The solution (as pointed by @sunlin7) was to call `add-hook` on `:init` and `spacemacs/set-leader-keys-for-minor-mode` on `:config`
1 parent a7bfe0b commit 58c56f8

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

layers/+lang/python/packages.el

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,12 @@
101101
:if (not (configuration-layer/layer-used-p 'ipython-notebook))
102102
:defer t
103103
:commands (code-cells-mode)
104-
:init
105-
(progn
106-
(add-hook 'python-mode-hook 'code-cells-mode)
107-
(spacemacs/set-leader-keys-for-minor-mode 'code-cells-mode
108-
"gB" 'code-cells-backward-cell
109-
"gF" 'code-cells-forward-cell
110-
"sc" 'code-cells-eval
111-
"sa" 'code-cells-eval-above))))
104+
:init (add-hook 'python-mode-hook 'code-cells-mode)
105+
:config (spacemacs/set-leader-keys-for-minor-mode 'code-cells-mode
106+
"gB" 'code-cells-backward-cell
107+
"gF" 'code-cells-forward-cell
108+
"sc" 'code-cells-eval
109+
"sa" 'code-cells-eval-above)))
112110

113111
(defun python/post-init-company ()
114112
;; backend specific

0 commit comments

Comments
 (0)