Fix use-package usage

This commit is contained in:
Wojciech Kozlowski 2018-07-08 00:29:39 +01:00
parent 1d0859bae5
commit 34b423b3ac
11 changed files with 117 additions and 131 deletions

View File

@ -39,7 +39,6 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package duplicate-thing (use-package duplicate-thing
:defer t
:bind (("M-C" . duplicate-thing))) :bind (("M-C" . duplicate-thing)))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
@ -47,7 +46,6 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package expand-region (use-package expand-region
:defer t
:bind (("C-'" . er/expand-region))) :bind (("C-'" . er/expand-region)))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
@ -55,7 +53,6 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package fill-column-indicator (use-package fill-column-indicator
:defer t
:bind :bind
(("C-x t f" . fci-mode)) (("C-x t f" . fci-mode))
:init :init
@ -74,7 +71,7 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package undo-tree (use-package undo-tree
:init :config
(global-undo-tree-mode)) (global-undo-tree-mode))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
@ -82,7 +79,7 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package volatile-highlights (use-package volatile-highlights
:init :config
(volatile-highlights-mode t)) (volatile-highlights-mode t))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
@ -90,7 +87,7 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package whole-line-or-region (use-package whole-line-or-region
:init :config
(whole-line-or-region-global-mode t)) (whole-line-or-region-global-mode t))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
@ -98,7 +95,7 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package ws-butler (use-package ws-butler
:init :config
(ws-butler-global-mode)) (ws-butler-global-mode))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
@ -159,10 +156,9 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package flyspell (use-package flyspell
:init :hook
(add-hook 'text-mode-hook 'flyspell-mode) (((text-mode org-mode) . flyspell-mode)
(add-hook 'org-mode-hook 'flyspell-mode) (prog-mode . flyspell-prog-mode))
(add-hook 'prog-mode-hook 'flyspell-prog-mode)
:config :config
(if (executable-find "aspell") (if (executable-find "aspell")
(progn (progn

View File

@ -67,6 +67,7 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package ibuffer-vc (use-package ibuffer-vc
:defer t
:init :init
(add-hook 'ibuffer-hook (add-hook 'ibuffer-hook
(lambda () (lambda ()
@ -231,7 +232,15 @@
;; This rule is an exception to the above so that local sudo does not proxy ;; This rule is an exception to the above so that local sudo does not proxy
;; via ssh. This has to be added last so that it is the first element of ;; via ssh. This has to be added last so that it is the first element of
;; the list. ;; the list.
(add-to-list 'tramp-default-proxies-alist '("localhost" "\\`root\\'" nil))) (add-to-list 'tramp-default-proxies-alist '("localhost" "\\`root\\'" nil))
(defun sudo ()
"Use TRAMP to `sudo' the current buffer"
(interactive)
(when buffer-file-name
(find-alternate-file
(concat "/sudo:root@localhost:"
buffer-file-name)))))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
;; Configure garbage collection. ;; Configure garbage collection.

View File

@ -92,18 +92,20 @@
) )
;; Automatically refresh dired buffer on changes. ;; Automatically refresh dired buffer on changes.
(add-hook 'dired-mode-hook 'auto-revert-mode) (add-hook 'dired-mode-hook 'auto-revert-mode))
(use-package dired-x (use-package dired-x
:after dired
:init :init
(add-hook 'dired-mode-hook 'dired-omit-mode) (add-hook 'dired-mode-hook 'dired-omit-mode)
:config :config
(setq-default dired-omit-files "^\\.\\|^\\#")) (setq-default dired-omit-files "^\\.\\|^\\#"))
(use-package wdired (use-package wdired
:after dired
:config :config
(setq-default wdired-allow-to-change-permissions t (setq-default wdired-allow-to-change-permissions t
wdired-allow-to-redirect-links t))) wdired-allow-to-redirect-links t))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
;; Recentf. ;; Recentf.

View File

@ -41,30 +41,24 @@
"Initialise the `em-helm-gtags' module." "Initialise the `em-helm-gtags' module."
(use-package helm-gtags (use-package helm-gtags
:defer t :hook
((dired-mode eshell-mode c-mode c++-mode asm-mode-hook) . helm-gtags-mode)
:bind
(:map helm-gtags-mode-map
("C-c g a" . helm-gtags-tags-in-this-function)
("C-c g h" . helm-gtags-show-stack)
("C-j" . helm-gtags-select)
("M-." . helm-gtags-dwim)
("M-," . helm-gtags-pop-stack)
("C-c <" . helm-gtags-previous-history)
("C-c >" . helm-gtags-next-history))
:init :init
(add-hook 'dired-mode-hook 'helm-gtags-mode) (setq helm-gtags-ignore-case t
(add-hook 'eshell-mode-hook 'helm-gtags-mode)
(add-hook 'c-mode-hook 'helm-gtags-mode)
(add-hook 'c++-mode-hook 'helm-gtags-mode)
(add-hook 'asm-mode-hook 'helm-gtags-mode)
(setq
helm-gtags-ignore-case t
helm-gtags-auto-update t helm-gtags-auto-update t
helm-gtags-use-input-at-cursor t helm-gtags-use-input-at-cursor t
helm-gtags-pulse-at-cursor t helm-gtags-pulse-at-cursor t
helm-gtags-prefix-key "\C-cg" helm-gtags-prefix-key "\C-cg"
helm-gtags-suggested-key-mapping t helm-gtags-suggested-key-mapping t))
)
:config
(define-key helm-gtags-mode-map (kbd "C-c g a") 'helm-gtags-tags-in-this-function)
(define-key helm-gtags-mode-map (kbd "C-c g h") 'helm-gtags-show-stack)
(define-key helm-gtags-mode-map (kbd "C-j") 'helm-gtags-select)
(define-key helm-gtags-mode-map (kbd "M-.") 'helm-gtags-dwim)
(define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack)
(define-key helm-gtags-mode-map (kbd "C-c <") 'helm-gtags-previous-history)
(define-key helm-gtags-mode-map (kbd "C-c >") 'helm-gtags-next-history))
) )
(provide 'em-helm-gtags) (provide 'em-helm-gtags)

View File

@ -32,8 +32,6 @@
"Initialise the `em-helm' module." "Initialise the `em-helm' module."
(use-package helm (use-package helm
:init
(helm-mode 1)
:bind :bind
(("C-x C-f" . helm-find-files) (("C-x C-f" . helm-find-files)
("M-x" . helm-M-x) ("M-x" . helm-M-x)
@ -108,14 +106,14 @@
;; Change some Helm default key-bindings. Due to the `helm-config' require ;; Change some Helm default key-bindings. Due to the `helm-config' require
;; these have to overridden here rather than with other keys in `:bind'. ;; these have to overridden here rather than with other keys in `:bind'.
(global-set-key (kbd "C-c h x") 'helm-register) (global-set-key (kbd "C-c h x") 'helm-register)
(global-set-key (kbd "C-c h M-o") 'helm-occur) (global-set-key (kbd "C-c h M-o") 'helm-occur))
;; ------------------------------------------------------------------------ ;; ------------------------------------------------------------------------
;; Activate helm-descbinds. ;; Activate helm-descbinds.
;; ------------------------------------------------------------------------ ;; ------------------------------------------------------------------------
(use-package helm-descbinds (use-package helm-descbinds
:init :config
(helm-descbinds-mode)) (helm-descbinds-mode))
;; ------------------------------------------------------------------------ ;; ------------------------------------------------------------------------
@ -123,16 +121,18 @@
;; ------------------------------------------------------------------------ ;; ------------------------------------------------------------------------
(use-package helm-projectile (use-package helm-projectile
:init
(projectile-mode)
:config :config
(projectile-mode)
(setq-default projectile-completion-system 'helm) (setq-default projectile-completion-system 'helm)
(helm-projectile-on)) (helm-projectile-on))
;; ------------------------------------------------------------------------
;; Configure swiper.
;; ------------------------------------------------------------------------
(use-package swiper-helm (use-package swiper-helm
:defer t
:bind :bind
(("C-c h C-s" . swiper-helm)))) (("C-c h C-s" . swiper-helm)))
) )

View File

@ -32,11 +32,10 @@
;; user to manually install the fonts with the command `M-x ;; user to manually install the fonts with the command `M-x
;; all-the-icons-install-fonts'. ;; all-the-icons-install-fonts'.
(use-package doom-modeline (use-package doom-modeline
:defer t
:config
(setq-default doom-modeline-height 23)
:hook :hook
(after-init . doom-modeline-init)) (after-init . doom-modeline-init)
:config
(setq-default doom-modeline-height 23))
) )

View File

@ -32,7 +32,7 @@
(use-package org (use-package org
:config :config
;; ------------------------------------------------------------------------ ;; ------------------------------------------------------------------------
;; Hide special characters for itlaics/bold/underline. ;; Hide special characters for italics/bold/underline.
;; ------------------------------------------------------------------------ ;; ------------------------------------------------------------------------
(setq org-hide-emphasis-markers t) (setq org-hide-emphasis-markers t)
@ -48,6 +48,12 @@
(match-end 1) (match-end 1)
"")))))) ""))))))
;; ------------------------------------------------------------------------
;; LaTeX font size.
;; ------------------------------------------------------------------------
(plist-put org-format-latex-options :scale 2.0))
;; ------------------------------------------------------------------------ ;; ------------------------------------------------------------------------
;; Better header bullets ;; Better header bullets
;; ------------------------------------------------------------------------ ;; ------------------------------------------------------------------------
@ -57,14 +63,6 @@
:init :init
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))) (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
;; ------------------------------------------------------------------------
;; LaTeX font size.
;; ------------------------------------------------------------------------
(plist-put org-format-latex-options :scale 2.0)
)
) )
(provide 'em-org) (provide 'em-org)

