summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck.cuny@gmail.com>2018-08-19 16:22:00 -0700
committerFranck Cuny <franck.cuny@gmail.com>2018-08-19 16:22:00 -0700
commit6834aecf39be2e0918d066f47941ad76eca8510a (patch)
treeaa4fe5e1bd38e1c62ba0d103bd8fa4e2953e56f5
parent[emacs] Move some more configuration back to init.el (diff)
downloademacs.d-6834aecf39be2e0918d066f47941ad76eca8510a.tar.gz
[emacs] merge configurations
-rw-r--r--configs/rcs/emacs.d/config/fcuny-basic-settings.el5
-rw-r--r--configs/rcs/emacs.d/config/fcuny-darwin.el16
-rw-r--r--configs/rcs/emacs.d/config/fcuny-linux.el8
-rw-r--r--configs/rcs/emacs.d/config/fcuny-prog.el161
-rw-r--r--configs/rcs/emacs.d/config/fcuny-serializers.el38
-rw-r--r--configs/rcs/emacs.d/config/fcuny-text.el30
-rw-r--r--configs/rcs/emacs.d/init.el292
7 files changed, 243 insertions, 307 deletions
diff --git a/configs/rcs/emacs.d/config/fcuny-basic-settings.el b/configs/rcs/emacs.d/config/fcuny-basic-settings.el
deleted file mode 100644
index 9ab1046..0000000
--- a/configs/rcs/emacs.d/config/fcuny-basic-settings.el
+++ /dev/null
@@ -1,5 +0,0 @@
-(eval-when-compile
-  (require 'use-package))
-
-
-(provide 'fcuny-basic-settings)
diff --git a/configs/rcs/emacs.d/config/fcuny-darwin.el b/configs/rcs/emacs.d/config/fcuny-darwin.el
deleted file mode 100644
index a699cf0..0000000
--- a/configs/rcs/emacs.d/config/fcuny-darwin.el
+++ /dev/null
@@ -1,16 +0,0 @@
-(eval-when-compile
-  (require 'use-package))
-
-;; Set default font.
-(set-face-attribute 'default nil :height 160 :weight 'normal :width 'normal)
-
-(use-package exec-path-from-shell
-  :ensure t
-  :config
-  (exec-path-from-shell-initialize)
-  (if (fc/check-work-machine-p)
-      (dolist (var '("GEM_HOME" "GEM_PATH" "MY_RUBY_HOME"))
-        (unless (getenv var)
-          (exec-path-from-shell-copy-env var)))))
-
-(provide 'fcuny-darwin)
diff --git a/configs/rcs/emacs.d/config/fcuny-linux.el b/configs/rcs/emacs.d/config/fcuny-linux.el
deleted file mode 100644
index f0d7c52..0000000
--- a/configs/rcs/emacs.d/config/fcuny-linux.el
+++ /dev/null
@@ -1,8 +0,0 @@
-;; Set default font.
-(set-face-attribute 'default nil :height 130 :weight 'normal :width 'normal)
-
-(setenv "PATH" (concat fcuny-path-go-bin path-separator (getenv "PATH")))
-
-(add-to-list 'exec-path fcuny-path-go-bin)
-
-(provide 'fcuny-linux)
diff --git a/configs/rcs/emacs.d/config/fcuny-prog.el b/configs/rcs/emacs.d/config/fcuny-prog.el
deleted file mode 100644
index c7d267c..0000000
--- a/configs/rcs/emacs.d/config/fcuny-prog.el
+++ /dev/null
@@ -1,161 +0,0 @@
-(eval-when-compile
-  (require 'use-package))
-
-;; auto close bracket, parenthesis insertion
-(electric-pair-mode 1)
-
-(use-package paren
-  :custom
-  (show-paren-delay 0)
-  :config
-  (show-paren-mode 1))
-
-(use-package lisp-mode
-  :bind
-  (("C-c C-e" . eval-buffer)
-   ("C-c C-r" . eval-region)))
-
-(use-package eldoc
-  :ensure t
-  :hook (emacs-lisp-mode-hook))
-
-(use-package pants
-  :load-path (lambda () (expand-file-name  "github.com/fcuny/pants.el/" fcuny-path-workspace))
-  :custom
-  (pants-completion-system 'ivy)
-  (pants-source-tree-root (expand-file-name "git.twitter.biz/source" fcuny-path-workspace))
-  (pants-bury-compilation-buffer t)
-  (pants-extra-args "-q")
-  :bind (("C-c b" . pants-find-build-file)
-         ("C-c r" . pants-run-binary)
-         ("C-c t" . pants-run-test))
-  :init
-  (if (fc/check-work-machine-p)
-      (add-to-list 'auto-mode-alist '("BUILD" . python-mode))))
-
-(use-package make-mode
-  :ensure t
-  :config
-  (add-hook 'makefile-mode-hook (lambda () (setq-local tab-width 2))))
-
-(use-package company
-  :ensure t
-  :diminish company-mode
-  :config
-  (global-company-mode)
-  (setq company-global-modes '(not term-mode)
-        company-idle-delay 0.3
-        company-minimum-prefix-length 3
-        company-selection-wrap-around t
-        company-show-numbers t
-        company-tooltip-align-annotations t
-        company-require-match nil))
-
-(use-package magit
-  :ensure t
-  :mode (("differential-update-comments" . git-commit-mode)
-         ("new-commit"                   . git-commit-mode))
-  :bind (("C-x g s" . magit-status)
-         ("C-x g b" . magit-checkout))
-  :init
-  (progn
-    (setq magit-completing-read-function 'ivy-completing-read))
-
-  :config
-  (progn
-    (global-git-commit-mode)
-
-    ;; I don't care about other VC backend for work
-    (if (fc/check-work-machine-p)
-      (setf vc-handled-backends nil
-            vc-follow-symlinks t))
-
-    (use-package git-commit :ensure t)
-
-    (add-hook 'magit-log-edit-mode-hook
-              #'(lambda ()
-                  (set-fill-column 72)
-                  (flyspell-mode)))))
-
-(use-package go-mode
-  :ensure t
-  :after (company flycheck)
-  :preface
-  (defun fcuny/go-mode-setup ()
-    (add-hook 'go-mode-hook 'flycheck-mode)
-    (setq-default)
-    (setq tab-width 2))
-  :config
-  (add-hook 'go-mode-hook #'fcuny/go-mode-setup))
-
-(use-package go-eldoc
-  :after go-mode
-  :ensure t
-  :hook (go-mode . go-eldoc-setup))
-
-(use-package gotest
-  :ensure t)
-
-(use-package go-guru
-  :ensure t)
-
-(use-package go-imports
-  :ensure t)
-
-(use-package golint
-  :ensure t)
-
-(use-package go-projectile
-  :ensure t)
-
-(use-package company-go
-  :ensure t
-  :after (company go-mode)
-  :custom
-  (company-go-show-annotation t)
-  :config
-  (add-hook 'go-mode-hook 'company-mode)
-  (add-to-list 'company-backends 'company-go))
-
-(use-package python
-  :mode (("\\.py$" . python-mode))
-  :ensure t
-  :commands python-mode
-  :custom (python-indent-offset 2))
-
-(use-package anaconda-mode
-  :ensure t
-  :after python
-  :hook ((python-mode . anaconda-mode)
-         (python-mode . eldoc-mode))
-  :custom (anaconda-mode-eldoc-as-single-line t))
-
-(use-package company-anaconda
-  :ensure t
-  :after anaconda-mode
-  :init
-  (add-to-list 'company-backends 'company-anaconda))
-
-(use-package scala-mode :ensure t)
-
-(use-package sh-script
-  :mode ("bashrc" . sh-mode)
-  :config
-  (defun set-sh-mode-indent ()
-    (setq sh-basic-offset 2
-          sh-indentation 2))
-  (add-hook 'sh-mode-hook 'set-sh-mode-indent)
-  (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p))
-
-(use-package dockerfile-mode
-  :ensure t)
-
-(use-package puppet-mode
-  :ensure t
-  :mode ("\\.pp\\'" . puppet-mode)
-  ;:hook (flycheck-mode)
-  :config
-  (if (fc/check-work-machine-p)
-    (setq flycheck-puppet-lint-rc fcuny-path-puppet-linter-svn)))
-
-(provide 'fcuny-prog)
diff --git a/configs/rcs/emacs.d/config/fcuny-serializers.el b/configs/rcs/emacs.d/config/fcuny-serializers.el
deleted file mode 100644
index 76fa6c2..0000000
--- a/configs/rcs/emacs.d/config/fcuny-serializers.el
+++ /dev/null
@@ -1,38 +0,0 @@
-(eval-when-compile
-  (require 'use-package))
-
-(use-package yaml-mode
-  :ensure t
-  :after (flycheck flyspell)
-  :mode (("\\.yml?\\'" . yaml-mode)
-         ("\\.yaml?\\'" . yaml-mode))
-  :hook ((yaml-mode . flycheck-mode)
-         (yaml-mode . flyspell-prog-mode)))
-
-(use-package json-mode
-  :ensure t
-  :after (flycheck flyspell)
-  :custom
-  (json-reformat:indent-width 2)
-  (js-indent-level 2)
-  :hook ((json-mode . flyspell-prog-mode)
-         (json-mode . flycheck-mode))
-  :init
-  (if (fc/check-work-machine-p)
-    (add-to-list 'auto-mode-alist '("\\.workflow$" . json-mode))))
-
-(use-package thrift
-  :ensure t
-  :after (flycheck flyspell)
-  :custom
-  (thrift-indent-level 2)
-  :hook ((thrift . flyspell-prog-mode)
-         (thrift . flycheck-mode)))
-
-(use-package protobuf-mode
-  :ensure t
-  :after (flycheck flyspell)
-  :hook ((protobuf-mode . flyspell-prog-mode)
-         (protobuf-mode . flycheck-mode)))
-
-(provide 'fcuny-serializers)
diff --git a/configs/rcs/emacs.d/config/fcuny-text.el b/configs/rcs/emacs.d/config/fcuny-text.el
deleted file mode 100644
index 3bcd17c..0000000
--- a/configs/rcs/emacs.d/config/fcuny-text.el
+++ /dev/null
@@ -1,30 +0,0 @@
-(eval-when-compile
-  (require 'use-package))
-
-(use-package ispell
-  :ensure t
-  :config
-  (when (executable-find "aspell")
-    (setq ispell-program-name "aspell"
-          ispell-list-command "--list")))
-
-(use-package flyspell-correct
-  :ensure t)
-
-(use-package flyspell
-  :ensure t
-  :hook ((text-mode-hook . flyspell-mode)
-         (prog-mode-hook . flyspell-prog-mode)))
-
-(use-package markdown-mode
-  :ensure t
-  :after (flyspell)
-  :mode (("\\.md\\'" . gfm-mode)
-         ("\\.markdown\\'" . gfm-mode))
-  :hook (markdown-mode . flyspell-mode)
-  :init (setq markdown-command "pandoc -f markdown_github -c https://goo.gl/OVmlwT --self-contained"
-              markdown-header-scaling 't)
-  :config
-  (add-hook 'gfm-mode-hook 'visual-line-mode))
-
-(provide 'fcuny-text)
diff --git a/configs/rcs/emacs.d/init.el b/configs/rcs/emacs.d/init.el
index a0a1771..300dde0 100644
--- a/configs/rcs/emacs.d/init.el
+++ b/configs/rcs/emacs.d/init.el
@@ -21,7 +21,6 @@
 
 (require 'use-package)
 
-;; set a number of custom variables
 (defvar fcuny-path-home (getenv "HOME")
   "Path to the user's home directory.")
 
@@ -46,8 +45,7 @@
 (defvar fcuny-custom-settings (expand-file-name "emacs-custom.el" fcuny-path-emacs-var)
   "Path to emacs custom variables.")
 
-;; a few custom functions
-(defun fcuny-rename-this-buffer-and-file ()
+(defun fc/rename-this-buffer-and-file ()
   "Renames current buffer and file it is visiting."
   (interactive)
   (let ((name (buffer-name))
@@ -75,14 +73,6 @@
        (buffer-file-name)
        (string-match "source/.*\.py$" (buffer-file-name))))
 
-(defun fcuny/init-load-path ()
-  "Load custom configurations."
-  (let* ((before load-path)
-         (config-dir (expand-file-name "config" user-emacs-directory)))
-    (dolist (path (append (list config-dir)))
-      (add-to-list 'load-path path)
-      (add-to-list 'Info-default-directory-list path))))
-
 ;; set utf-8 as the default encoding
 (prefer-coding-system 'utf-8-unix)
 (set-terminal-coding-system 'utf-8)
@@ -95,8 +85,6 @@
 (setq auto-save-list-file-prefix nil)          ;; no backups
 (setq create-lockfiles nil)                    ;; don't use a lock file
 (setq custom-file fcuny-custom-settings)       ;; where to save custom settings
-(setq inhibit-startup-message t)               ;; Skip the default splash screen
-(setq inhibit-startup-screen t)                ;; I don't want a startup screen
 (setq make-backup-files nil)                   ;; really no backups
 (setq minibuffer-message-timeout 0.5)          ;; How long to display an echo-area message
 (setq next-screen-context-lines 5)             ;; scroll 5 lines at a time
@@ -104,36 +92,31 @@
 (setq ring-bell-function 'ignore)              ;; really no bell
 (setq tab-always-indent 'complete)             ;; when using TAB, always indent
 (setq visible-bell nil)                        ;; no bell
-
+(setq column-number-mode t)                    ;; show column number in the mode line
+(setq use-package-always-ensure t)             ;; always ensure packages are present
 (setq-default indent-tabs-mode nil)            ;; turn off tab indentation
 (setq-default cursor-type 'hbar)               ;; cursor is a horizontal bar
 
-;; size of the fringe
-(fringe-mode '(8 . 8))
-
-;; show column number in the mode line
-(setq column-number-mode t)
+(fringe-mode '(8 . 8))                         ;; size of the fringe
 
-;; Remap join-line to M-j where it's easier to get to.
-(global-set-key (kbd "M-j") 'join-line)
+(global-set-key (kbd "M-j") 'join-line)                           ;; Remap join-line to M-j where it's easier to get to.
+(global-set-key (kbd "<s-return>") 'toggle-frame-fullscreen)      ;; Shift-Return switch to full-screen
 
-(use-package tool-bar
-  :config
-  (tool-bar-mode -1))
+(custom-set-variables
+ '(tool-bar-mode nil)
+ '(scroll-bar-mode nil)
+ '(use-file-dialog nil)
+ '(use-dialog-box nil)
+ '(blink-cursor-mode nil)
+ '(inhibit-startup-screen t)
+ '(inhibit-startup-message t)
+ '(inhibit-startup-echo-area-message t))
 
-(use-package scroll-bar
-  :config
-  (scroll-bar-mode -1))
-
-(use-package frame
-  :bind ("<s-return>" . toggle-frame-fullscreen)
-  :config
-  (blink-cursor-mode -1)
-  (when (eq system-type 'darwin)
-    (setq ns-use-native-fullscreen nil)))
+;; when using darwin, I don't want to use the native fullscreen mode (it opens a new workspace)
+(when (eq system-type 'darwin)
+  (setq ns-use-native-fullscreen nil))
 
 (use-package auto-package-update
-  :ensure t
   :custom
   (auto-package-update-delete-old-versions t)
   (auto-package-update-hide-results t)
@@ -185,7 +168,6 @@
   :hook (whitespace-mode))
 
 (use-package counsel
-  :ensure t
   :bind
   (("M-x"     . counsel-M-x)
    ("C-s"     . counsel-grep-or-swiper)
@@ -197,11 +179,10 @@
   :custom
   (counsel-find-file-at-point t)
   :config
-  (use-package swiper :ensure t)
-  (use-package counsel-projectile :ensure t))
+  (use-package swiper)
+  (use-package counsel-projectile))
 
 (use-package ivy
-  :ensure t
   :diminish (ivy-mode . "")
   :bind ("C-c m" . ivy-switch-project)
   :config
@@ -234,7 +215,6 @@
      ("r" projectile-remove-known-project "Remove project(s)"))))
 
 (use-package projectile
-  :ensure t
   :diminish projectile-mode
   :bind-keymap ("C-c p" . projectile-command-map)
 
@@ -253,7 +233,6 @@
                                                   projectile-globally-ignored-files)))
 
 (use-package ag
-  :ensure t
   :bind (:map ag-mode-map
               ("p" . compilation-previous-error)
               ("n" . compilation-next-error)
@@ -265,6 +244,7 @@
   (ag-reuse-window t))
 
 (use-package dired
+  :ensure nil
   :defer t
   :bind ("C-x C-d"  . dired)
   :init
@@ -276,11 +256,9 @@
     (when gls (setq insert-directory-program gls))))
 
 (use-package ibuffer
-  :ensure t
   :bind ("C-x C-b" . ibuffer))
 
 (use-package flycheck
-  :ensure t
   :config
   (progn
     (add-hook 'prog-mode-hook 'flycheck-mode)
@@ -297,10 +275,226 @@
         :modes (python-mode))
       (add-to-list 'flycheck-checkers 'fc/twitter-source-check))))
 
-(fcuny/init-load-path)
+(use-package ispell
+  :config
+  (when (executable-find "aspell")
+    (setq ispell-program-name "aspell"
+          ispell-list-command "--list")))
+
+(use-package flyspell-correct)
+
+(use-package flyspell
+  :hook ((text-mode-hook . flyspell-mode)
+         (prog-mode-hook . flyspell-prog-mode)))
+
+(use-package markdown-mode
+  :after (flyspell)
+  :mode (("\\.md\\'" . gfm-mode)
+         ("\\.markdown\\'" . gfm-mode))
+  :hook (markdown-mode . flyspell-mode)
+  :init (setq markdown-command "pandoc -f markdown_github -c https://goo.gl/OVmlwT --self-contained"
+              markdown-header-scaling 't)
+  :config
+  (add-hook 'gfm-mode-hook 'visual-line-mode))
+
+(use-package exec-path-from-shell
+  :if (memq window-system '(mac ns))
+  :config
+  (exec-path-from-shell-initialize)
+  (if (fc/check-work-machine-p)
+      (dolist (var '("GEM_HOME" "GEM_PATH" "MY_RUBY_HOME"))
+        (unless (getenv var)
+          (exec-path-from-shell-copy-env var)))))
+
+;; auto close bracket, parenthesis insertion
+(electric-pair-mode 1)
+
+(use-package paren
+  :custom
+  (show-paren-delay 0)
+  :config
+  (show-paren-mode 1))
+
+(use-package lisp-mode
+  :ensure f
+  :bind
+  (("C-c C-e" . eval-buffer)
+   ("C-c C-r" . eval-region)))
+
+(use-package eldoc
+  :ensure t
+  :hook (emacs-lisp-mode-hook))
+
+(use-package pants
+  :load-path (lambda () (expand-file-name  "github.com/fcuny/pants.el/" fcuny-path-workspace))
+  :custom
+  (pants-completion-system 'ivy)
+  (pants-source-tree-root (expand-file-name "git.twitter.biz/source" fcuny-path-workspace))
+  (pants-bury-compilation-buffer t)
+  (pants-extra-args "-q")
+  :bind (("C-c b" . pants-find-build-file)
+         ("C-c r" . pants-run-binary)
+         ("C-c t" . pants-run-test))
+  :init
+  (if (fc/check-work-machine-p)
+      (add-to-list 'auto-mode-alist '("BUILD" . python-mode))))
+
+(use-package make-mode
+  :ensure t
+  :config
+  (add-hook 'makefile-mode-hook (lambda () (setq-local tab-width 2))))
+
+(use-package company
+  :ensure t
+  :diminish company-mode
+  :config
+  (global-company-mode)
+  (setq company-global-modes '(not term-mode)
+        company-idle-delay 0.3
+        company-minimum-prefix-length 3
+        company-selection-wrap-around t
+        company-show-numbers t
+        company-tooltip-align-annotations t
+        company-require-match nil))
+
+(use-package magit
+  :ensure t
+  :mode (("differential-update-comments" . git-commit-mode)
+         ("new-commit"                   . git-commit-mode))
+  :bind (("C-x g s" . magit-status)
+         ("C-x g b" . magit-checkout))
+  :init
+  (progn
+    (setq magit-completing-read-function 'ivy-completing-read))
+
+  :config
+  (progn
+    (global-git-commit-mode)
+
+    ;; I don't care about other VC backend for work
+    (if (fc/check-work-machine-p)
+      (setf vc-handled-backends nil
+            vc-follow-symlinks t))
+
+    (use-package git-commit :ensure t)
+
+    (add-hook 'magit-log-edit-mode-hook
+              #'(lambda ()
+                  (set-fill-column 72)
+                  (flyspell-mode)))))
+
+(use-package go-mode
+  :ensure t
+  :after (company flycheck)
+  :preface
+  (defun fcuny/go-mode-setup ()
+    (add-hook 'go-mode-hook 'flycheck-mode)
+    (setq-default)
+    (setq tab-width 2))
+  :config
+  (add-hook 'go-mode-hook #'fcuny/go-mode-setup))
+
+(use-package go-eldoc
+  :after go-mode
+  :ensure t
+  :hook (go-mode . go-eldoc-setup))
+
+(use-package gotest
+  :ensure t)
+
+(use-package go-guru
+  :ensure t)
+
+(use-package go-imports
+  :ensure t)
+
+(use-package golint
+  :ensure t)
+
+(use-package go-projectile
+  :ensure t)
+
+(use-package company-go
+  :ensure t
+  :after (company go-mode)
+  :custom
+  (company-go-show-annotation t)
+  :config
+  (add-hook 'go-mode-hook 'company-mode)
+  (add-to-list 'company-backends 'company-go))
+
+(use-package python
+  :mode (("\\.py$" . python-mode))
+  :ensure t
+  :commands python-mode
+  :custom (python-indent-offset 2))
+
+(use-package anaconda-mode
+  :ensure t
+  :after python
+  :hook ((python-mode . anaconda-mode)
+         (python-mode . eldoc-mode))
+  :custom (anaconda-mode-eldoc-as-single-line t))
 
-(use-package fcuny-darwin :if (memq window-system '(mac ns)))
-(use-package fcuny-linux  :if (string-equal system-type "gnu/linux"))
-(use-package fcuny-text)
-(use-package fcuny-prog)
-(use-package fcuny-serializers)
+(use-package company-anaconda
+  :ensure t
+  :after anaconda-mode
+  :init
+  (add-to-list 'company-backends 'company-anaconda))
+
+(use-package scala-mode :ensure t)
+
+(use-package sh-script
+  :mode ("bashrc" . sh-mode)
+  :config
+  (defun set-sh-mode-indent ()
+    (setq sh-basic-offset 2
+          sh-indentation 2))
+  (add-hook 'sh-mode-hook 'set-sh-mode-indent)
+  (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p))
+
+(use-package dockerfile-mode
+  :ensure t)
+
+(use-package puppet-mode
+  :ensure t
+  :mode ("\\.pp\\'" . puppet-mode)
+  ;:hook (flycheck-mode)
+  :config
+  (if (fc/check-work-machine-p)
+    (setq flycheck-puppet-lint-rc fcuny-path-puppet-linter-svn)))
+
+
+(use-package yaml-mode
+  :ensure t
+  :after (flycheck flyspell)
+  :mode (("\\.yml?\\'" . yaml-mode)
+         ("\\.yaml?\\'" . yaml-mode))
+  :hook ((yaml-mode . flycheck-mode)
+         (yaml-mode . flyspell-prog-mode)))
+
+(use-package json-mode
+  :ensure t
+  :after (flycheck flyspell)
+  :custom
+  (json-reformat:indent-width 2)
+  (js-indent-level 2)
+  :hook ((json-mode . flyspell-prog-mode)
+         (json-mode . flycheck-mode))
+  :init
+  (if (fc/check-work-machine-p)
+    (add-to-list 'auto-mode-alist '("\\.workflow$" . json-mode))))
+
+(use-package thrift
+  :ensure t
+  :after (flycheck flyspell)
+  :custom
+  (thrift-indent-level 2)
+  :hook ((thrift . flyspell-prog-mode)
+         (thrift . flycheck-mode)))
+
+(use-package protobuf-mode
+  :ensure t
+  :after (flycheck flyspell)
+  :hook ((protobuf-mode . flyspell-prog-mode)
+         (protobuf-mode . flycheck-mode)))