https://github.com/flycheck/flycheck.git https://github.com/magnars/dash.el.git https://git.savannah.gnu.org/git/emacs/elpa.git
(setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/elpa/packages/company") load-path)) ; depended: dash (setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/dash") load-path)) (setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/flycheck") load-path)) ; flycheck (require 'flycheck) ;; エラーをツールチップ表示する (with-eval-after-load 'flycheck (flycheck-pos-tip-mode)) (add-hook 'after-init-hook #'global-flycheck-mode)
https://github.com/fujimisakari/py-autopep8.el.git
https://github.com/paetzke/py-isort.el.git
;;; python-mode.conf.el --- settings for python-mode
;;; Commentary:
;;; see also: https://qiita.com/fujimisakari/items/74e32eddb78dff4be585
;;; Code:
(setq python-mode-hook
#'(lambda ()
(if (which-function-mode nil) (which-function-mode)) ; ; 現在の関数名をモードラインに表示
;; formatter
(require 'py-autopep8.conf)
;; clang-format.conf.el で設定したキーに合わせておく
(define-key python-mode-map (kbd "C-c i") 'py-autopep8-region) ; 選択リジョン内のコード整形
(define-key python-mode-map (kbd "C-c u") 'py-autopep8) ; バッファ全体のコード整形
;; import 文を適切な順序に自動で sort する
(require 'py-isort.conf)
;; linter
;; (when (expand-file-name "pylint") ; システム上に pylint があるときだけ
;; ;; flycheck で使う linter の設定
;; ;; flycheck では勝手に linter を探してくれるらしく、パスの通ってない
;; ;; ところに置かれている物を使うのでない限り、以下の linter を指定する設定は不要な模様
;; ; (setq flycheck-python-pylint-executable "pylint") ; for flycheck
;; ; (setq flycheck-python-flake8-executable "flake8") ; for flycheck
;; ; (setq flycheck-python-mypy-executable "mypy") ; for flycheck
;; )
)
)
(provide 'python-mode.conf)
;;; python-mode.conf.el ends here; python-mode 関係の設定 (require 'python-mode.conf)