 ;;;;;;;;
 ;; flycheck-mode
 ;;;;;;;;
+(require-if-not 'flycheck)
 (setq flycheck-flake8-maximum-complexity 10)
 (global-set-key (kbd "<f8>") 'flycheck-mode)
 ;;(add-hook 'after-init-hook #'global-flycheck-mode)
 
 ;;;;;;;;
-;; ghc ( -> intero)
-;;;;;;;;
-;; (autoload 'ghc-init "ghc" nil t)
-;; (autoload 'ghc-debug "ghc" nil t)
-;; (add-hook 'haskell-mode-hook (lambda () (ghc-init)))
-
-;;;;;;;;
 ;; god-mode
 ;;;;;;;;
+(require-if-not 'god-mode)
 (global-set-key (kbd "\C-\\") 'god-local-mode)
 
 ;;;;;;;;
 ;; graphviz-dot-mode
 ;;;;;;;;
 ;; cogre-dot-modeがgraphviz-dot-modeを発見できるようrequire
-(require 'graphviz-dot-mode)
+(require-if-not 'graphviz-dot-mode)
 (setq graphviz-dot-auto-indent-on-semi nil)
 (add-hook 'graphviz-dot-mode-hook (lambda () (auto-complete-mode)))
 

;;;;;;;;
;; lsp-haskell
;;;;;;;;
(require 'lsp-haskell)
(add-hook 'haskell-mode-hook #'lsp)

;;;;;;;;
;; lsp-java
;; 補完が効かない場合はM-x lsp-java-update-project-configurationを試すこと
;;;;;;;;
(require 'lsp-java)
(setq lsp-java-java-path (expand-file-name "~/.jenv/shims/java"))
(add-hook 'java-mode-hook #'lsp)

;;;;;;;;
;; lsp-pyright
;;;;;;;;
(require 'lsp-pyright)
(add-hook 'python-mode-hook #'lsp)

;; ;;;;;;;;
;; ;; lsp-python-ms (-> lsp-pyright)
;; ;;;;;;;;
;; (require 'lsp-python-ms)
;; (setq lsp-python-ms-auto-install-server t)
;; (add-hook 'python-mode-hook #'lsp) ; or lsp-deferred

;;;;;;;;
;; lsp-ui
;;;;;;;;
(require 'lsp-ui)
;; C-s/C-rで検索中にlsp-ui-docウィンドウが開き、検索が中断される
;; トグルをF5にバインドする
(defun toggle-lsp-ui-doc ()

;;;;;;;;
;; highlight-indentation
;;;;;;;;
(require-if-not 'highlight-indentation)
(add-hook 'python-mode-hook
          (lambda ()
            "turn on highlight-indentation-mode"
