Top/Editor/emacs/python開発環境
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#topicpath
/////////////////////////////////////////////////////////...
* 目次 [#n1d49368]
#contents();
/////////////////////////////////////////////////////////...
* python 開発環境 [#n0ecd234]
- emacs 上での python 開発環境としては以下を導入すること...
-- lint
-- フォーマッタ
- また、 emacs では python コードを編集するための python-...
/////////////////////////////////////////////////////////...
* 環境構築 [#q342595b]
//=======================================================...
** lint の設定(flycheck を使用) [#z01db224]
+ flycheck の導入
-- flycheck が導入済みであれば、flycheck のみで静的解析が...
-- debian パッケージを導入する場合は、 ''elpa-flycheck'' ...
-- 又は、開発リポジトリを取ってきて、宜しく配置する(但し...
https://github.com/flycheck/flycheck.git
https://github.com/magnars/dash.el.git
https://git.savannah.gnu.org/git/emacs/elpa.git
+ flycheck を設定する
-- ディストリビューションのパッケージを導入する場合、特に...
-- 手動でリポジトリを取ってきた場合の設定例は以下の通り:
(setq load-path (cons (expand-file-name "~/.emacs.d/site...
(setq load-path (cons (expand-file-name "~/.emacs.d/site...
(setq load-path (cons (expand-file-name "~/.emacs.d/site...
(require 'flycheck)
;; エラーをツールチップ表示する
(with-eval-after-load 'flycheck
(flycheck-pos-tip-mode))
(add-hook 'after-init-hook #'global-flycheck-mode)
//=======================================================...
** formatter の設定 [#cd0de45d]
- pytohn フォーマッタは幾つかあるが、ここでは、以下を前提...
-- autopep8 --- フォーマッタ
-- isort --- import 文の妥当性を解析する
//-------------------------------------------------------...
*** autopep8 の導入 [#j5a38d10]
- emacs には py-autopep8.el があるので導入する。
-- debian パッケージを導入する場合は ''elpa-py-autopep8''
-- 手動でリポジトリを取得する場合は
https://github.com/fujimisakari/py-autopep8.el.git
//-------------------------------------------------------...
*** isort の導入 [#o91f34b7]
- emacs には py-isort.el があるので導入する。
-- debian パッケージの場合は ''elpa-py-isort'' を導入する。
-- 手動でリポジトリを取得する場合は
https://github.com/paetzke/py-isort.el.git
//-------------------------------------------------------...
*** autopep8 と isort の設定 [#c8ae4823]
+ python-mode 固有の設定になるので、ひとまとめにした設定...
;;; python-mode.conf.el --- settings for python-mode
;;; Commentary:
;;; see also: https://qiita.com/fujimisakari/items/74...
;;; Code:
(setq python-mode-hook
#'(lambda ()
(if (which-function-mode nil) (which-function...
;; formatter
(require 'py-autopep8.conf)
;; clang-format.conf.el で設定したキーに合わ...
(define-key python-mode-map (kbd "C-c i") 'py...
(define-key python-mode-map (kbd "C-c u") 'py...
;; import 文を適切な順序に自動で sort する
(require 'py-isort.conf)
;; linter
;; (when (expand-file-name "pylint") ; システ...
;; ;; flycheck で使う linter の設定
;; ;; flycheck では勝手に linter を探してく...
;; ;; ところに置かれている物を使うのでない...
;; ; (setq flycheck-python-pylint-executabl...
;; ; (setq flycheck-python-flake8-executabl...
;; ; (setq flycheck-python-mypy-executable ...
;; )
)
)
(provide 'python-mode.conf)
;;; python-mode.conf.el ends here
+ これを、${HOME}/.emacs.d/init.el 等から適当に呼ぶように...
; python-mode 関係の設定
(require 'python-mode.conf)
終了行:
#topicpath
/////////////////////////////////////////////////////////...
* 目次 [#n1d49368]
#contents();
/////////////////////////////////////////////////////////...
* python 開発環境 [#n0ecd234]
- emacs 上での python 開発環境としては以下を導入すること...
-- lint
-- フォーマッタ
- また、 emacs では python コードを編集するための python-...
/////////////////////////////////////////////////////////...
* 環境構築 [#q342595b]
//=======================================================...
** lint の設定(flycheck を使用) [#z01db224]
+ flycheck の導入
-- flycheck が導入済みであれば、flycheck のみで静的解析が...
-- debian パッケージを導入する場合は、 ''elpa-flycheck'' ...
-- 又は、開発リポジトリを取ってきて、宜しく配置する(但し...
https://github.com/flycheck/flycheck.git
https://github.com/magnars/dash.el.git
https://git.savannah.gnu.org/git/emacs/elpa.git
+ flycheck を設定する
-- ディストリビューションのパッケージを導入する場合、特に...
-- 手動でリポジトリを取ってきた場合の設定例は以下の通り:
(setq load-path (cons (expand-file-name "~/.emacs.d/site...
(setq load-path (cons (expand-file-name "~/.emacs.d/site...
(setq load-path (cons (expand-file-name "~/.emacs.d/site...
(require 'flycheck)
;; エラーをツールチップ表示する
(with-eval-after-load 'flycheck
(flycheck-pos-tip-mode))
(add-hook 'after-init-hook #'global-flycheck-mode)
//=======================================================...
** formatter の設定 [#cd0de45d]
- pytohn フォーマッタは幾つかあるが、ここでは、以下を前提...
-- autopep8 --- フォーマッタ
-- isort --- import 文の妥当性を解析する
//-------------------------------------------------------...
*** autopep8 の導入 [#j5a38d10]
- emacs には py-autopep8.el があるので導入する。
-- debian パッケージを導入する場合は ''elpa-py-autopep8''
-- 手動でリポジトリを取得する場合は
https://github.com/fujimisakari/py-autopep8.el.git
//-------------------------------------------------------...
*** isort の導入 [#o91f34b7]
- emacs には py-isort.el があるので導入する。
-- debian パッケージの場合は ''elpa-py-isort'' を導入する。
-- 手動でリポジトリを取得する場合は
https://github.com/paetzke/py-isort.el.git
//-------------------------------------------------------...
*** autopep8 と isort の設定 [#c8ae4823]
+ python-mode 固有の設定になるので、ひとまとめにした設定...
;;; python-mode.conf.el --- settings for python-mode
;;; Commentary:
;;; see also: https://qiita.com/fujimisakari/items/74...
;;; Code:
(setq python-mode-hook
#'(lambda ()
(if (which-function-mode nil) (which-function...
;; formatter
(require 'py-autopep8.conf)
;; clang-format.conf.el で設定したキーに合わ...
(define-key python-mode-map (kbd "C-c i") 'py...
(define-key python-mode-map (kbd "C-c u") 'py...
;; import 文を適切な順序に自動で sort する
(require 'py-isort.conf)
;; linter
;; (when (expand-file-name "pylint") ; システ...
;; ;; flycheck で使う linter の設定
;; ;; flycheck では勝手に linter を探してく...
;; ;; ところに置かれている物を使うのでない...
;; ; (setq flycheck-python-pylint-executabl...
;; ; (setq flycheck-python-flake8-executabl...
;; ; (setq flycheck-python-mypy-executable ...
;; )
)
)
(provide 'python-mode.conf)
;;; python-mode.conf.el ends here
+ これを、${HOME}/.emacs.d/init.el 等から適当に呼ぶように...
; python-mode 関係の設定
(require 'python-mode.conf)
ページ名: