python-ts-mode不打开一个python文件后不存在

但是在init.el文件里设置 python-ts-mode-map 相关却报错其不存在。 请教大家,为什么呢?

(use-package treesit
  :ensure nil
  :defer 4
  :config
  (setq treesit-language-source-alist
		'((bash . ("https://github.com/tree-sitter/tree-sitter-bash"))
          (org . ("https://github.com/milisims/tree-sitter-org"))
          (python . ("https://github.com/tree-sitter/tree-sitter-python"))
		  ))
  (setq major-mode-remap-alist
		'((c-mode          . c-ts-mode)
          (python-mode     . python-ts-mode)
          ))

  (add-hook 'python-ts-mode-hook #'(lambda () (treesit-parser-create 'python)))

  (define-key python-ts-mode-map (kbd "C-c p") 'open-by-pycharm)

  )

报错:

⛔ Error (use-package): treesit/:config: Symbol’s value as variable is void: python-ts-mode-map

这个需要放在 python-ts-mode 加载之后设置:

(use-package python
  :bind (:map python-ts-mode-map
              ("C-c p" . open-by-pycharm)))
1 个赞

@tianzhushan 把标题语句写通顺是对论坛行为准则的最基本的尊重。