From d8313d2234ef1969d5eb60efd83e80cfeba50956 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 5 Jun 2018 15:37:37 -0700 Subject: [emacs] Some major clean up. Switch from `(require)` to `(load)`, which does not cause warning with flymake. Remove `:ensure t` since it's the default. --- emacs.d/config/config-lib.el | 2 - emacs.d/config/config-package.el | 4 +- emacs.d/init.el | 87 ++++++++++++++++++---------------- emacs.d/modules/module-appareance.el | 4 +- emacs.d/modules/module-autocomplete.el | 12 ++++- emacs.d/modules/module-c.el | 2 - emacs.d/modules/module-flyspell.el | 2 - emacs.d/modules/module-git.el | 2 - emacs.d/modules/module-go.el | 4 -- emacs.d/modules/module-javascript.el | 2 - emacs.d/modules/module-json.el | 2 +- emacs.d/modules/module-project.el | 3 -- emacs.d/modules/module-protobuf.el | 3 -- emacs.d/modules/module-puppet.el | 13 ++--- emacs.d/modules/module-rust.el | 2 - emacs.d/modules/module-scala.el | 6 +-- emacs.d/modules/module-shell.el | 4 -- emacs.d/modules/module-thrift.el | 4 -- emacs.d/modules/module-toml.el | 4 +- emacs.d/modules/module-yaml.el | 3 -- 20 files changed, 67 insertions(+), 98 deletions(-) diff --git a/emacs.d/config/config-lib.el b/emacs.d/config/config-lib.el index 5148ff7..8896d2f 100644 --- a/emacs.d/config/config-lib.el +++ b/emacs.d/config/config-lib.el @@ -1,5 +1,3 @@ -(require 'config-package) - ;; rename a buffer (defun fc/rename-this-buffer-and-file () "Renames current buffer and file it is visiting." diff --git a/emacs.d/config/config-package.el b/emacs.d/config/config-package.el index 5389c0c..1b7c6f0 100644 --- a/emacs.d/config/config-package.el +++ b/emacs.d/config/config-package.el @@ -1,5 +1,3 @@ -(require 'config-env) - ;; where to store the packages (setq package-user-dir fcuny-path-emacs-elpa) @@ -13,6 +11,8 @@ (when (not (package-installed-p 'paradox)) (package-install 'paradox)) +(setq paradox-github-token t) + (paradox-require 'use-package) (require 'use-package) diff --git a/emacs.d/init.el b/emacs.d/init.el index 840bd29..6714294 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -11,43 +11,50 @@ (add-to-list 'load-path (expand-file-name "config" user-emacs-directory)) (add-to-list 'load-path (expand-file-name "modules" user-emacs-directory)) -(require 'config-env) -(require 'config-lib) -(require 'config-package) -(require 'config-set-path) - -(require 'module-general) -(require 'module-appareance) -(require 'module-hydra) -(require 'module-editing) -(require 'module-codestyle) - -(require 'module-ibuffer) -(require 'module-git) -(require 'module-dired) -(require 'module-ivy) -(require 'module-project) -(require 'module-flycheck) -(require 'module-flyspell) -(require 'module-autocomplete) - -(require 'module-make) -(require 'module-pants) - -(require 'module-c) -(require 'module-docker) -(require 'module-go) -(require 'module-java) -(require 'module-json) -(require 'module-lisp) -(require 'module-protobuf) -(require 'module-puppet) -(require 'module-python) -(require 'module-rust) -(require 'module-scala) -(require 'module-shell) -(require 'module-thrift) - -(require 'module-markdown) -(require 'module-toml) -(require 'module-yaml) +(dolist (sub (list + (replace-regexp-in-string "/" "-" (symbol-name system-type)) + (symbol-name window-system) + (replace-regexp-in-string "\\..*" "" (system-name)))) + (load (concat "module-" sub) t)) + + +(load "config-env") +(load "config-lib") +(load "config-package") +(load "config-set-path") + +(load "module-general") +(load "module-appareance") +(load "module-hydra") +(load "module-editing") +(load "module-codestyle") + +(load "module-ibuffer") +(load "module-git") +(load "module-dired") +(load "module-ivy") +(load "module-project") +(load "module-flycheck") +(load "module-flyspell") +(load "module-autocomplete") + +(load "module-make") +(load "module-pants") + +(load "module-c") +(load "module-docker") +(load "module-go") +(load "module-java") +(load "module-json") +(load "module-lisp") +(load "module-protobuf") +(load "module-puppet") +(load "module-python") +(load "module-rust") +(load "module-scala") +(load "module-shell") +(load "module-thrift") + +(load "module-markdown") +(load "module-toml") +(load "module-yaml") diff --git a/emacs.d/modules/module-appareance.el b/emacs.d/modules/module-appareance.el index 10f7918..b9a1463 100644 --- a/emacs.d/modules/module-appareance.el +++ b/emacs.d/modules/module-appareance.el @@ -29,7 +29,7 @@ (blink-cursor-mode -1) ;; I don't want a frindge on the right -(fringe-mode '(8 . 0)) +(fringe-mode '(8 . 8)) ;; frame title (setq frame-title-format '( "%f" " [" (:eval mode-name) "]")) @@ -49,8 +49,8 @@ :init (setq sml/theme 'light sml/shorten-directory t - sml/no-confirm-load-theme t sml/shorten-modes t + sml/no-confirm-load-theme t sml/name-width 40 sml/mode-width 'full) :config diff --git a/emacs.d/modules/module-autocomplete.el b/emacs.d/modules/module-autocomplete.el index ce15dbc..abbf162 100644 --- a/emacs.d/modules/module-autocomplete.el +++ b/emacs.d/modules/module-autocomplete.el @@ -1,5 +1,3 @@ -(require 'config-package) - (use-package company :commands company-mode :diminish company-mode @@ -13,4 +11,14 @@ company-tooltip-align-annotations t company-require-match nil)) +(use-package lsp-mode + :config + (setq lsp-response-timeout 10)) + +(use-package lsp-ui + :init + (add-hook 'lsp-mode-hook 'lsp-ui-mode)) + +(use-package company-lsp) + (provide 'module-autocomplete) diff --git a/emacs.d/modules/module-c.el b/emacs.d/modules/module-c.el index f21cc30..e1e848c 100644 --- a/emacs.d/modules/module-c.el +++ b/emacs.d/modules/module-c.el @@ -1,5 +1,3 @@ -(require 'config-package) - (use-package google-c-style :commands (google-set-c-style)) diff --git a/emacs.d/modules/module-flyspell.el b/emacs.d/modules/module-flyspell.el index e95ab1e..957e1df 100644 --- a/emacs.d/modules/module-flyspell.el +++ b/emacs.d/modules/module-flyspell.el @@ -1,5 +1,3 @@ -(require 'config-package) - (use-package ispell :config (setq ispell-program-name "aspell" diff --git a/emacs.d/modules/module-git.el b/emacs.d/modules/module-git.el index 350ba5e..0c281cc 100644 --- a/emacs.d/modules/module-git.el +++ b/emacs.d/modules/module-git.el @@ -1,5 +1,3 @@ -(require 'config-package) - (defhydra hydra-magit (:color blue :hint nil :columns 3) "magit" ("RET" magit-visit-thing "visit magit things at point") diff --git a/emacs.d/modules/module-go.el b/emacs.d/modules/module-go.el index 6ac3484..0869af7 100644 --- a/emacs.d/modules/module-go.el +++ b/emacs.d/modules/module-go.el @@ -1,11 +1,7 @@ -(require 'config-package) - (use-package go-mode :mode (("\\.go\\'" . go-mode)) - :bind (:map go-mode-map ("C-z" . hydra-go/body)) - :init (progn (defun fcuny-go-set-tab-width () diff --git a/emacs.d/modules/module-javascript.el b/emacs.d/modules/module-javascript.el index 24f04b1..4a3693d 100644 --- a/emacs.d/modules/module-javascript.el +++ b/emacs.d/modules/module-javascript.el @@ -1,5 +1,3 @@ -(require 'config-package) - (use-package graphql-mode) (use-package js2-mode diff --git a/emacs.d/modules/module-json.el b/emacs.d/modules/module-json.el index 279efb5..aa34a3e 100644 --- a/emacs.d/modules/module-json.el +++ b/emacs.d/modules/module-json.el @@ -1,7 +1,7 @@ (require 'config-package) (use-package json-mode - :mode "\\.json\\'" + :mode "\\.json$|\\.workflow$'" :config (setq json-reformat:indent-width 2) diff --git a/emacs.d/modules/module-project.el b/emacs.d/modules/module-project.el index 1dd46cf..13ff1da 100644 --- a/emacs.d/modules/module-project.el +++ b/emacs.d/modules/module-project.el @@ -1,6 +1,3 @@ -(require 'config-env) -(require 'config-package) - (defhydra hydra-projectile-other-window (:color teal) "projectile-other-window" ("f" projectile-find-file-other-window "file") diff --git a/emacs.d/modules/module-protobuf.el b/emacs.d/modules/module-protobuf.el index 5ef1aee..892cb0d 100644 --- a/emacs.d/modules/module-protobuf.el +++ b/emacs.d/modules/module-protobuf.el @@ -1,7 +1,4 @@ -(require 'config-package) - (use-package protobuf-mode - :ensure t :mode ("\\.proto$" . protobuf-mode)) (provide 'module-protobuf) diff --git a/emacs.d/modules/module-puppet.el b/emacs.d/modules/module-puppet.el index 150ce19..025965b 100644 --- a/emacs.d/modules/module-puppet.el +++ b/emacs.d/modules/module-puppet.el @@ -1,14 +1,7 @@ -(require 'config-package) - -;; To setup flycheck in the GCP's repository: -;; ((puppet-mode -;; (flycheck-puppet-lint-rc .(expand-file-name "gcp-pupet-manifests/.puppet-lint.rc") fcuny/path-twitter-git))) - (use-package puppet-mode :mode ("\\.pp\\'" . puppet-mode) - - :init (add-hook 'puppet-mode-hook 'flycheck-mode)) - ;; :config - ;; (setq flycheck-puppet-lint-rc "/Users/fcuny/workspace/svn.twitter.biz/twitter-ops/utilities/puppet/.puppet-lint.rc")) + :init (add-hook 'puppet-mode-hook 'flycheck-mode) + :config + (setq flycheck-puppet-lint-rc "/Users/fcuny/workspace/svn.twitter.biz/twitter-ops/utilities/puppet/.puppet-lint.rc")) (provide 'module-puppet) diff --git a/emacs.d/modules/module-rust.el b/emacs.d/modules/module-rust.el index a229cc4..b99416f 100644 --- a/emacs.d/modules/module-rust.el +++ b/emacs.d/modules/module-rust.el @@ -1,5 +1,3 @@ -(require 'config-package) - (use-package rust-mode) (use-package racer) diff --git a/emacs.d/modules/module-scala.el b/emacs.d/modules/module-scala.el index bb8a3cb..374c581 100644 --- a/emacs.d/modules/module-scala.el +++ b/emacs.d/modules/module-scala.el @@ -1,7 +1,3 @@ -(require 'config-package) - -(use-package scala-mode - ;; mode to work with scala files - :ensure t) +(use-package scala-mode) (provide 'module-scala) diff --git a/emacs.d/modules/module-shell.el b/emacs.d/modules/module-shell.el index 763d133..684c029 100644 --- a/emacs.d/modules/module-shell.el +++ b/emacs.d/modules/module-shell.el @@ -1,9 +1,5 @@ -(require 'config-package) - (use-package sh-script - ;; configuration to interact with shell scripts :mode ("bashrc" . sh-mode) - :config (defun set-sh-mode-indent () (setq sh-basic-offset 2 diff --git a/emacs.d/modules/module-thrift.el b/emacs.d/modules/module-thrift.el index 03e301a..604810c 100644 --- a/emacs.d/modules/module-thrift.el +++ b/emacs.d/modules/module-thrift.el @@ -1,9 +1,5 @@ -(require 'config-package) - (use-package thrift - ;; mode to work with thrift files :mode ("\\.thrift\\'" . thrift-mode) - :config (setq thrift-indent-level 2)) diff --git a/emacs.d/modules/module-toml.el b/emacs.d/modules/module-toml.el index 42c6bf8..01b60c2 100644 --- a/emacs.d/modules/module-toml.el +++ b/emacs.d/modules/module-toml.el @@ -1,5 +1,3 @@ -(require 'config-package) - -(use-package toml-mode :ensure t) +(use-package toml-mode) (provide 'module-toml) diff --git a/emacs.d/modules/module-yaml.el b/emacs.d/modules/module-yaml.el index 5c111ef..14ccc89 100644 --- a/emacs.d/modules/module-yaml.el +++ b/emacs.d/modules/module-yaml.el @@ -1,7 +1,4 @@ -(require 'config-package) - (use-package yaml-mode - :ensure t :init (add-hook 'yaml-mode-hook 'flycheck-mode) :mode ("\\.ya?ml\\'" . yaml-mode)) -- cgit 1.4.1