diff --git a/init.el b/init.el index ec831f1..f4af639 100644 --- a/init.el +++ b/init.el @@ -1,5 +1,5 @@ ;;; init.el --- tastytea's Emacs init file. -;;; Time-stamp: <2019-03-22 09:52:44 CET> +;;; Time-stamp: <2019-03-22 23:23:38 CET> ;;; Commentary: ;;; I am using this file with Emacs 26, but most of it will probably work with @@ -148,25 +148,25 @@ ("M-" . scroll-down-line))) ;;;;;;;;;;;;;;;;;;;; Programming / C++ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(use-package rtags - :unless slow-computer - :if (executable-find "llvm-config") - :if (executable-find "clang++") - :config - (unless (and (rtags-executable-find "rc") (rtags-executable-find "rdm")) - (progn - (message "RTags is not installed!") - (rtags-install))) - (rtags-enable-standard-keybindings) - :bind - (:map c-mode-base-map - ("M-." . rtags-find-symbol-at-point) - ("M-," . rtags-find-references-at-point) - ("M-?" . rtags-display-summary)) - :hook - (c++-mode . (rtags-start-process-unless-running)) - (c-mode . (rtags-start-process-unless-running)) - (kill-emacs . rtags-quit-rdm)) +(unless slow-computer + (use-package rtags + :if (executable-find "llvm-config") + :if (executable-find "clang++") + :config + (unless (and (rtags-executable-find "rc") (rtags-executable-find "rdm")) + (progn + (message "RTags is not installed!") + (rtags-install))) + (rtags-enable-standard-keybindings) + :bind + (:map c-mode-base-map + ("M-." . rtags-find-symbol-at-point) + ("M-," . rtags-find-references-at-point) + ("M-?" . rtags-display-summary)) + :hook + (c++-mode . (rtags-start-process-unless-running)) + (c-mode . (rtags-start-process-unless-running)) + (kill-emacs . rtags-quit-rdm))) (use-package flycheck-rtags :after (flycheck rtags) @@ -191,12 +191,12 @@ (push 'company-rtags company-backends)) ;; cmake integration. -(use-package cmake-ide - :unless slow-computer - :custom - (cmake-ide-build-dir "build") - :config - (cmake-ide-setup)) +(unless slow-computer + (use-package cmake-ide + :custom + (cmake-ide-build-dir "build") + :config + (cmake-ide-setup))) ;;;;;;;;;;;;;;;;;;;; Programming / other ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Online documentation mode. @@ -205,16 +205,16 @@ (prog-mode . turn-on-eldoc-mode)) ;; Syntax checking with many plugins. -(use-package flycheck - :unless slow-computer - :config - (global-flycheck-mode)) +(unless slow-computer + (use-package flycheck + :config + (global-flycheck-mode))) ;; Autocompletion mode with many plugins. -(use-package company - :unless slow-computer - :hook - (after-init . global-company-mode)) +(unless slow-computer + (use-package company + :hook + (after-init . global-company-mode))) ;; Fuzzy autocompletion for company. (use-package company-flx @@ -229,27 +229,27 @@ c-basic-offset 4) ;; Automatic project management. -(use-package projectile - :unless slow-computer - :after neotree - :config - (projectile-mode +1) - (setq projectile-switch-project-action 'neotree-projectile-action - projectile-project-compilation-dir "build" - projectile-project-configure-cmd - "cmake -DCMAKE_BUILD_TYPE=Debug +(unless slow-computer + (use-package projectile + :after neotree + :config + (projectile-mode +1) + (setq projectile-switch-project-action 'neotree-projectile-action + projectile-project-compilation-dir "build" + projectile-project-configure-cmd + "cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G 'Unix Makefiles' .." - projectile-project-compilation-cmd "cmake --build .") + projectile-project-compilation-cmd "cmake --build .") - (defun my/projectile-kill-buffers-and-change-tabbar-grouping () - "Kill project buffers and change tabbar-ruler grouping to user-buffers." - (interactive) - (projectile-kill-buffers) - (tabbar-ruler-group-user-buffers)) - :bind - ("C-c p" . 'projectile-command-map) - (:map projectile-command-map - ("k" . 'my/projectile-kill-buffers-and-change-tabbar-grouping))) + (defun my/projectile-kill-buffers-and-change-tabbar-grouping () + "Kill project buffers and change tabbar-ruler grouping to user-buffers." + (interactive) + (projectile-kill-buffers) + (tabbar-ruler-group-user-buffers)) + :bind + ("C-c p" . 'projectile-command-map) + (:map projectile-command-map + ("k" . 'my/projectile-kill-buffers-and-change-tabbar-grouping)))) ;; GUI for gdb and other debuggers. (use-package realgud @@ -309,14 +309,14 @@ (all-the-icons-install-fonts t))) ;; Themes for doom-modeline. -(use-package doom-themes - :unless slow-computer - :after (all-the-icons neotree) - :custom - (doom-neotree-file-icons 'icons) - :config - (load-theme 'doom-molokai t) - (doom-themes-neotree-config)) +(unless slow-computer + (use-package doom-themes + :after (all-the-icons neotree) + :custom + (doom-neotree-file-icons 'icons) + :config + (load-theme 'doom-molokai t) + (doom-themes-neotree-config))) ;; Neat modeline. (use-package doom-modeline @@ -359,25 +359,25 @@ ("" . neotree-toggle)) ;; Git integration. -(use-package magit - :unless slow-computer - :init - (use-package git-commit) - :config - (defun my/magit-kill-buffers (arg) - "Restore window configuration and kill all Magit buffers." - (interactive) - (let ((buffers (magit-mode-get-buffers))) - (magit-restore-window-configuration) - (mapc #'kill-buffer buffers))) - :bind - ("C-x g" . magit-status) - ("C-x M-g" . magit-dispatch) - ;; (:map magit-status-mode-map - ;; ("q" . my-magit-kill-buffers)) - :custom - ;; What's better, mapping q or binding the function here? - (magit-bury-buffer-function 'my/magit-kill-buffers)) +(unless slow-computer + (use-package magit + :init + (use-package git-commit) + :config + (defun my/magit-kill-buffers (arg) + "Restore window configuration and kill all Magit buffers." + (interactive) + (let ((buffers (magit-mode-get-buffers))) + (magit-restore-window-configuration) + (mapc #'kill-buffer buffers))) + :bind + ("C-x g" . magit-status) + ("C-x M-g" . magit-dispatch) + ;; (:map magit-status-mode-map + ;; ("q" . my-magit-kill-buffers)) + :custom + ;; What's better, mapping q or binding the function here? + (magit-bury-buffer-function 'my/magit-kill-buffers))) ;; Draw line in column 80 (use-package fill-column-indicator @@ -419,53 +419,53 @@ (flx-ido-mode t)) ;; Replaces stock emacs completion with ido completion wherever it is possible. -(use-package ido-completing-read+ - :unless slow-computer - :after ido - :config - (ido-ubiquitous-mode t)) +(unless slow-computer + (use-package ido-completing-read+ + :after ido + :config + (ido-ubiquitous-mode t))) ;; Advanced tab bar. -(use-package tabbar-ruler - :unless slow-computer - :after projectile - :init - (setq tabbar-ruler-global-tabbar t) - :config - ;; (tabbar-ruler-group-by-projectile-project) ; Group by projectile. - ;; (tabbar-ruler-group-buffer-groups) ; Group by file type. - (tabbar-ruler-group-user-buffers) ; Group by frame. - ;; (mode-icons-mode 0) ; Disable modeline symbols. +(unless slow-computer + (use-package tabbar-ruler + :after projectile + :init + (setq tabbar-ruler-global-tabbar t) + :config + ;; (tabbar-ruler-group-by-projectile-project) ; Group by projectile. + ;; (tabbar-ruler-group-buffer-groups) ; Group by file type. + (tabbar-ruler-group-user-buffers) ; Group by frame. + ;; (mode-icons-mode 0) ; Disable modeline symbols. - ;; I have to define these 2 times, don't know why. - (set-face-attribute 'tabbar-selected nil + ;; I have to define these 2 times, don't know why. + (set-face-attribute 'tabbar-selected nil + :background "gray11" + :foreground "light gray" + :family "Sans Serif" + :bold t) + (set-face-attribute 'tabbar-unselected nil + :background "gray18" + :foreground "dark gray" + :family "Sans Serif" + :italic t) + + (add-hook 'projectile-after-switch-project-hook ; Does not work under :hook. + 'tabbar-ruler-group-by-projectile-project) + :bind + ("C-" . 'tabbar-ruler-tabbar-backward-tab) + ("C-" . 'tabbar-ruler-tabbar-forward-tab) + :custom-face + ;; I Have to define these 2 times, don't know why. + (tabbar-selected (nil :background "gray11" :foreground "light gray" :family "Sans Serif" - :bold t) - (set-face-attribute 'tabbar-unselected nil - :background "gray18" - :foreground "dark gray" - :family "Sans Serif" - :italic t) - - (add-hook 'projectile-after-switch-project-hook ; Does not work under :hook. - 'tabbar-ruler-group-by-projectile-project) - :bind - ("C-" . 'tabbar-ruler-tabbar-backward-tab) - ("C-" . 'tabbar-ruler-tabbar-forward-tab) - :custom-face - ;; I Have to define these 2 times, don't know why. - (tabbar-selected (nil - :background "gray11" - :foreground "light gray" - :family "Sans Serif" - :bold t)) - (tabbar-unselected (nil - :background "gray18" - :foreground "dark gray" - :family "Sans Serif" - :italic t))) + :bold t)) + (tabbar-unselected (nil + :background "gray18" + :foreground "dark gray" + :family "Sans Serif" + :italic t)))) ;; Visualize whitespace. (use-package whitespace @@ -488,24 +488,24 @@ (whitespace-space ((nil :foreground "gray18")))) ;; Spell checking. -(use-package flyspell - :unless slow-computer - :custom - (ispell-dictionary "english") - :config - (defun my/toggle-flyspell () - "Toggle flyspell-mode and run flyspell-buffer after activating." - (interactive) - (if (bound-and-true-p flyspell-mode) - (flyspell-mode 0) - (flyspell-mode) - (flyspell-buffer))) - :bind - ("" . my/toggle-flyspell) - :hook - ;; Spellcheck comments. - (c++-mode . flyspell-prog-mode) - (c-mode . flyspell-prog-mode)) +(unless slow-computer + (use-package flyspell + :custom + (ispell-dictionary "english") + :config + (defun my/toggle-flyspell () + "Toggle flyspell-mode and run flyspell-buffer after activating." + (interactive) + (if (bound-and-true-p flyspell-mode) + (flyspell-mode 0) + (flyspell-mode) + (flyspell-buffer))) + :bind + ("" . my/toggle-flyspell) + :hook + ;; Spellcheck comments. + (c++-mode . flyspell-prog-mode) + (c-mode . flyspell-prog-mode))) ;; Multiple cursors. (use-package multiple-cursors @@ -622,25 +622,25 @@ ;;;;;;;;;;;;;;;;;;;; Server / Remote editing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Edit remote files. -(use-package tramp - :unless slow-computer - :defer 1 - :config - ;; ssh is faster than scp and supports ports. - (setq tramp-default-method "ssh") - ;; Add verification code support. - (customize-set-variable - 'tramp-password-prompt-regexp - (concat - "^.*" - (regexp-opt - '("passphrase" "Passphrase" - "password" "Password" - "Verification code") - t) - ".*:\0? *")) - ;; Respect remote PATH. - (add-to-list 'tramp-remote-path 'tramp-own-remote-path)) +(unless slow-computer + (use-package tramp + :defer 1 + :config + ;; ssh is faster than scp and supports ports. + (setq tramp-default-method "ssh") + ;; Add verification code support. + (customize-set-variable + 'tramp-password-prompt-regexp + (concat + "^.*" + (regexp-opt + '("passphrase" "Passphrase" + "password" "Password" + "Verification code") + t) + ".*:\0? *")) + ;; Respect remote PATH. + (add-to-list 'tramp-remote-path 'tramp-own-remote-path))) ;; Run server if: ;; - Our EUID is not 0,