use-package configuration is better
This commit is contained in:
		
							parent
							
								
									5b50bfea88
								
							
						
					
					
						commit
						bd5e9a2b46
					
				
					 16 changed files with 185 additions and 174 deletions
				
			
		
							
								
								
									
										15
									
								
								custom.el
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								custom.el
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| (custom-set-variables | ||||
|  ;; custom-set-variables was added by Custom. | ||||
|  ;; If you edit it by hand, you could mess it up, so be careful. | ||||
|  ;; Your init file should contain only one such instance. | ||||
|  ;; If there is more than one, they won't work right. | ||||
|  '(ffap-machine-p-known (quote reject)) | ||||
|  '(package-selected-packages | ||||
|    (quote | ||||
|     (undo-tree ein-mumamo yasnippet use-package racer material-theme magit lsp-ui helm flycheck-rust elm-mode company-lsp cargo)))) | ||||
| (custom-set-faces | ||||
|  ;; custom-set-faces was added by Custom. | ||||
|  ;; If you edit it by hand, you could mess it up, so be careful. | ||||
|  ;; Your init file should contain only one such instance. | ||||
|  ;; If there is more than one, they won't work right. | ||||
|  ) | ||||
							
								
								
									
										26
									
								
								init.el
									
										
									
									
									
								
							
							
						
						
									
										26
									
								
								init.el
									
										
									
									
									
								
							|  | @ -4,8 +4,9 @@ | |||
| (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) | ||||
| (package-initialize) | ||||
| 
 | ||||
| (setq dotfiles-dir (file-name-directory | ||||
|                     (or (buffer-file-name) (file-chase-links load-file-name)))) | ||||
| (setq dotfiles-dir | ||||
|       (file-name-directory | ||||
|         (or (buffer-file-name) (file-chase-links load-file-name)))) | ||||
| 
 | ||||
