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

View File

@ -67,6 +67,7 @@
;; --------------------------------------------------------------------------
(use-package ibuffer-vc
:defer t
:init
(add-hook 'ibuffer-hook
(lambda ()
@ -231,7 +232,15 @@
;; 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
;; 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.

View File

@ -92,18 +92,20 @@
)
;; 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
:init
(add-hook 'dired-mode-hook 'dired-omit-mode)
:config
(setq-default dired-omit-files "^\\.\\|^\\#"))
(use-package dired-x
:after dired
:init
(add-hook 'dired-mode-hook 'dired-omit-mode)
:config
(setq-default dired-omit-files "^\\.\\|^\\#"))
(use-package wdired
:config
(setq-default wdired-allow-to-change-permissions t
wdired-allow-to-redirect-links t)))
(use-package wdired
:after dired
:config
(setq-default wdired-allow-to-change-permissions t
wdired-allow-to-redirect-links t))
;; --------------------------------------------------------------------------
;; Recentf.

View File

@ -41,30 +41,24 @@
"Initialise the `em-helm-gtags' module."
(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
(add-hook 'dired-mode-hook 'helm-gtags-mode)
(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-use-input-at-cursor t
helm-gtags-pulse-at-cursor t
helm-gtags-prefix-key "\C-cg"
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))
(setq helm-gtags-ignore-case t
helm-gtags-auto-update t
helm-gtags-use-input-at-cursor t
helm-gtags-pulse-at-cursor t
helm-gtags-prefix-key "\C-cg"
helm-gtags-suggested-key-mapping t))
)
(provide 'em-helm-gtags)

View File

@ -32,8 +32,6 @@
"Initialise the `em-helm' module."
(use-package helm
:init
(helm-mode 1)
:bind
(("C-x C-f" . helm-find-files)
("M-x" . helm-M-x)
@ -108,31 +106,33 @@
;; Change some Helm default key-bindings. Due to the `helm-config' require
;; 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 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
:init
(helm-descbinds-mode))
(use-package helm-descbinds
:config
(helm-descbinds-mode))
;; ------------------------------------------------------------------------
;; Configure projectile.
;; ------------------------------------------------------------------------
;; ------------------------------------------------------------------------
;; Configure projectile.
;; ------------------------------------------------------------------------
(use-package helm-projectile
:init
(projectile-mode)
:config
(setq-default projectile-completion-system 'helm)
(helm-projectile-on))
(use-package helm-projectile
:config
(projectile-mode)
(setq-default projectile-completion-system 'helm)
(helm-projectile-on))
(use-package swiper-helm
:defer t
:bind
(("C-c h C-s" . swiper-helm))))
;; ------------------------------------------------------------------------
;; Configure swiper.
;; ------------------------------------------------------------------------
(use-package swiper-helm
:bind
(("C-c h C-s" . swiper-helm)))
)

View File

@ -32,11 +32,10 @@
;; user to manually install the fonts with the command `M-x
;; all-the-icons-install-fonts'.
(use-package doom-modeline
:defer t
:config
(setq-default doom-modeline-height 23)
: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
:config
;; ------------------------------------------------------------------------
;; Hide special characters for itlaics/bold/underline.
;; Hide special characters for italics/bold/underline.
;; ------------------------------------------------------------------------
(setq org-hide-emphasis-markers t)
@ -48,22 +48,20 @@
(match-end 1)
""))))))
;; ------------------------------------------------------------------------
;; Better header bullets
;; ------------------------------------------------------------------------
(use-package org-bullets
:defer t
:init
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
;; ------------------------------------------------------------------------
;; LaTeX font size.
;; ------------------------------------------------------------------------
(plist-put org-format-latex-options :scale 2.0)
(plist-put org-format-latex-options :scale 2.0))
)
;; ------------------------------------------------------------------------
;; Better header bullets
;; ------------------------------------------------------------------------
(use-package org-bullets
:defer t
:init
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
)

View File

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

View File

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

View File

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

View File

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