View File

@ -38,28 +38,26 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package highlight-parentheses (use-package highlight-parentheses
:defer t :hook
:init (prog-mode . highlight-parentheses-mode))
(add-hook 'prog-mode-hook 'highlight-parentheses-mode))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
;; Rainbow delimiters - colours are set by theme. ;; Rainbow delimiters - colours are set by theme.
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package rainbow-delimiters (use-package rainbow-delimiters
:defer t :hook
:init (prog-mode . rainbow-delimiters-mode))
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
;; Smartparens highlighting. ;; Smartparens highlighting.
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package smartparens (use-package smartparens
:init :config
(smartparens-global-mode t) (smartparens-global-mode t)
(show-smartparens-global-mode t) (show-smartparens-global-mode t)
:config
(require 'smartparens-config) (require 'smartparens-config)
(declare-function sp-local-pair "smartparens") (declare-function sp-local-pair "smartparens")
(declare-function sp-beginning-of-sexp "smartparens") (declare-function sp-beginning-of-sexp "smartparens")

View File

@ -56,8 +56,8 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package company (use-package company
:init :hook
(add-hook 'after-init-hook 'global-company-mode) (after-init . global-company-mode)
:config :config
;; For this to correctly complete headers, need to add all include paths to ;; For this to correctly complete headers, need to add all include paths to
;; `company-c-headers-path-system'. ;; `company-c-headers-path-system'.
@ -67,10 +67,10 @@
;; Functions args ----------------------------------------------------------- ;; Functions args -----------------------------------------------------------
(use-package function-args (use-package function-args
:init :config
(use-package ivy) (use-package ivy)
(fa-config-default) (fa-config-default)
:config
(defun set-other-window-key () (defun set-other-window-key ()
;; function-args overrides the custom "M-o" binding, this undoes it ;; function-args overrides the custom "M-o" binding, this undoes it
(define-key function-args-mode-map (kbd "M-o") nil) (define-key function-args-mode-map (kbd "M-o") nil)
@ -119,43 +119,39 @@
;; FIC mode. ;; FIC mode.
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package fic-mode (use-package fic-mode
:defer t :hook
:init (prog-mode . fic-mode))
(add-hook 'prog-mode-hook #'fic-mode))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
;; Flycheck mode. ;; Flycheck mode.
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package flycheck (use-package flycheck
:defer t :hook
:init (after-init . global-flycheck-mode))
(add-hook 'after-init-hook #'global-flycheck-mode)
(use-package flycheck-pos-tip
:hook
(flycheck-mode . flycheck-rust-setup)
:config :config
(use-package flycheck-pos-tip
:init
(flycheck-pos-tip-mode)) (flycheck-pos-tip-mode))
(use-package flycheck-pos-tip
:init
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
;; Highlights. ;; Highlights.
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package highlight-numbers (use-package highlight-numbers
:init :hook
(add-hook 'prog-mode-hook 'highlight-numbers-mode)) (prog-mode . highlight-numbers-mode))
(use-package highlight-symbol (use-package highlight-symbol
:init :hook
(highlight-symbol-nav-mode) ((prog-mode org-mode) . highlight-symbol-mode)
(add-hook 'prog-mode-hook (lambda () (highlight-symbol-mode)))
(add-hook 'org-mode-hook (lambda () (highlight-symbol-mode)))
:bind :bind
(("M-n" . highlight-symbol-next) (("M-n" . highlight-symbol-next)
("M-p" . highlight-symbol-prev)) ("M-p" . highlight-symbol-prev))
:config :config
(highlight-symbol-nav-mode)
(setq highlight-symbol-idle-delay 0.2 (setq highlight-symbol-idle-delay 0.2
highlight-symbol-on-navigation-p t)) highlight-symbol-on-navigation-p t))
@ -220,7 +216,6 @@
(setq-default company-tooltip-align-annotations t)) (setq-default company-tooltip-align-annotations t))
(use-package toml-mode (use-package toml-mode
:defer t
:mode "\\.lock\\'") :mode "\\.lock\\'")
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
@ -228,7 +223,6 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package swiper (use-package swiper
:defer t
:bind :bind
(("M-s M-s" . swiper))) (("M-s M-s" . swiper)))
@ -237,9 +231,8 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package plantuml-mode (use-package plantuml-mode
:defer t :mode "\\.pu\\'"
:init :init
(add-to-list 'auto-mode-alist '("\\.pu\\'" . plantuml-mode))
(setq-default plantuml-jar-path "~/.emacs.d/plantuml.jar") (setq-default plantuml-jar-path "~/.emacs.d/plantuml.jar")
:config :config
(require 'flycheck-plantuml)) (require 'flycheck-plantuml))
@ -259,7 +252,6 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package vhdl-mode (use-package vhdl-mode
:defer t
:mode "\\.hdl\\'") :mode "\\.hdl\\'")
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
@ -267,7 +259,6 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package yaml-mode (use-package yaml-mode
:defer t
:config :config
(add-hook 'yaml-mode-hook #'linum-mode)) (add-hook 'yaml-mode-hook #'linum-mode))
@ -276,7 +267,7 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package yasnippet (use-package yasnippet
:init :config
(yas-global-mode 1) (yas-global-mode 1)
(define-key yas-minor-mode-map [(tab)] nil) (define-key yas-minor-mode-map [(tab)] nil)
@ -295,17 +286,17 @@
;; `semantic-add-system-include'. This includes any local system includes, ;; `semantic-add-system-include'. This includes any local system includes,
;; such as those in `/usr/local/include'. ;; such as those in `/usr/local/include'.
(use-package semantic (use-package semantic
:init :config
(declare-function global-semanticdb-minor-mode "semantic/db-mode") (declare-function global-semanticdb-minor-mode "semantic/db-mode")
(declare-function global-semantic-idle-scheduler-mode "semantic/idle") (declare-function global-semantic-idle-scheduler-mode "semantic/idle")
(declare-function semantic-mode "semantic") (declare-function semantic-mode "semantic")
(global-semanticdb-minor-mode 1) (global-semanticdb-minor-mode 1)
(global-semantic-idle-scheduler-mode 1) (global-semantic-idle-scheduler-mode 1)
(semantic-mode 1) (semantic-mode 1)
:config
(use-package stickyfunc-enhance) (use-package stickyfunc-enhance)
(add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode) (add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode))
)
;; For this to work, need to specify project roots in the variable ;; For this to work, need to specify project roots in the variable
;; `ede-cpp-root-project', e.g. ;; `ede-cpp-root-project', e.g.
@ -317,7 +308,7 @@
;; :system-include-path '("~/linux")) ;; :system-include-path '("~/linux"))
;; May need to run `semantic-force-refresh' afterwards. ;; May need to run `semantic-force-refresh' afterwards.
(use-package ede (use-package ede
:init :config
(global-ede-mode)) (global-ede-mode))
(add-hook 'c-mode-common-hook 'hs-minor-mode) (add-hook 'c-mode-common-hook 'hs-minor-mode)

View File

@ -35,7 +35,6 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package magit (use-package magit
:defer t
:bind :bind
("C-x g l" . magit-log-head) ("C-x g l" . magit-log-head)
("C-x g f" . magit-log-buffer-file) ("C-x g f" . magit-log-buffer-file)
@ -68,10 +67,11 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package diff-hl (use-package diff-hl
:init :hook
(global-diff-hl-mode) ((dired-mode . diff-hl-dired-mode)
(add-hook 'dired-mode-hook 'diff-hl-dired-mode) (magit-post-refresh . diff-hl-magit-post-refresh))
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)) :config
(global-diff-hl-mode))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
;; Diff mode settings. ;; Diff mode settings.

View File

@ -34,7 +34,6 @@
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package workgroups2 (use-package workgroups2
:defer t
:bind :bind
(("C-c z z" . (lambda () (interactive) (workgroups-mode))))) (("C-c z z" . (lambda () (interactive) (workgroups-mode)))))