Skip to content

Instantly share code, notes, and snippets.

@cosven
Last active November 21, 2018 07:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cosven/1ba2e68586df475be0c4792ca8753ea0 to your computer and use it in GitHub Desktop.
Save cosven/1ba2e68586df475be0c4792ca8753ea0 to your computer and use it in GitHub Desktop.
Emasc Python 项目 .dir-locals.el 示例
((python-mode
;; 激活 pyvenv-mode,也可以自己在 init.el 中默认激活
(eval . (pyvenv-mode))
;; 这个要写绝对路径
(pyvenv-activate . "/Users/cosven/projectpath/.venv")
;; 默认 select python-pylint 这个 checker
;;
;; 注意:请确保 python-pylint 已经被 enable,我们只能 select 已经被
;; enbale 的 checker,可以使用 flycheck-verify-setup
;; 命令来确认 python-pylint 是否已经被 enable。
;;
;; 更多细节可以参考 init-python.el pylint 相关部分
;; https://github.com/cosven/.emacs.d/blob/master/elisp/init-python.el
(flycheck-checker . python-pylint)
;; 如果当前项目不在虚拟环境中,则手动将当前项目根目录添加到 pythonpath
;; 这样可以让 anaconda-mode 自动补全功能更好的工作。
(python-shell-extra-pythonpaths "/Users/cosven/projectpath/")
(fill-column . 81)
(python-indent-offset . 4)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment