From eee6d1262257bab149a43a06e43ce2abd059d4ce Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 30 Mar 2016 11:00:47 +0200 Subject: Emacs: Fix first startup errors --- tag-emacs/emacs.d/init.org | 82 ++++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6716c57..c617d40 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -318,9 +318,10 @@ based upon some folder conventions I use. ("s-x s-f" . projectile-find-file) ("C-x g" . projectile-vc) ("s-G" . projectile-vc)) - :init (projectile-global-mode) + :demand t :diminish projectile-mode :config (progn + (projectile-global-mode) (add-to-list 'projectile-globally-ignored-directories ".stversions") (defun ap/subfolder-projects (dir) (--map (file-relative-name it dir) @@ -371,12 +372,13 @@ it needs hooking into projectile and a key bound to switch between projects. #+BEGIN_SRC emacs-lisp (use-package perspective :bind* ("s-p" . persp-switch) - :init (progn - (setq persp-show-modestring t) - (persp-mode))) + :demand t + :config (progn + (setq persp-show-modestring t) + (persp-mode))) (use-package persp-projectile - :ensure nil) + :ensure t) #+END_SRC ** vc @@ -404,7 +406,10 @@ changed. This package colours the fringe (global-diff-hl-mode 1) (add-hook 'dired-mode-hook (lambda () (diff-hl-dired-mode 1))) - (add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh))) + (add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh) + (add-hook 'magit-refresh-buffer-hook (lambda () + (message "test: %s" (buffer-file-name)) + (buffer-file-name))))) #+END_SRC ** magit @@ -700,6 +705,9 @@ with spaces. Perfect! (use-package smart-tabs-mode :defer 1 :config (progn + (smart-tabs-insinuate 'c 'cperl 'javascript 'python) + (add-hook 'php-mode-hook (lambda () + (smart-tabs-mode indent-tabs-mode))) (with-eval-after-load "align.el" (smart-tabs-mode/no-tabs-mode-advice align) (smart-tabs-mode/no-tabs-mode-advice align-regexp)) @@ -720,11 +728,7 @@ with spaces. Perfect! indent-relative-maybe)) (setq indent-tabs-mode nil)) ad-do-it) - ad-do-it)))) - :init (progn - (smart-tabs-insinuate 'c 'cperl 'javascript 'python) - (add-hook 'php-mode-hook (lambda () - (smart-tabs-mode indent-tabs-mode))))) + ad-do-it))))) #+END_SRC ** dtrt-indent-mode @@ -734,8 +738,8 @@ guesses the correct settings for me. #+BEGIN_SRC emacs-lisp (use-package dtrt-indent - :init (dtrt-indent-mode 1) :config (progn + (dtrt-indent-mode 1) (defadvice dtrt-indent-try-set-offset (after toggle-smart-tabs activate) (smart-tabs-mode (or indent-tabs-mode -1))))) #+END_SRC @@ -1201,7 +1205,9 @@ replace helm and ido. ("C-x i" . ivy-imenu-goto) ("C-=" . swiper)) :diminish ivy-mode + :demand t :config (progn + (ivy-mode 1) (setq ivy-use-virtual-buffers t ivy-re-builders-alist '((internal-complete-buffer . ivy--regex-fuzzy) (t . ivy--regex-plus))) @@ -1231,22 +1237,20 @@ replace helm and ido. (kill-buffer x) (ivy--reset-state ivy-last)) "kill"))) - (add-to-list 'ivy-initial-inputs-alist '(counsel-M-x . ""))) - :init (progn - (ivy-mode 1))) + (add-to-list 'ivy-initial-inputs-alist '(counsel-M-x . "")))) #+END_SRC ** counsel #+BEGIN_SRC emacs-lisp (use-package counsel - :bind (("M-x" . counsel-M-x) - ("" . counsel-M-x) - ("" . counsel-M-x) - ("C-c M-x" . execute-extended-command) - ("C-x C-f" . counsel-find-file) - ("C-x b" . counsel-switch-to-persp-buffer)) :config (progn + (bind-key "M-x" #'counsel-M-x) + (bind-key "" #'counsel-M-x) + (bind-key "" #'counsel-M-x) + (bind-key "C-c M-x" #'execute-extended-command) + (bind-key "C-x C-f" #'counsel-find-file) + (bind-key "C-x b" #'counsel-switch-to-persp-buffer) (defadvice counsel-find-file (after find-file-sudo activate) "Find file as root if necessary." (when (and buffer-file-name @@ -1649,11 +1653,11 @@ Lisp syntax allows for really easy refactoring. Redshank gives some operations that aren’t part of paredit, like extracting variables into let bindings. #+BEGIN_SRC emacs-lisp -(use-package redshank - :diminish " Λ" - :defer t - :init (progn - (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) + (use-package redshank + :diminish " Λ" + :after (paredit) + :config (progn + (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) #+END_SRC *** Emacs Lisp @@ -2161,13 +2165,12 @@ type them. (use-package typo :config (progn (typo-global-mode 1) - (typo-change-language "English")) - :init (progn - (add-hook 'text-mode-hook #'typo-mode) - (defun typo-mode-turn-off () - (typo-mode -1)) - (add-hook 'yaml-mode-hook #'turn-off-typo-mode) - (add-hook 'jinja2-mode-hook #'turn-off-typo-mode))) + (typo-change-language "English") + (add-hook 'text-mode-hook #'typo-mode) + (defun typo-mode-turn-off () + (typo-mode -1)) + (add-hook 'yaml-mode-hook #'turn-off-typo-mode) + (add-hook 'jinja2-mode-hook #'turn-off-typo-mode))) #+END_SRC ** avy @@ -2222,12 +2225,11 @@ movement commands are much more interesting. #+BEGIN_SRC emacs-lisp (use-package paredit :diminish "()" - :commands (paredit-mode) - :init (progn - (add-hook 'lisp-mode-common-hook #'enable-paredit-mode) - (put #'paredit-forward-delete 'delete-selection 'supersede) - (put #'paredit-backward-delete 'delete-selection 'supersede) - (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode))) + :config (progn + (add-hook 'lisp-mode-common-hook #'enable-paredit-mode) + (put #'paredit-forward-delete 'delete-selection 'supersede) + (put #'paredit-backward-delete 'delete-selection 'supersede) + (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode))) #+END_SRC ** smartparens @@ -2237,7 +2239,7 @@ I didn’t find smartparens’ implementation of paredit style to be as nice as the real version #+BEGIN_SRC emacs-lisp - (eval-when-compile (require 'smartparens)) + (eval-when-compile (require 'smartparens nil :noerror)) (use-package smartparens-config :ensure smartparens :config (progn -- cgit 1.4.1