[emacs] Switch to use-package everywhere.

This commit is contained in:
Mikaël Capelle 2019-12-27 16:45:28 +01:00
parent 2e133f8e04
commit f193b6f096
2 changed files with 130 additions and 46 deletions

View File

@ -1,4 +1,6 @@
;;; init.el --- Init file for emacs
;;; init.el --- -*- lexical-binding: t -*-
;;; Init file for emacs
;;; Commentary:
@ -11,25 +13,57 @@
;; Themes
(setq custom-theme-directory "~/.emacs.d/themes/")
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
;; Packages
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/"))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(setq package-enable-at-startup nil)
(package-initialize) ;; You might already have this line
(setq package-user-dir (expand-file-name "elpa" user-emacs-directory)
'(("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "http://melpa.org/packages/")
("cselpa" . "http://elpa.thecybershadow.net/packages/")))
(load-theme 'material t)
(unless (bound-and-true-p package--initialized)
(setq package-enable-at-startup nil) ; To prevent initializing twice
;; set use-package-verbose to t for interpreted .emacs,
;; and to nil for byte-compiled .emacs.elc.
(setq use-package-verbose (not (bound-and-true-p byte-compile-current-file))))
;; Install use-package if not installed
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(setq use-package-always-ensure t)
(setq use-package-expand-minimally t)
(setq use-package-compute-statistics t)
(setq use-package-enable-imenu-support t))
(require 'use-package)
(require 'bind-key))
(use-package auto-package-update
:if (not (daemonp))
(auto-package-update-interval 7) ;; in days
(auto-package-update-prompt-before-update t)
(auto-package-update-delete-old-versions t)
(auto-package-update-hide-results t)
(use-package diminish)
(require 'iso-transl)
(require 'use-package)
(setq use-package-verbose t)
;; No menu, scrollbar, display line and column
;; No menu, scrollbar, displayline and column
(menu-bar-mode -1)
(tool-bar-mode -1)
(when (display-graphic-p)
@ -53,9 +87,34 @@
;; M-> (end-of-buffer) : Déplacement à la fin du buffer.
;; M-< (beginning-of-buffer) : Déplacement au début du buffer.
(use-package material-theme
(load-theme 'material t))
;; No split screen at startup
(setq inhibit-startup-screen t)
;; Or if you use use-package
(setq dashboard-items '((recents . 5)
;; (bookmarks . 5)
(projects . 5)
(agenda . 5)
(registers . 5)))
(setq dashboard-set-heading-icons t)
(setq dashboard-set-file-icons t)
(setq dashboard-set-navigator t)
(use-package dashboard
:ensure t
(add-hook 'dashboard-mode-hook (lambda () (display-line-numbers-mode -1)))
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
(use-package doom-modeline
:ensure t
:hook (after-init . doom-modeline-mode))
(use-package ace-window
:bind ("C-x C-o" . ace-window))
;; Encoding
(set-language-environment "UTF-8")
@ -78,32 +137,31 @@
;; Retrieve PATH from fish shell
(when (memq window-system '(mac ns x))
(setq exec-path-from-shell-shell-name "/usr/bin/fish")
(setq exec-path-from-shell-shell-name "/usr/local/bin/fish")
;; Auto complete + Yasnippet
(use-package sr-speedbar
(use-package projectile
(setq speedbar-show-unknown-files t)
(setq speedbar-use-images t))
(projectile-mode 1)
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(setq projectile-enable-caching t))
(use-package semantic/sb
;; (semantic-mode)
(global-set-key (kbd "C-c C-k C-l") 'sr-speedbar-toggle))
(use-package helm-config
(use-package helm
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x r b") 'helm-filtered-bookmarks)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "C-x C-b") 'helm-buffers-list)
(helm-mode 1)
(setq projectile-completion-system 'helm)
(add-to-list 'helm-boring-buffer-regexp-list "\\*.*")
(add-to-list 'helm-boring-buffer-regexp-list "\\*.*"))
(use-package helm-projectile
:after (helm projectile)
(setq projectile-completion-system 'helm)
(use-package yasnippet
@ -111,30 +169,43 @@
(use-package flycheck
(require 'flycheck-color-mode-line)
(add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode)
(add-hook 'flycheck-mode-hook 'flycheck-pos-tip-mode)
(add-hook 'flycheck-after-syntax-check-hook 'flycheck-autolist-hook)
(setq flycheck-emacs-lisp-load-path "inherit")
(setq flycheck-emacs-lisp-load-path "inherict")
(setq flycheck-clang-args '("-stdlib=libc++" "-W" "-Wall"))
(add-hook 'c++-mode-hook
(lambda ()
(setq-local flycheck-clang-language-standard "c++14"))))
(use-package flycheck-pos-tip
:after (flycheck)
(add-hook 'flycheck-mode-hook 'flycheck-pos-tip-mode))
(use-package flycheck-color-mode-line
:after (flycheck)
(add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode))
(use-package company
(require 'company-auctex)
(setq company-backends (append company-backends '(company-c-headers
(add-hook 'LaTeX-mode-hook 'company-auctex-init)
(add-hook 'after-init-hook 'global-company-mode)
(global-set-key (kbd "M-/") 'company-complete)
(add-hook 'c++-mode-hook
(lambda ()
(setq-local company-clang-arguments '("-std=c++14")))))
(global-set-key (kbd "M-/") 'company-complete))
(use-package company-c-headers
(add-to-list 'company-backends 'company-c-headers))
(use-package company-jedi
(add-to-list 'company-backends 'company-jedi))
(use-package company-web
(add-to-list 'company-backends 'company-web-html))
; C++
(use-package modern-cpp-font-lock
:ensure t)
(add-hook 'c++-mode-hook #'modern-c++-font-lock-mode)
;; Doc mode
(require 'doc-mode)
@ -142,7 +213,8 @@
(add-hook 'c++-mode-common-hook 'doc-mode)
;; Latex
(use-package tex-mik
(use-package auctex
:defer t
(setq TeX-auto-save t)
(setq TeX-parse-self t)
@ -201,6 +273,18 @@
(require 'tex)
(TeX-global-PDF-mode t)
(use-package company-auctex
:after (auctex company)
:config (company-auctex-init))
;; (add-to-list 'ispell-local-dictionary-alist '("francais-hunspell"
;; "[[:alpha:]]"
;; "[^[:alpha]]"
;; "[']"
;; t
;; ("-d" "fr_FR")
;; nil
;; iso-8859-1))
;; magit
(use-package magit
@ -243,8 +327,6 @@
(setq c-default-style "k&r")
(setq c-basic-offset 4)
(use-package c++1x-minor-mode)
(defun ac-cc-mode-setup ()
"Initialization hook for CC-mode runs before any other hooks."
@ -314,11 +396,10 @@
(add-hook 'LaTeX-mode-hook 'key-latex-mode-setup)
;; python
(use-package flycheck-mypy)
(use-package elpy
:ensure t
(when (load "flycheck" t t)
(require 'flycheck-mypy)
(flycheck-add-next-checker 'python-flake8 'python-mypy)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode))

.gitignore vendored
View File

@ -4,10 +4,13 @@
# Mac file