| (add-to-list 'load-path (concat dotfiles-dir "modules")) | ||||
| 
 | ||||
|  | @ -16,24 +17,13 @@ | |||
| (require 'jenga-helm) | ||||
| (require 'jenga-magit) | ||||
| (require 'jenga-org) | ||||
| (require 'jenga-python) | ||||
| (require 'jenga-theme) | ||||
| (require 'jenga-ui) | ||||
| 
 | ||||
| ;; Custom languages and highlighting | ||||
| (require 'jenga-elm) | ||||
| (require 'jenga-rust) | ||||
| (require 'jenga-systemd) | ||||
| (custom-set-variables | ||||
|  ;; custom-set-variables was added by Custom. | ||||
|  ;; If you edit it by hand, you could mess it up, so be careful. | ||||
|  ;; Your init file should contain only one such instance. | ||||
|  ;; If there is more than one, they won't work right. | ||||
|  '(package-selected-packages | ||||
|    (quote | ||||
|     (ein-mumamo yasnippet use-package racer material-theme magit lsp-ui helm flycheck-rust elm-mode company-lsp cargo)))) | ||||
| (custom-set-faces | ||||
|  ;; custom-set-faces was added by Custom. | ||||
|  ;; If you edit it by hand, you could mess it up, so be careful. | ||||
|  ;; Your init file should contain only one such instance. | ||||
|  ;; If there is more than one, they won't work right. | ||||
|  ) | ||||
| (require 'jenga-python) | ||||
| 
 | ||||
| (setq custom-file "~/.emacs.d/custom.el") | ||||
| (load custom-file) | ||||
|  |  | |||
|  | @ -1,12 +1,15 @@ | |||
| ;;;; Company configuration. | ||||
| (require 'jenga-functions) | ||||
| (instl 'company) | ||||
| 
 | ||||
| ;; Allign annotations in company auto-complete list. | ||||
| (setq company-tooltip-align-annotations t) | ||||
| (add-hook 'after-init-hook 'global-company-mode) | ||||
| 
 | ||||
| (setq tab-always-indent 'complete) | ||||
| (add-to-list 'completion-styles 'initials t) | ||||
| (use-package company | ||||
|   :ensure t | ||||
|   :defer t | ||||
|   :init (global-company-mode) | ||||
|   :config | ||||
|   (progn | ||||
|     (add-to-list 'completion-styles 'initials t) | ||||
|     (bind-key "M-<tab>" #'company-complete company-mode-map) | ||||
|     (setq company-tooltip-align-annotations t | ||||
|           tab-always-indent 'complete) | ||||
|     (setq company-dabbrev-downcase nil)) | ||||
|   :diminish company-mode) | ||||
| 
 | ||||
| (provide 'jenga-company) | ||||
|  |  | |||
|  | @ -1,26 +1,25 @@ | |||
| ;;;; Elm mode configuration. | ||||
| (require 'jenga-functions) | ||||
| (instl 'elm-mode) | ||||
| (instl 'lsp-mode) | ||||
| (instl 'lsp-ui) | ||||
| (instl 'yasnippet) | ||||
| (use-package elm-mode | ||||
|     :ensure t | ||||
|     :bind | ||||
|     ("M-<tab>" . company-indent-or-complete-common) | ||||
|     :config | ||||
|     (use-package lsp-mode) | ||||
|     (use-package lsp-ui) | ||||
|     (use-package yasnippet) | ||||
|     (use-package company) | ||||
|     (setq elm-format-on-save t | ||||
|           elm-tags-on-save t | ||||
|           elm-tags-exclude-elm-stuff nil) | ||||
|     (add-to-list 'company-backends 'company-elm) | ||||
|     (add-to-list 'auto-mode-alist '("\\.elm\\'" . elm-mode)) | ||||
|     :hook | ||||
|     (after-init . global-flycheck-mode) | ||||
|     (elm-mode   . company-mode) | ||||
|     (elm-mode   . lsp) | ||||
|     (elm-mode   . (lambda () (setq evil-auto-indent nil)))) | ||||
| 
 | ||||
| (add-hook 'elm-mode-hook #'company-mode) | ||||
| (add-hook 'elm-mode-hook #'lsp) | ||||
| (add-hook 'elm-mode-hook (lambda () (setq evil-auto-indent nil))) | ||||
| 
 | ||||
| (add-hook 'after-init-hook #'global-flycheck-mode) | ||||
| (with-eval-after-load 'flycheck | ||||
|       '(add-hook 'flycheck-mode-hook #'flycheck-elm-setup)) | ||||
| 
 | ||||
| (add-to-list 'company-backends 'company-elm) | ||||
| (define-key elm-mode-map (kbd "M-<tab>") #'company-indent-or-complete-common) | ||||
| 
 | ||||
| ;; Turn on Elm mode with *.elm files. | ||||
| (add-to-list 'auto-mode-alist '("\\.elm\\'" . elm-mode)) | ||||
| 
 | ||||
| (setq elm-format-on-save t | ||||
|       elm-tags-on-save t | ||||
|       elm-tags-exclude-elm-stuff nil) | ||||
| 
 | ||||
| (provide 'jenga-elm) | ||||
|  |  | |||
|  | @ -1,16 +1,8 @@ | |||
| ;; Persist command history | ||||
| (savehist-mode 1) | ||||
| 
 | ||||
| ;; Disable the splash screen (to enable it agin, replace the t with 0). | ||||
| (setq inhibit-splash-screen t) | ||||
| 
 | ||||
| ;; Disable the menu. | ||||
| (tool-bar-mode -1) | ||||
| ;; Enable transient mark mode. | ||||
| (transient-mark-mode 1) | ||||
| 
 | ||||
| ;; Highlight paired parentheses when cursor is over one. | ||||
| (show-paren-mode 1) | ||||
| ;; Enable C-r in evil | ||||
| (undo-tree-mode 1) | ||||
| 
 | ||||
| ;;;; TAGS configuration. | ||||
| ;; Goto tag with M-. | ||||
|  | @ -21,21 +13,10 @@ | |||
|     (message "Loading tags file: %s" my-tags-file) | ||||
|     (visit-tags-table my-tags-file))) | ||||
| 
 | ||||
| ;;(setq split-height-threshold nil) | ||||
| ;;(setq split-width-threshold 0) | ||||
| ;; Resize windows | ||||
| (global-set-key (kbd "S-C-h") 'shrink-window-horizontally) | ||||
| (global-set-key (kbd "S-C-l") 'enlarge-window-horizontally) | ||||
| (global-set-key (kbd "S-C-j") 'shrink-window) | ||||
| (global-set-key (kbd "S-C-k") 'enlarge-window) | ||||
| 
 | ||||
| (setq column-number-mode t) | ||||
| 
 | ||||
| (setq-default display-line-numbers-type 'absolute | ||||
|               display-line-numbers-current-absolute t | ||||
|               display-line-numbers-width 4 | ||||
|               display-line-numbers-widen t) | ||||
| 
 | ||||
| (add-hook 'text-mode-hook #'display-line-numbers-mode) | ||||
| (add-hook 'prog-mode-hook #'display-line-numbers-mode) | ||||
| 
 | ||||
| (provide 'jenga-emacs) | ||||
|  |  | |||
|  | @ -2,15 +2,20 @@ | |||
| ;;(unless (package-installed-p 'evil) | ||||
| ;;  (package-refresh-contents) | ||||
| ;;  (package-install 'evil)) | ||||
| (add-to-list 'load-path "~/.emacs.d/evil") | ||||
| (setq evil-want-C-u-scroll t) | ||||
| 
 | ||||
| ;; Enable Evil mode. | ||||
| (require 'evil) | ||||
| (evil-mode 1) | ||||
| 
 | ||||
| (eval-after-load "evil-maps" | ||||
|   ;; Unset Evil's "M-." keymap so that TAGS definitions can be followed. | ||||
|   (define-key evil-normal-state-map "\M-." nil)) | ||||
| (use-package evil | ||||
|     :ensure t | ||||
|     :init ;; tweak evil's configuration before loading it | ||||
|     (setq evil-search-module 'evil-search | ||||
|           evil-ex-complete-emacs-commands nil | ||||
|           evil-vsplit-window-right t | ||||
|           evil-split-window-below t | ||||
|           evil-shift-round nil | ||||
|           evil-want-C-u-scroll t) | ||||
|     :config ;; tweak evil after loading it | ||||
|     (evil-mode) | ||||
|     (setq evil-want-C-u-scroll t) | ||||
|     (eval-after-load "evil-maps" | ||||
|       ;; Unset Evil's "M-." keymap so that TAGS definitions can be followed. | ||||
|       (define-key evil-normal-state-map "\M-." nil))) | ||||
| 
 | ||||
| (provide 'jenga-evil) | ||||
|  |  | |||
|  | @ -1,7 +0,0 @@ | |||
| (defun instl (pckg) | ||||
|     (unless (and should-install-packages (package-installed-p pckg)) | ||||
|       (package-refresh-contents) | ||||
|       (package-install pckg)) | ||||
|     (require pckg)) | ||||
| 
 | ||||
| (provide 'jenga-functions) | ||||
|  | @ -1,13 +1,22 @@ | |||
| ;;;; Heml mode configuration. | ||||
| (require 'jenga-functions) | ||||
| (instl 'helm) | ||||
| 
 | ||||
| (require 'helm-config) | ||||
| 
 | ||||
| (helm-mode 1) | ||||
| (setq helm-autoresize-max-height 0) | ||||
| (setq helm-autoresize-min-height 20) | ||||
| (helm-autoresize-mode 1) | ||||
| (use-package helm | ||||
|     :requires helm-config | ||||
|     :init | ||||
|     (helm-mode 1) | ||||
|     (helm-autoresize-mode 1) | ||||
|     :bind | ||||
|     ("<tab>" . helm-execute-persistent-action) ; rebind tab to run persistent action | ||||
|     ("C-i"   . helm-execute-persistent-action) ; make TAB work in terminal | ||||
|     ("C-z"   . helm-select-action) ; list actions using C-z | ||||
|     :config | ||||
|     (setq helm-autoresize-max-height 0 | ||||
|           helm-autoresize-min-height 20 | ||||
|           helm-split-window-in-side-p           t ; Open helm buffer inside current window, not occupy whole other window | ||||
|           helm-move-to-line-cycle-in-source     t ; Move to end or beginning of source when reaching top or bottom of source. | ||||
|           helm-ff-search-library-in-sexp        t ; Search for library in `require' and `declare-function' sexp. | ||||
|           helm-scroll-amount                    8 ; Scroll 8 lines other window using M-<next>/M-<prior> | ||||
|           helm-ff-file-name-history-use-recentf t | ||||
|           helm-echo-input-in-header-line t)) | ||||
| 
 | ||||
| ;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs. | ||||
| ;; Changed to "C-c h". Note: We must set "C-c h" globally, because we | ||||
|  | @ -15,18 +24,8 @@ | |||
| (global-set-key (kbd "C-c h") 'helm-command-prefix) | ||||
| (global-unset-key (kbd "C-x c")) | ||||
| 
 | ||||
| (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to run persistent action | ||||
| (define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB work in terminal | ||||
| (define-key helm-map (kbd "C-z")  'helm-select-action) ; list actions using C-z | ||||
| 
 | ||||
| (when (executable-find "firefox") | ||||
|   (setq helm-google-suggest-use-curl-p t)) | ||||
| 
 | ||||
| (setq helm-split-window-in-side-p           t ; Open helm buffer inside current window, not occupy whole other window | ||||
|       helm-move-to-line-cycle-in-source     t ; Move to end or beginning of source when reaching top or bottom of source. | ||||
|       helm-ff-search-library-in-sexp        t ; Search for library in `require' and `declare-function' sexp. | ||||
|       helm-scroll-amount                    8 ; Scroll 8 lines other window using M-<next>/M-<prior> | ||||
|       helm-ff-file-name-history-use-recentf t | ||||
|       helm-echo-input-in-header-line t) | ||||
| 
 | ||||
| (provide 'jenga-helm) | ||||
|  |  | |||
|  | @ -1,7 +1,5 @@ | |||
| ;;;; Magit configuration. | ||||
| (require 'jenga-functions) | ||||
| (instl 'magit) | ||||
| 
 | ||||
| (setq magit-auto-revert-mode nil) | ||||
| (use-package magit | ||||
|     :init (setq magit-auto-revert-mode nil)) | ||||
| 
 | ||||
| (provide 'jenga-magit) | ||||
|  |  | |||
|  | @ -1,9 +1,7 @@ | |||
| ;;;; Org mode configuration. | ||||
| ;; Enable Org mode. | ||||
| (require 'jenga-functions) | ||||
| (instl 'org) | ||||
| 
 | ||||
| ;; Turn on Org mode on .org files. | ||||
| (add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) | ||||
| (use-package org | ||||
|     :ensure t | ||||
|     :init (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))) | ||||
| 
 | ||||
| (provide 'jenga-org) | ||||
|  |  | |||
|  | @ -1,26 +1,33 @@ | |||
| ;;;; Python configuration. | ||||
| (require 'jenga-functions) | ||||
| (instl 'elpy) | ||||
| (instl 'jupyter) | ||||
| (instl 'ein) | ||||
| (instl 'py-autopep8) | ||||
| (instl 'yasnippet) | ||||
| 
 | ||||
| (elpy-enable) | ||||
| 
 | ||||
| (add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save) | ||||
| 
 | ||||
| ;; Enable Flycheck | ||||
| (when (require 'flycheck nil t) | ||||
|   (setq elpy-modules (delq 'elpy-module-flymake elpy-modules)) | ||||
|   (add-hook 'elpy-mode-hook 'flycheck-mode)) | ||||
| 
 | ||||
| ;; Use IPython for REPL | ||||
| (setq python-shell-interpreter "jupyter" | ||||
|       python-shell-interpreter-args "console --simple-prompt" | ||||
|       python-shell-prompt-detect-failure-warning nil) | ||||
| 
 | ||||
| (add-to-list 'python-shell-completion-native-disabled-interpreters | ||||
|              "jupyter") | ||||
| (use-package jupyter | ||||
|     :ensure t) | ||||
| (use-package ein | ||||
|     :ensure t) | ||||
| (use-package py-autopep8 | ||||
|     :ensure t) | ||||
| (use-package yasnippet | ||||
|     :ensure t) | ||||
| (use-package jedi | ||||
|     :ensure t) | ||||
| (use-package elpy | ||||
|     :ensure t | ||||
|     :init | ||||
|     (elpy-enable) | ||||
|     :bind | ||||
|     ("M-." . jedi:goto-definition) | ||||
|     ("M-," . jedi:goto-definition-pop-marker) | ||||
|     :config | ||||
|     (setq python-shell-interpreter "jupyter" | ||||
|           python-indent-offset 4 | ||||
|           python-shell-interpreter-args "console --simple-prompt" | ||||
|           python-shell-prompt-detect-failure-warning nil) | ||||
|     ;; Use IPython for REPL | ||||
|     (add-to-list 'python-shell-completion-native-disabled-interpreters | ||||
|                  "jupyter") | ||||
|     :hook | ||||
|     (elpy-mode . py-autopep8-enable-on-save) | ||||
|     (elpy-mode . flycheck-mode) | ||||
|     (elpy-mode . jedi:setup) | ||||
|     (elpy-mode . jedi:ac-setup)) | ||||
| 
 | ||||
| (provide 'jenga-python) | ||||
|  |  | |||
							
								
								
									
										0
									
								
								modules/jenga-rst.el
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								modules/jenga-rst.el
									
										
									
									
									
										Normal file
									
								
							|  | @ -1,27 +1,26 @@ | |||
| ;;;; Rust mode configuration. | ||||
| ;; Add rust load hooks. | ||||
| (require 'jenga-functions) | ||||
| (instl 'rust-mode) | ||||
| (instl 'racer) | ||||
| (instl 'cargo) | ||||
| (instl 'flycheck-rust) | ||||
| (use-package cargo) | ||||
| (use-package flycheck-rust) | ||||
| 
 | ||||
| (add-hook 'rust-mode-hook #'racer-mode) | ||||
| (add-hook 'racer-mode-hook #'eldoc-mode) | ||||
| (add-hook 'racer-mode-hook #'company-mode) | ||||
| (add-hook 'rust-mode-hook #'cargo-minor-mode) | ||||
| (use-package rust-mode | ||||
|     :init (add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode)) | ||||
|     :bind | ||||
|     ("M-."     . racer-find-definition) | ||||
|     ("M-h"     . racer-describe) | ||||
|     ("M-<tab>" . company-indent-or-complete-common) | ||||
|     :config | ||||
|     (setq rust-format-on-save t) | ||||
|     :hook | ||||
|     (after-init . global-flycheck-mode) | ||||
|     (rust-mode  . racer-mode) | ||||
|     (rust-mode  . cargo-minor-mode)) | ||||
| 
 | ||||
| (use-package racer | ||||
|     :hook | ||||
|     (racer-mode . eldoc-mode) | ||||
|     (racer-mode . company-mode)) | ||||
| 
 | ||||
| (add-hook 'after-init-hook #'global-flycheck-mode) | ||||
| (add-hook 'flycheck-mode-hook #'flycheck-rust-setup) | ||||
| 
 | ||||
| 
 | ||||
| ;; Turn on Rust mode with *.rs files. | ||||
| (add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode)) | ||||
| ;; Auto-format with rustfmt on save. | ||||
| (setq rust-format-on-save t) | ||||
| 
 | ||||
| (define-key rust-mode-map (kbd "M-.") #'racer-find-definition) | ||||
| (define-key rust-mode-map (kbd "M-h") #'racer-describe) | ||||
| (define-key rust-mode-map (kbd "M-<tab>") #'company-indent-or-complete-common) | ||||
| 
 | ||||
| (provide 'jenga-rust) | ||||
|  |  | |||
|  | @ -1,13 +1,13 @@ | |||
| (add-to-list 'auto-mode-alist '("\\.service\\'" . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.timer\\'" . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.target\\'" . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.mount\\'" . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.service\\'"   . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.timer\\'"     . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.target\\'"    . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.mount\\'"     . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.automount\\'" . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.slice\\'" . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.path\\'" . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.netdev\\'" . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.network\\'" . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.link\\'" . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.slice\\'"     . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.socket\\'"    . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.path\\'"      . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.netdev\\'"    . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.network\\'"   . conf-unix-mode)) | ||||
| (add-to-list 'auto-mode-alist '("\\.link\\'"      . conf-unix-mode)) | ||||
| 
 | ||||
| (provide 'jenga-systemd) | ||||
|  |  | |||
|  | @ -1,7 +0,0 @@ | |||
| ;; Use material theme on black background. | ||||
| (unless (package-installed-p 'material-theme) | ||||
|   (package-refresh-contents) | ||||
|   (package-install 'material-theme)) | ||||
| (require 'material-theme) | ||||
| 
 | ||||
| (provide 'jenga-theme) | ||||
							
								
								
									
										31
									
								
								modules/jenga-ui.el
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								modules/jenga-ui.el
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,31 @@ | |||
| ;; Use material theme on black background. | ||||
| (use-package material-theme) | ||||
| 
 | ||||
| ;; | ||||
| ;; =============== | ||||
| ;; Other UI tweaks | ||||
| ;; =============== | ||||
| ;; | ||||
| ;; Disable the splash screen (to enable it agin, replace the t with 0). | ||||
| (setq inhibit-splash-screen t) | ||||
| 
 | ||||
| ;; Disable the menu. | ||||
| (tool-bar-mode -1) | ||||
| ;; Enable transient mark mode. | ||||
| (transient-mark-mode 1) | ||||
| 
 | ||||
| ;; Highlight paired parentheses when cursor is over one. | ||||
| (show-paren-mode 1) | ||||
| 
 | ||||
| (setq-default display-line-numbers-type 'absolute | ||||
|               display-line-numbers-current-absolute t | ||||
|               display-line-numbers-width 4 | ||||
|               display-line-numbers-widen t) | ||||
| 
 | ||||
| (add-hook 'text-mode-hook #'display-line-numbers-mode) | ||||
| (add-hook 'prog-mode-hook #'display-line-numbers-mode) | ||||
| 
 | ||||
| (setq column-number-mode t) | ||||
| (setq ido-use-filename-at-point nil) | ||||
| 
 | ||||
| (provide 'jenga-ui) | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue