diff --git a/emacs.org b/emacs.org index bd02ac9..919dc9f 100644 --- a/emacs.org +++ b/emacs.org @@ -19,16 +19,16 @@ Startup related tasks/setup that might be used later on. Setup the builtin emacs package manager. #+BEGIN_SRC emacs-lisp :tangle tmp/.emacs.d/init.el :mkdirp yes - (require 'package) - (package-initialize) +(require 'package) +(package-initialize) #+END_SRC Add in the standard package archive urls. #+BEGIN_SRC emacs-lisp - (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t) - (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) - (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t) +(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t) +(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) +(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t) #+END_SRC *** tangle functions @@ -39,21 +39,21 @@ TODO: make this stuff work sanely in emacs org mode and via external tangling. Not tangled for now. #+BEGIN_SRC emacs-lisp - (defun tangle/yn (p) (if (bound-and-true-p p) "yes" "no")) - (defun tangle/file (file p) (if (bound-and-true-p p) (concat "tmp/" file) "no")) +(defun tangle/yn (p) (if (bound-and-true-p p) "yes" "no")) +(defun tangle/file (file p) (if (bound-and-true-p p) (concat "tmp/" file) "no")) #+END_SRC *** emacs gc speedup #+BEGIN_SRC emacs-lisp - (defun my-minibuffer-setup-hook () - (setq gc-cons-threshold most-positive-fixnum)) +(defun my-minibuffer-setup-hook () + (setq gc-cons-threshold most-positive-fixnum)) - (defun my-minibuffer-exit-hook () - (setq gc-cons-threshold 8000000)) +(defun my-minibuffer-exit-hook () + (setq gc-cons-threshold 8000000)) - (add-hook 'minibuffer-setup-hook #'my-minibuffer-setup-hook) - (add-hook 'minibuffer-exit-hook #'my-minibuffer-exit-hook) +(add-hook 'minibuffer-setup-hook #'my-minibuffer-setup-hook) +(add-hook 'minibuffer-exit-hook #'my-minibuffer-exit-hook) #+END_SRC *** use-package/diminish bootstrap @@ -62,30 +62,37 @@ This configuration is using *use-package* extensively. Install it and diminish straight away so we can use it elsewhere. #+BEGIN_SRC emacs-lisp - (unless (package-installed-p 'use-package) - (progn - (package-refresh-contents) - (package-install 'use-package) - (package-initialize))) +(package-refresh-contents) +(unless (package-installed-p 'use-package) + (progn + (package-refresh-contents) + (package-install 'use-package) + (package-initialize))) - (require 'use-package) - (setq use-package-verbose t) - (use-package diminish :ensure t) - ;; diminish away builtin modes right away as well - (diminish 'flyspell-mode) - (diminish 'whitespace-mode) - (diminish 'visual-line-mode) +(require 'use-package) +(setq use-package-verbose t) +(use-package diminish :ensure t) +#+END_SRC + +FIXME Diminish away builtin modes right away as well + +Move this to the dimish use-package setup + +#+BEGIN_SRC emacs-lisp +(diminish 'flyspell-mode) +(diminish 'whitespace-mode) +(diminish 'visual-line-mode) #+END_SRC *** match end of string function #+BEGIN_SRC emacs-lisp - (defun string/ends-with (string suffix) - "Return t if STRING ends with SUFFIX." - (and (string-match (rx-to-string `(: ,suffix eos) t) - string) - t) - ) +(defun string/ends-with (string suffix) + "Return t if STRING ends with SUFFIX." + (and (string-match (rx-to-string `(: ,suffix eos) t) + string) + t) + ) #+END_SRC *** debug on error @@ -93,7 +100,7 @@ straight away so we can use it elsewhere. Not having to start *emacs* with *--debug-init* is useful. #+BEGIN_SRC emacs-lisp - (setq debug-on-error t) +(setq debug-on-error t) #+END_SRC *** emacs server @@ -101,8 +108,8 @@ Not having to start *emacs* with *--debug-init* is useful. Start up the emacs server if it isn't running. #+BEGIN_SRC emacs-lisp - (load "server") - (unless (server-running-p) (server-start)) +(load "server") +(unless (server-running-p) (server-start)) #+END_SRC *** theme @@ -110,7 +117,7 @@ Start up the emacs server if it isn't running. Solarized light is decent. I'll just use that. Note, to prevent flicker this is setup early in startup. #+BEGIN_SRC emacs-lisp - (use-package solarized-theme :ensure t :init (load-theme 'solarized-light 't)) +(use-package solarized-theme :ensure t :init (load-theme 'solarized-light 't)) #+END_SRC *** os detection @@ -118,12 +125,12 @@ Solarized light is decent. I'll just use that. Note, to prevent flicker this is Make it easier to determine what os we're running on. #+BEGIN_SRC emacs-lisp - (defvar on-mswindows (string-match "windows" (symbol-name system-type)) - "Am I running under windows?") - (defvar on-osx (string-match "darwin" (symbol-name system-type)) - "Am I running under osx?") - (defvar on-linux (string-match "gnu/linux" (symbol-name system-type)) - "Am I running under linux?") +(defvar on-mswindows (string-match "windows" (symbol-name system-type)) + "Am I running under windows?") +(defvar on-osx (string-match "darwin" (symbol-name system-type)) + "Am I running under osx?") +(defvar on-linux (string-match "gnu/linux" (symbol-name system-type)) + "Am I running under linux?") #+END_SRC *** disable pointless startup stuff @@ -143,18 +150,18 @@ Like the startup screen and the echo hooey. Keep temporary stuff isolated from everyone else. It infects everything otherwise. As bad as the .DS_Store files on osx. #+BEGIN_SRC emacs-lisp - (custom-set-variables - '(temporary-file-directory "/tmp") - '(backup-directory-alist `((".*" . ,temporary-file-directory))) - '(auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) - '(create-lockfiles nil) - '(make-backup-files nil) - '(auto-save-default nil) - '(backup-by-copying t) - '(auto-save-list-file-prefix temporary-file-directory) - '(backup-directory-alist `((".*" . ,temporary-file-directory))) - '(auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) - ) +(custom-set-variables + '(temporary-file-directory "/tmp") + '(backup-directory-alist `((".*" . ,temporary-file-directory))) + '(auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) + '(create-lockfiles nil) + '(make-backup-files nil) + '(auto-save-default nil) + '(backup-by-copying t) + '(auto-save-list-file-prefix temporary-file-directory) + '(backup-directory-alist `((".*" . ,temporary-file-directory))) + '(auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) + ) #+END_SRC *** auto revert @@ -162,7 +169,7 @@ Keep temporary stuff isolated from everyone else. It infects everything otherwis Update files in open buffers as they're changed on disk, freaking annoying without this on. #+BEGIN_SRC emacs-lisp - (custom-set-variables '(global-auto-revert-mode t)) +(custom-set-variables '(global-auto-revert-mode t)) #+END_SRC *** dired @@ -170,7 +177,7 @@ Update files in open buffers as they're changed on disk, freaking annoying witho Use dired-x. #+BEGIN_SRC emacs-lisp - (add-hook 'dired-load-hook (function (lambda () (load "dired-x")))) +(add-hook 'dired-load-hook (function (lambda () (load "dired-x")))) #+END_SRC *** ediff @@ -178,8 +185,8 @@ Use dired-x. For those rare times I use it, make it a bit less derp on output. #+BEGIN_SRC emacs-lisp - (setq ediff-window-setup-function 'ediff-setup-windows-plain) - (setq ediff-split-window-function 'split-window-horizontally) +(setq ediff-window-setup-function 'ediff-setup-windows-plain) +(setq ediff-split-window-function 'split-window-horizontally) #+END_SRC *** always remove trailing whitespace @@ -187,7 +194,7 @@ For those rare times I use it, make it a bit less derp on output. Trailing whitespace is not normally useful. Remove it always on save in the *before-save-hook*. #+BEGIN_SRC emacs-lisp - (add-hook 'before-save-hook 'delete-trailing-whitespace) +(add-hook 'before-save-hook 'delete-trailing-whitespace) #+END_SRC *** chmod u+x on save for scripts @@ -195,12 +202,12 @@ Trailing whitespace is not normally useful. Remove it always on save in the *bef Because its derp to have to chmod 755 stuff after I save. Honestly, do it for me kthxbai. #+BEGIN_SRC emacs-lisp - (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) +(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) #+END_SRC *** misc text related #+BEGIN_SRC emacs-lisp - (put 'upcase-region 'disabled nil) +(put 'upcase-region 'disabled nil) #+END_SRC *** line wrap @@ -209,8 +216,8 @@ Line wrapping is useful. Enable it globally for a start. Need word-wrap so kill line kills the line, not the displayed line. #+BEGIN_SRC emacs-lisp - (global-visual-line-mode t) - (custom-set-variables '(word-wrap t)) +(global-visual-line-mode t) +(custom-set-variables '(word-wrap t)) #+END_SRC *** default major mode @@ -218,7 +225,7 @@ Need word-wrap so kill line kills the line, not the displayed line. So if we don't know, call it text-mode. #+BEGIN_SRC emacs-lisp - (custom-set-variables '(default-major-mode 'text-mode)) +(custom-set-variables '(default-major-mode 'text-mode)) #+END_SRC *** encoding @@ -226,11 +233,11 @@ So if we don't know, call it text-mode. utf8 is the best. Default to it. #+BEGIN_SRC emacs-lisp - (custom-set-variables '(locale-coding-system 'utf-8)) - (set-terminal-coding-system 'utf-8) - (set-keyboard-coding-system 'utf-8) - (set-selection-coding-system 'utf-8) - (prefer-coding-system 'utf-8) +(custom-set-variables '(locale-coding-system 'utf-8)) +(set-terminal-coding-system 'utf-8) +(set-keyboard-coding-system 'utf-8) +(set-selection-coding-system 'utf-8) +(prefer-coding-system 'utf-8) #+END_SRC *** text selection @@ -238,14 +245,14 @@ utf8 is the best. Default to it. If I selected text, delete the selection, I probably meant it emacs. #+BEGIN_SRC emacs-lisp - (delete-selection-mode 1) +(delete-selection-mode 1) #+END_SRC *** line width 80 char line columns not 72. #+BEGIN_SRC emacs-lisp - (custom-set-variables '(fill-column 80)) +(custom-set-variables '(fill-column 80)) #+END_SRC *** we aren't banging rocks together anymore emacs @@ -253,7 +260,7 @@ If I selected text, delete the selection, I probably meant it emacs. Double spacing after a line isn't needed. We aren't animals emacs, we have computers. #+BEGIN_SRC emacs-lisp - (set-default 'sentence-end-double-space nil) +(set-default 'sentence-end-double-space nil) #+END_SRC *** sentence end @@ -261,10 +268,10 @@ Double spacing after a line isn't needed. We aren't animals emacs, we have compu Semi related to the above, make the sentence endings a bit more code-ish. #+BEGIN_SRC emacs-lisp - (custom-set-variables - '(sentence-end "[.?!][]\"')]*\\($\\|\t\\| \\)[ \t\n]*") - '(sentence-end-double-space nil) - ) +(custom-set-variables + '(sentence-end "[.?!][]\"')]*\\($\\|\t\\| \\)[ \t\n]*") + '(sentence-end-double-space nil) + ) #+END_SRC *** default tab-width @@ -274,7 +281,7 @@ Two seems sensible, cause well, tabs are evil incarnate. Lets use a tab width of 2 by default. #+BEGIN_SRC emacs-lisp - (custom-set-variables '(default-tab-width 2)) +(custom-set-variables '(default-tab-width 2)) #+END_SRC *** whitespace @@ -302,21 +309,20 @@ I have no idea how to label these. Highlight parens. #+BEGIN_SRC emacs-lisp - (show-paren-mode) +(show-paren-mode) #+END_SRC Typing out *yes* or *no* is stupid. #+BEGIN_SRC emacs-lisp - (fset 'yes-or-no-p 'y-or-n-p) +(fset 'yes-or-no-p 'y-or-n-p) #+END_SRC Disable the stupid prompt added in 23.2 that asks if you want to kill a buffer with a process attached. Yes, obviously, shut up and do it. #+BEGIN_SRC emacs-lisp - (setq kill-buffer-query-functions - (remq 'process-kill-buffer-query-function - kill-buffer-query-functions)) +(setq kill-buffer-query-functions + (remq 'process-kill-buffer-query-function kill-buffer-query-functions)) #+END_SRC TESTING tooltip mode @@ -324,9 +330,9 @@ TESTING tooltip mode Puts all tooltips in the echo arear. #+BEGIN_SRC emacs-lisp - (tooltip-mode -1) - (custom-set-variables - '(tooltip-use-echo-area t)) +(tooltip-mode -1) +(custom-set-variables + '(tooltip-use-echo-area t)) #+END_SRC TESTING redisplay @@ -334,8 +340,8 @@ TESTING redisplay Have emacs not redraw the display before processing input events. #+BEGIN_SRC emacs-lisp - (custom-set-variables - '(redisplay-dont-pause t)) +(custom-set-variables + '(redisplay-dont-pause t)) #+END_SRC *** osx specific @@ -345,16 +351,16 @@ Have emacs not redraw the display before processing input events. On osx, don't ever display the gui dialog box. Taken from http://superuser.com/questions/125569/how-to-fix-emacs-popup-dialogs-on-mac-os-x #+BEGIN_SRC emacs-lisp - (when (and on-osx (window-system)) - (defadvice yes-or-no-p (around prevent-dialog activate) - "Prevent yes-or-no-p from activating a dialog" - (let ((use-dialog-box nil)) - ad-do-it)) - (defadvice y-or-n-p (around prevent-dialog-yorn activate) - "Prevent y-or-n-p from activating a dialog" - (let ((use-dialog-box nil)) - ad-do-it)) - ) +(when (and on-osx (window-system)) + (defadvice yes-or-no-p (around prevent-dialog activate) + "Prevent yes-or-no-p from activating a dialog" + (let ((use-dialog-box nil)) + ad-do-it)) + (defadvice y-or-n-p (around prevent-dialog-yorn activate) + "Prevent y-or-n-p from activating a dialog" + (let ((use-dialog-box nil)) + ad-do-it)) + ) #+END_SRC **** make osx gui emacs keyboard setup match console @@ -362,15 +368,15 @@ On osx, don't ever display the gui dialog box. Taken from http://superuser.com/q Command should be meta on cocoa emacs like the old carbon/macports version. #+BEGIN_SRC emacs-lisp - (when (and on-osx (window-system)) - (custom-set-variables - '(mac-command-key-is-meta t) - '(mac-option-key-is-meta nil) - '(mac-command-key-is-meta t) - '(mac-command-modifier 'meta) - '(mac-option-modifier 'none) - ) - ) +(when (and on-osx (window-system)) + (custom-set-variables + '(mac-command-key-is-meta t) + '(mac-option-key-is-meta nil) + '(mac-command-key-is-meta t) + '(mac-command-modifier 'meta) + '(mac-option-modifier 'none) + ) + ) #+END_SRC *** global key bindings @@ -385,12 +391,12 @@ Global key bindings. *** x copy/paste #+BEGIN_SRC emacs-lisp - (when (and on-linux (window-system)) - (progn - (setq interprogram-paste-function 'x-cut-buffer-or-selection-value) - (setq x-select-enable-clipboard t) - ) +(when (and on-linux (window-system)) + (progn + (setq interprogram-paste-function 'x-cut-buffer-or-selection-value) + (setq x-select-enable-clipboard t) ) + ) #+END_SRC * appearance *** gui @@ -402,11 +408,11 @@ Basically, never show the tool bar or the scroll bar in gui or tty. In gui its o Also have the scratch buffer be empty instead of have the derp message I never read anyway. #+BEGIN_SRC emacs-lisp - (tool-bar-mode -1) - (scroll-bar-mode -1) - (when (not window-system) - (menu-bar-mode -1)) - (custom-set-variables '(initial-scratch-message nil)) +(tool-bar-mode -1) +(scroll-bar-mode -1) +(when (not window-system) + (menu-bar-mode -1)) +(custom-set-variables '(initial-scratch-message nil)) #+END_SRC *** fonts @@ -414,28 +420,29 @@ Also have the scratch buffer be empty instead of have the derp message I never r List of fonts in order of preference. Set preferred font list when we're in a gui emacs session. -FIXME +FIXME This doesn't loop through the gui fonts right and set based on the alist +order. #+BEGIN_SRC emacs-lisp :tangle no - (defvar my/gui-fonts - '( - "ComicCode" - "Comic Code" - "PragmataPro" - "Pragmata Pro" ;; Seems to register differently on osx than X - "Source Code Pro" - "Menlo" - "Monaco" - ) +(defvar my/gui-fonts + '( + "ComicCode" + "Comic Code" + "PragmataPro" + "Pragmata Pro" ;; Seems to register differently on osx than X + "Source Code Pro" + "Menlo" + "Monaco" ) - (with-no-warnings - (when window-system - (if (find-font (font-spec :name (car my/gui-fonts))) - (progn (set-frame-font (car my/gui-fonts)) - (set-face-attribute 'default nil :height 180)) - (progn (set-gui-font (cdr my/gui-fonts)))) - ) + ) +(with-no-warnings + (when window-system + (if (find-font (font-spec :name (car my/gui-fonts))) + (progn (set-frame-font (car my/gui-fonts)) + (set-face-attribute 'default nil :height 180)) + (progn (set-gui-font (cdr my/gui-fonts)))) ) + ) #+END_SRC *** tty @@ -443,17 +450,17 @@ FIXME Enable mouse mode for the console and use the mousewheel if possible. #+BEGIN_SRC emacs-lisp - (unless window-system - (require 'mouse) - (xterm-mouse-mode t) - (global-set-key [mouse-4] '(lambda () - (interactive) - (scroll-down 1))) - (global-set-key [mouse-5] '(lambda () - (interactive) - (scroll-up 1))) - (defun track-mouse (e)) - ) +(unless window-system + (require 'mouse) + (xterm-mouse-mode t) + (global-set-key [mouse-4] '(lambda () + (interactive) + (scroll-down 1))) + (global-set-key [mouse-5] '(lambda () + (interactive) + (scroll-up 1))) + (defun track-mouse (e)) + ) #+END_SRC * packages @@ -465,48 +472,47 @@ All the packages I use. If editorconfig is around use it. #+BEGIN_SRC emacs-lisp - (use-package editorconfig - :ensure t - :config - (editorconfig-mode 1)) +(use-package editorconfig + :ensure t + :config + (editorconfig-mode 1)) #+END_SRC *** tramp #+BEGIN_SRC emacs-lisp - (use-package tramp - :defer t - :config -(progn -(custom-set-variables '(tramp-default-method "ssh")) - (add-to-list 'tramp-default-proxies-alist '(".*" "\`root\'" "/ssh:%h:"))) -) +(use-package tramp + :defer t + :custom + (tramp-default-method "ssh") + :config + (add-to-list 'tramp-default-proxies-alist '(".*" "\`root\'" "/ssh:%h:")) + ) #+END_SRC - (add-to-list 'tramp-default-proxies-alist '(".*" "\`root\'" "/ssh:%h:"))) *** exec-path-from-shell Turns out that someone wrote this exact thing already. Yay get to drop my own crap. #+BEGIN_SRC emacs-lisp - (use-package exec-path-from-shell - :ensure t - :init (if on-osx (exec-path-from-shell-initialize)) - ) +(use-package exec-path-from-shell + :ensure t + :init (if on-osx (exec-path-from-shell-initialize)) + ) #+END_SRC *** osx-clipboard-mode #+BEGIN_SRC emacs-lisp - (when on-osx - (use-package osx-clipboard - :ensure t - :config - (progn - (osx-clipboard-mode +1) - ) +(when on-osx + (use-package osx-clipboard + :ensure t + :config + (progn + (osx-clipboard-mode +1) ) ) + ) #+END_SRC *** spaceline theme @@ -514,55 +520,53 @@ Turns out that someone wrote this exact thing already. Yay get to drop my own cr Just use the silly spacemacs smart modeline theme cause I'm lazy. #+BEGIN_SRC emacs-lisp - (use-package spaceline :ensure t :init (progn (require 'spaceline-config) (spaceline-spacemacs-theme))) +(use-package spaceline :ensure t :init (progn (require 'spaceline-config) (spaceline-spacemacs-theme))) #+END_SRC *** yasnippet #+BEGIN_SRC emacs-lisp - (use-package yasnippet - :diminish yas-minor-mode - :ensure t - :init - (progn - (setq yas-snippet-dirs - '("~/.emacs.d/snippets" - "~/.emacs.d/snippets-upstream" - ))) +(use-package yasnippet + :diminish yas-minor-mode + :ensure t + :init + (setq yas-snippet-dirs + '("~/.emacs.d/snippets" + "~/.emacs.d/snippets-upstream" + )) :config - (progn - (yas/reload-all) - (add-hook 'prog-mode-hook - '(lambda () - (yas-minor-mode))) - (add-hook 'org-mode-hook - '(lambda () - (yas-minor-mode)))) + (yas/reload-all) + (add-hook 'prog-mode-hook + '(lambda () + (yas-minor-mode))) + (add-hook 'org-mode-hook + '(lambda () + (yas-minor-mode))) ) #+END_SRC *** semantic +Note that not all these functions are defined at package install time + #+BEGIN_SRC emacs-lisp - (use-package semantic - :ensure t - :config - (progn - (custom-set-variables - '(global-semantic-decoration-mode t) - '(global-semantic-highlight-func-mode t) - '(global-semantic-idle-scheduler-mode t) - '(global-semantic-idle-local-symbol-highlight-mode t) - '(global-semantic-stickyfunc-mode f) - ) - ) - :init (semantic-mode t) - ) +(use-package semantic + :ensure t + :config + ;; (add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode) + (custom-set-variables + '(global-semantic-decoration-mode t) + '(global-semantic-highlight-func-mode t) + '(global-semantic-idle-scheduler-mode t) + '(global-semantic-idle-local-symbol-highlight-mode t) + ) + :init (semantic-mode t) + ) #+END_SRC *** expand-region #+BEGIN_SRC emacs-lisp - (use-package expand-region :ensure t :bind ("C-]" . er/expand-region)) +(use-package expand-region :ensure t :bind ("C-]" . er/expand-region)) #+END_SRC *** ivy/swiper @@ -570,32 +574,39 @@ Just use the silly spacemacs smart modeline theme cause I'm lazy. Switching to ivy mode+swiper #+BEGIN_SRC emacs-lisp - (use-package counsel - :ensure t - :bind (("C-x C-f" . counsel-find-file) - ("C-c g" . counsel-git) - ("C-c j" . counsel-git-grep) - ("C-c k" . counsel-ag) - ("C-x l" . counsel-locate) - ("C-S-o" . counsel-rhythmbox) - ("C-c C-r" . ivy-resume)) - :config (custom-set-variables '(counsel-find-file-at-point t))) - (use-package swiper - :ensure t - :diminish ivy-mode - :bind (("C-s" . swiper) - ("M-x" . counsel-M-x)) - :config (progn - (custom-set-variables - '(projectile-completion-system 'ivy) - '(magit-completing-read-function 'ivy-completing-read) - '(ivy-use-virtual-buffers t) - '(ivy-height 10) - '(ivy-count-format "(%d/%d) ") - ) - (ivy-mode 1) - ) - ) +(use-package projectile + :diminish projectile-mode + :ensure t + :init (projectile-global-mode) + ) + +(use-package counsel + :ensure t + :bind (("C-x C-f" . counsel-find-file) + ("C-c g" . counsel-git) + ("C-c j" . counsel-git-grep) + ("C-c k" . counsel-ag) + ("C-x l" . counsel-locate) + ("C-S-o" . counsel-rhythmbox) + ("C-c C-r" . ivy-resume)) + :custom + (counsel-find-file-at-point t) + ) + +(use-package swiper + :ensure t + :diminish ivy-mode + :bind (("C-s" . swiper) + ("M-x" . counsel-M-x)) + :config + (ivy-mode 1) + :custom + (projectile-completion-system 'ivy) + (magit-completing-read-function 'ivy-completing-read) + (ivy-use-virtual-buffers t) + (ivy-height 10) + (ivy-count-format "(%d/%d) ") + ) #+END_SRC *** magit @@ -603,29 +614,27 @@ Switching to ivy mode+swiper Make git not ass to use. At least in emacs. magit is the best git interface... in the world. #+BEGIN_SRC emacs-lisp - (use-package magit - :diminish magit-mode - :ensure t - :commands (magit-init - magit-status - magit-diff - magit-commit) - :bind ("C-x m" . magit-status) - :config - (progn - (custom-set-variables - '(magit-auto-revert-mode nil) - '(magit-last-seen-setup-instructions "1.4.0") - ) - (defadvice magit-status (around magit-fullscreen activate) - (window-configuration-to-register :magit-fullscreen) - ad-do-it - (delete-other-windows)) - - (defadvice magit-quit-window (around magit-restore-screen activate) - ad-do-it - (jump-to-register :magit-fullscreen))) - ) +(use-package magit + :diminish magit-mode + :ensure t + :commands (magit-init + magit-status + magit-diff + magit-commit) + :bind ("C-x m" . magit-status) + :custom + (magit-auto-revert-mode nil) + (magit-last-seen-setup-instructions "1.4.0") + :config + (defadvice magit-status (around magit-fullscreen activate) + (window-configuration-to-register :magit-fullscreen) + ad-do-it + (delete-other-windows)) + + (defadvice magit-quit-window (around magit-restore-screen activate) + ad-do-it + (jump-to-register :magit-fullscreen)) + ) #+END_SRC *** workgroups2 @@ -633,19 +642,15 @@ Make git not ass to use. At least in emacs. magit is the best git interface... i Save workgroup layouts. Similar..ish to desktop-save. #+BEGIN_SRC emacs-lisp :tangle no - (use-package workgroups2 - :ensure t - :diminish (workgroups-mode . "") - :config - (progn - (custom-set-variables - '(wg-session-file "~/.emacs.d/workgroups") - '(wg-prefix-key (kbd "C-c C-w")) - '(wg-mode-line-display-on nil) - ) - ) - :init (workgroups-mode 1) - ) +(use-package workgroups2 + :ensure t + :diminish (workgroups-mode . "") + :custom + (wg-session-file "~/.emacs.d/workgroups") + (wg-prefix-key (kbd "C-c C-w")) + (wg-mode-line-display-on nil) + :init (workgroups-mode 1) + ) #+END_SRC *** autopair @@ -653,11 +658,11 @@ Save workgroup layouts. Similar..ish to desktop-save. Highlight matching ()'s []'s etc... #+BEGIN_SRC emacs-lisp - (use-package autopair - :ensure t - :config - (progn (custom-set-variables '(autopair-blink 'nil))) - ) +(use-package autopair + :ensure t + :custom + (autopair-blink 'nil) + ) #+END_SRC *** org-mode @@ -665,103 +670,110 @@ Highlight matching ()'s []'s etc... Org-mode keybindings and settings, pretty sparse really. #+BEGIN_SRC emacs-lisp - (use-package org - :bind (("C-c a" . org-agenda) - ("C-c b" . org-iswitchb) - ("C-c c" . org-capture) - ("C-c l" . org-store-link) - ("C-c p" . org-latex-export-to-pdf)) - :config - (progn - (custom-set-variables - '(org-log-done t) - '(org-hide-leading-stars t) - '(org-hide-emphasis-markers t) - '(org-confirm-babel-evaluate nil) - '(org-src-strip-leading-and-trailing-blank-lines t) - '(org-src-preserve-indentation t) - '(org-capture-templates - '(("t" "Todo" entry (file+headline "~/src/org/gtd.org" "Tasks") - "* TODO %?\n %i\n %a") - ("n" "Note" entry (file+datetree "~/src/org/notes.org") - "* %?\nRandom Note entered on %U\n %i\n %a") - ("m" "Todo from email" entry (file+headline "~/src/org/gtd.org" "INBOX") - "* TODO %?, Link: %a") - ("u" "Url" entry (file+headline "~/src/org/urls.org" "Urls") - "* %u\n\n %i" :prepend t) - )) - ) +(use-package org + :ensure t + :bind (("C-c a" . org-agenda) + ("C-c b" . org-iswitchb) + ("C-c c" . org-capture) + ("C-c l" . org-store-link) + ("C-c p" . org-latex-export-to-pdf)) + :custom + (org-log-done t) + (org-hide-leading-stars t) + (org-hide-emphasis-markers t) + (org-confirm-babel-evaluate nil) + (org-src-strip-leading-and-trailing-blank-lines t) + (org-src-preserve-indentation t) + (org-capture-templates + '(("t" "Todo" entry (file+headline "~/src/org/gtd.org" "Tasks") + "* TODO %?\n %i\n %a") + ("n" "Note" entry (file+datetree "~/src/org/notes.org") + "* %?\nRandom Note entered on %U\n %i\n %a") + ("m" "Todo from email" entry (file+headline "~/src/org/gtd.org" "INBOX") + "* TODO %?, Link: %a") + ("u" "Url" entry (file+headline "~/src/org/urls.org" "Urls") + "* %u\n\n %i" :prepend t) + )) + :config + (add-to-list 'org-structure-template-alist '("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC" "")) + (add-to-list 'org-structure-template-alist '("hs" "#+BEGIN_SRC haskell\n?\n#+END_SRC" "")) + (add-to-list 'org-structure-template-alist '("pl" "#+BEGIN_SRC perl\n?\n#+END_SRC" "")) + (add-to-list 'org-structure-template-alist '("py" "#+BEGIN_SRC python\n?\n#+END_SRC" "")) + (add-to-list 'org-structure-template-alist '("sh" "#+BEGIN_SRC sh\n?\n#+END_SRC" "")) + (org-babel-do-load-languages 'org-babel-load-languages + (append org-babel-load-languages + '( + (C . t) + (ditaa . t) + (emacs-lisp . t) + (haskell . t) + (latex . t) + (perl . t) + (python . t) + (ruby . t) + (shell . t) + ))) + (add-hook 'after-init-hook (lambda () (org-reload))) +) +#+END_SRC - ;; typing stuff like the mode for a snippet is for chumps - (add-to-list 'org-structure-template-alist '("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC" "")) - (add-to-list 'org-structure-template-alist '("hs" "#+BEGIN_SRC haskell\n?\n#+END_SRC" "")) - (add-to-list 'org-structure-template-alist '("pl" "#+BEGIN_SRC perl\n?\n#+END_SRC" "")) - (add-to-list 'org-structure-template-alist '("py" "#+BEGIN_SRC python\n?\n#+END_SRC" "")) - (add-to-list 'org-structure-template-alist '("sh" "#+BEGIN_SRC sh\n?\n#+END_SRC" "")) - - (org-babel-do-load-languages 'org-babel-load-languages - (append org-babel-load-languages - '( - (C . t) - (ditaa . t) - (emacs-lisp . t) - (haskell . t) - (latex . t) - (perl . t) - (python . t) - (ruby . t) - (shell . t) - ))) - (add-hook 'after-init-hook (lambda () (org-reload))) - ) +#+BEGIN_SRC emacs-lisp +(use-package org-roam + :after org-plus-contrib + :defer t + :hook + (after-init . org-roam-mode) + :custom + (org-roam-directory "~/.emacs.d") + :bind (:map org-roam-mode-map + (("C-c n l" . org-roam) + ("C-c n f" . org-roam-find-file) + ("C-c n j" . org-roam-jump-to-index) + ("C-c n b" . org-roam-switch-to-buffer) + ("C-c n g" . org-roam-graph)) + :map org-mode-map + (("C-c n i" . org-roam-insert)))) +;;(use-package ob-async :after org-plus-contrib :ensure t) +#+END_SRC + +#+BEGIN_SRC emacs-lisp +(use-package ob-async :after org-plus-contrib :ensure t) +#+END_SRC + +#+BEGIN_SRC emacs-lisp +(use-package org-bullets + :after org-plus-contrib + :ensure t + :custom + (org-bullets-bullet-list '("・" "◦" "•" "◉")) + :config + (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) + (when window-system + (let* ((variable-tuple (cond ((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro")) + ((x-list-fonts "Lucida Grande") '(:font "Lucida Grande")) + ((x-list-fonts "Verdana") '(:font "Verdana")) + ((x-family-fonts "Sans Serif") '(:family "Sans Serif")) + (nil (warn "Cannot find a Sans Serif Font.")))) + (base-font-color (face-foreground 'default nil 'default)) + (headline `(:inherit default :weight bold :foreground ,base-font-color))) + (custom-theme-set-faces 'user + `(org-level-8 ((t (,@headline ,@variable-tuple)))) + `(org-level-7 ((t (,@headline ,@variable-tuple)))) + `(org-level-6 ((t (,@headline ,@variable-tuple)))) + `(org-level-5 ((t (,@headline ,@variable-tuple)))) + `(org-level-4 ((t (,@headline ,@variable-tuple :height 1.1)))) + `(org-level-3 ((t (,@headline ,@variable-tuple :height 1.25)))) + `(org-level-2 ((t (,@headline ,@variable-tuple :height 1.5)))) + `(org-level-1 ((t (,@headline ,@variable-tuple :height 1.75)))) + `(org-document-title ((t (,@headline ,@variable-tuple :height 1.5 :underline nil))))))) + (font-lock-add-keywords 'org-mode + '(("^ +\\([-*]\\) " + (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) ) - (use-package org-bullets - :ensure t - :init - (custom-set-variables '(org-bullets-bullet-list '("・" "◦" "•" "◉"))) - :config - (progn - (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) - (when window-system - (let* ((variable-tuple (cond ((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro")) - ((x-list-fonts "Lucida Grande") '(:font "Lucida Grande")) - ((x-list-fonts "Verdana") '(:font "Verdana")) - ((x-family-fonts "Sans Serif") '(:family "Sans Serif")) - (nil (warn "Cannot find a Sans Serif Font.")))) - (base-font-color (face-foreground 'default nil 'default)) - (headline `(:inherit default :weight bold :foreground ,base-font-color))) - (custom-theme-set-faces 'user - `(org-level-8 ((t (,@headline ,@variable-tuple)))) - `(org-level-7 ((t (,@headline ,@variable-tuple)))) - `(org-level-6 ((t (,@headline ,@variable-tuple)))) - `(org-level-5 ((t (,@headline ,@variable-tuple)))) - `(org-level-4 ((t (,@headline ,@variable-tuple :height 1.1)))) - `(org-level-3 ((t (,@headline ,@variable-tuple :height 1.25)))) - `(org-level-2 ((t (,@headline ,@variable-tuple :height 1.5)))) - `(org-level-1 ((t (,@headline ,@variable-tuple :height 1.75)))) - `(org-document-title ((t (,@headline ,@variable-tuple :height 1.5 :underline nil))))))) - (font-lock-add-keywords 'org-mode - '(("^ +\\([-*]\\) " - (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) - ) - ) - (use-package org-roam - :after org - :hook - (after-init . org-roam-mode) - :custom - (org-roam-directory "~/.emacs.d") - :bind (:map org-roam-mode-map - (("C-c n l" . org-roam) - ("C-c n f" . org-roam-find-file) - ("C-c n j" . org-roam-jump-to-index) - ("C-c n b" . org-roam-switch-to-buffer) - ("C-c n g" . org-roam-graph)) - :map org-mode-map - (("C-c n i" . org-roam-insert)))) - (use-package ob-async :after org) #+END_SRC +FIXME still need/want? + #+BEGIN_SRC emacs-lisp :tangle no (require 'ox-latex) ox-latex @@ -781,14 +793,14 @@ nil Flycheck for on the fly checking of code. #+BEGIN_SRC emacs-lisp - (use-package flycheck - :diminish flycheck-mode - :ensure t - :init - (custom-set-variables '(flycheck-indication-mode 'left-fringe)) - :config - (add-hook 'prog-mode-hook 'flycheck-mode) - ) +(use-package flycheck + :diminish flycheck-mode + :ensure t + :custom + (flycheck-indication-mode 'left-fringe) + :config + (add-hook 'prog-mode-hook 'flycheck-mode) + ) #+END_SRC Need to vet this, used it more when I did more c. But its handy for non standard pkg-config @@ -797,39 +809,40 @@ setups. Not tangled into the config intentionally. #+BEGIN_SRC emacs-lisp :tangle no - (defun pkg-config-add-lib-cflags (pkg-config-lib) - "This function will add necessary header file path of a +(defun pkg-config-add-lib-cflags (pkg-config-lib) + "This function will add necessary header file path of a specified by `pkg-config-lib' to `flycheck-clang-include-path', which make it completionable by auto-complete-clang" - (interactive "spkg-config lib: ") - (if (executable-find "pkg-config") - (if (= (shell-command - (format "pkg-config %s" pkg-config-lib)) - 0) - (setq flycheck-clang-include-path - (append flycheck-clang-include-path - (split-string - (shell-command-to-string - (format "pkg-config --cflags-only-I %s" - pkg-config-lib))))) - (message "Error, pkg-config lib %s not found." pkg-config-lib)) - (message "Error: pkg-config tool not found."))) -#+END_SRC - -*** auto-complete + (interactive "spkg-config lib: ") + (if (executable-find "pkg-config") + (if (= (shell-command + (format "pkg-config %s" pkg-config-lib)) + 0) + (setq flycheck-clang-include-path + (append flycheck-clang-include-path + (split-string + (shell-command-to-string + (format "pkg-config --cflags-only-I %s" + pkg-config-lib))))) + (message "Error, pkg-config lib %s not found." pkg-config-lib)) + (message "Error: pkg-config tool not found."))) +#+END_SRC + +*** COMMENT auto-complete Auto complete functionality is nice to have. FIXME! #+BEGIN_SRC emacs-lisp :tangle no - (use-package auto-complete - :diminish auto-complete-mode - :ensure t - :init (progn (require 'auto-complete-config) - (ac-config-default) - (global-auto-complete-mode t) - )) +(use-package auto-complete + :diminish auto-complete-mode + :ensure t + :init + (require 'auto-complete-config) + (ac-config-default) + (global-auto-complete-mode t) + ) #+END_SRC *** smartparens @@ -837,12 +850,12 @@ FIXME! Helpfully inserts matching parens, can be a pita too. #+BEGIN_SRC emacs-lisp - (use-package smartparens - :diminish smartparens-mode - :ensure t - :config - (add-hook 'prog-mode-hook 'smartparens-mode) - ) +(use-package smartparens + :diminish smartparens-mode + :ensure t + :config + (add-hook 'prog-mode-hook 'smartparens-mode) + ) #+END_SRC *** rainbow delimiters @@ -850,11 +863,11 @@ Helpfully inserts matching parens, can be a pita too. Makes matching parens easier. #+BEGIN_SRC emacs-lisp - (use-package rainbow-delimiters - :ensure t - :config - (add-hook 'prog-mode-hook 'rainbow-delimiters-mode) - ) +(use-package rainbow-delimiters + :ensure t + :config + (add-hook 'prog-mode-hook 'rainbow-delimiters-mode) + ) #+END_SRC *** uniquify @@ -862,8 +875,8 @@ Makes matching parens easier. Make buffer names unique based on their directory and not have or other nonsense. #+BEGIN_SRC emacs-lisp - (require 'uniquify) - (custom-set-variables '(uniquify-buffer-name-style 'post-forward)) +(require 'uniquify) +(custom-set-variables '(uniquify-buffer-name-style 'post-forward)) #+END_SRC *** desktop-save @@ -871,21 +884,21 @@ Make buffer names unique based on their directory and not have or other nons Desktop saving of session information handy to keep the same buffers between sessions. #+BEGIN_SRC emacs-lisp - (require 'desktop) +(require 'desktop) - (desktop-save-mode 1) +(desktop-save-mode 1) - (custom-set-variables - '(desktop-restore-eager 5) - '(desktop-path '("~/.emacs.d")) - '(desktop-dirname "~/.emacs.d") - '(desktop-base-file-name "desktop") - ) +(custom-set-variables + '(desktop-restore-eager 5) + '(desktop-path '("~/.emacs.d")) + '(desktop-dirname "~/.emacs.d") + '(desktop-base-file-name "desktop") + ) - (defun local-desktop-save () - (interactive) - (if (eq (desktop-owner) (emacs-pid)) - (desktop-save desktop-dirname))) +(defun local-desktop-save () + (interactive) + (if (eq (desktop-owner) (emacs-pid)) + (desktop-save desktop-dirname))) #+END_SRC *** TODO super-save @@ -895,14 +908,13 @@ REMOVE ME && TODO IF THIS WORKS Saves buffers like with auto-save but on focus loss, when idle etc... #+BEGIN_SRC emacs-lisp - (use-package super-save - :diminish super-save-mode - :ensure t - :config (progn - (super-save-mode +1) - (setq super-save-auto-save-when-idle t) - (setq auto-save-default nil) - ) +(use-package super-save + :diminish super-save-mode + :ensure t + :config + (super-save-mode +1) + (setq super-save-auto-save-when-idle t) + (setq auto-save-default nil) ) #+END_SRC @@ -911,58 +923,54 @@ Saves buffers like with auto-save but on focus loss, when idle etc... Highlight TODO/FIXME type messages in comments. #+BEGIN_SRC emacs-lisp :tangle no - (use-package fic-mode - :ensure t - :init - (add-hook 'prog-mode-hook 'turn-on-fic-mode) - ) +(use-package fic-mode + :ensure t + :init + (add-hook 'prog-mode-hook 'turn-on-fic-mode) + ) #+END_SRC *** projectile -FIXME! +FIXME! ??? what is broke here past mitch, you jerk #+BEGIN_SRC emacs-lisp :tangle no - (use-package projectile - :diminish projectile-mode - :ensure t - :init (projectile-global-mode) - ) + #+END_SRC *** git gutter #+BEGIN_SRC emacs-lisp - (use-package git-gutter - :diminish git-gutter-mode - :ensure t - :config - (progn (global-git-gutter-mode t)) - ) +(use-package git-gutter + :diminish git-gutter-mode + :ensure t + :config + (global-git-gutter-mode t) + ) #+END_SRC *** clang-format #+BEGIN_SRC emacs-lisp - (use-package clang-format - :ensure t - :bind (([C-M-tab] . clang-format-region)) - ) +(use-package clang-format + :ensure t + :bind (([C-M-tab] . clang-format-region)) + ) #+END_SRC *** hideshow #+BEGIN_SRC emacs-lisp - (use-package hideshow - :ensure t - :bind ("C-c s" . hs-toggle-hiding) - ) +(use-package hideshow + :ensure t + :bind ("C-c s" . hs-toggle-hiding) + ) #+END_SRC *** ggtags #+BEGIN_SRC emacs-lisp :tangle no - (use-package ggtags :ensure t) +(use-package ggtags :ensure t) #+END_SRC *** company-mode @@ -970,11 +978,11 @@ FIXME! Completion tips. #+BEGIN_SRC emacs-lisp :tangle no - (use-package company-mode - :ensure t - :config - (progn (add-hook 'after-init-hook 'global-company-mode)) - ) +(use-package company-mode + :ensure t + :config + (add-hook 'after-init-hook 'global-company-mode) + ) #+END_SRC *** yaml-mode @@ -982,7 +990,7 @@ Completion tips. For.. yaml #+BEGIN_SRC emacs-lisp - (use-package yaml-mode :ensure t) +(use-package yaml-mode :ensure t) #+END_SRC *** writegood-mode @@ -990,57 +998,54 @@ For.. yaml So I write gooder. Me fail English? Thats unpossible. #+BEGIN_SRC emacs-lisp - (use-package writegood-mode :ensure t) +(use-package writegood-mode :ensure t) #+END_SRC *** rust-mode #+BEGIN_SRC emacs-lisp - (use-package rust-mode :commands rust-mode :mode ("\\*.rs\\'" . rust-mode) - :ensure t) +(use-package rust-mode :commands rust-mode :mode ("\\*.rs\\'" . rust-mode) + :defer t) #+END_SRC *** python-mode Compress down python configuration a bit. #+BEGIN_SRC emacs-lisp :tangle no - (use-package python - :commands python-mode - :mode ("\\.py\\'" . python-mode) - :ensure t - :init - (progn - (use-package company-anaconda - :ensure t - :config - (progn - (add-to-list 'company-backends 'company-anaconda) - (add-hook 'python-mode-hook 'anaconda-mode) - ) - ) - (use-package pytest - :ensure t - :bind ("C-c t" . pytest-one) - ) - (use-package pymacs :ensure t) - ) - :config - (progn - (add-hook 'python-mode-hook' - (lambda () - (push '("lambda" . ?λ) prettify-symbols-alist) - (push '("<=" . ?≤) prettify-symbols-alist) - (push '(">=" . ?≥) prettify-symbols-alist) - (push '("==" . ?≡) prettify-symbols-alist) - (push '("/=" . ?≢) prettify-symbols-alist) - (push '("&&" . ?∧) prettify-symbols-alist) - (push '("||" . ?∨) prettify-symbols-alist) - (push '("not" . ?¬) prettify-symbols-alist) - (push '("None" . ?⊥) prettify-symbols-alist) - (prettify-symbols-mode) - ) - )) - ) +(use-package python + :after company-mode + :commands python-mode + :mode ("\\.py\\'" . python-mode) + :config + (add-hook 'python-mode-hook' + (lambda () + (push '("lambda" . ?λ) prettify-symbols-alist) + (push '("<=" . ?≤) prettify-symbols-alist) + (push '(">=" . ?≥) prettify-symbols-alist) + (push '("==" . ?≡) prettify-symbols-alist) + (push '("/=" . ?≢) prettify-symbols-alist) + (push '("&&" . ?∧) prettify-symbols-alist) + (push '("||" . ?∨) prettify-symbols-alist) + (push '("not" . ?¬) prettify-symbols-alist) + (push '("None" . ?⊥) prettify-symbols-alist) + (prettify-symbols-mode) + ) + ) + ) + +(use-package company-anaconda + :after python + :config + (add-to-list 'company-backends 'company-anaconda) + (add-hook 'python-mode-hook 'anaconda-mode) + + ) +(use-package pytest + :after python + :bind ("C-c t" . pytest-one) + ) + +(use-package pymacs :after python) #+END_SRC *** haskell-mode @@ -1048,117 +1053,103 @@ Compress down python configuration a bit. Need to make haskell source be all pretty. #+BEGIN_SRC emacs-lisp - (use-package haskell-mode - :diminish haskell-mode - :ensure t - :config - (progn - (use-package dante - :ensure t - :config - (progn - (add-hook 'haskell-mode-hook 'dante-mode) - ) - :diminish dante-mode - ) - (use-package hindent - :if (executable-find "hindent") - :ensure t - :config - (progn - (add-hook 'haskell-mode-hook 'hindent-mode) - ) - :diminish hindent-mode - ) - (use-package flycheck-haskell :ensure t) - (use-package flycheck-hdevtools - :ensure t - :config - (progn - (add-hook 'haskell-mode-hook 'flycheck-mode) - ) - ) - (use-package ghc - :if (executable-find "ghc-mod") - :ensure t +(use-package haskell-mode + :defer t + :diminish haskell-mode + :config + (add-hook 'haskell-mode-hook 'interactive-haskell-mode) + (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) + (add-hook 'haskell-mode-hook' + (lambda () + (push '("()" . ?∅) prettify-symbols-alist) + (push '("\\" . ?λ) prettify-symbols-alist) + (push '("pi" . ?π) prettify-symbols-alist) + (push '("=>" . ?⇒) prettify-symbols-alist) + (push '("->" . ?→) prettify-symbols-alist) + (push '("<-" . ?←) prettify-symbols-alist) + (push '("<=" . ?≤) prettify-symbols-alist) + (push '(">=" . ?≥) prettify-symbols-alist) + (push '("==" . ?≡) prettify-symbols-alist) + (push '("/=" . ?≢) prettify-symbols-alist) + (push '("!!" . "‼") prettify-symbols-alist) + (push '("&&" . ?∧) prettify-symbols-alist) + (push '("||" . ?∨) prettify-symbols-alist) + (push '("~>" . ?⇝) prettify-symbols-alist) + (push '("-<" . ?↢) prettify-symbols-alist) + (push '("not" . ?¬) prettify-symbols-alist) + (push '("forall" . ?∀) prettify-symbols-alist) + (push '("sqrt" . ?√) prettify-symbols-alist) + (push '("undefined" . ?⊥) prettify-symbols-alist) + (prettify-symbols-mode) + ) + ) + (add-to-list 'completion-ignored-extensions ".hi") + :custom + (haskell-program-name "ghci") + (haskell-process-type 'cabal-repl) + (haskell-tags-on-save t) + ) +(use-package dante + :after haskell-mode + :diminish dante-mode + :config + (add-hook 'haskell-mode-hook 'dante-mode) + ) +(use-package hindent + :if (executable-find "hindent") + :diminish hindent-mode + :after haskell-mode + :config + (add-hook 'haskell-mode-hook 'hindent-mode) + ) +(use-package flycheck-haskell :after haskell-mode) +(use-package flycheck-hdevtools + :after haskell-mode :config - (progn - (autoload 'ghc-init "ghc" nil t) - (autoload 'ghc-debug "ghc" nil t) - (add-hook 'haskell-mode-hook (lambda () - (ghc-init))) - ) + (add-hook 'haskell-mode-hook 'flycheck-mode) ) - (add-hook 'haskell-mode-hook 'interactive-haskell-mode) - (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) - (custom-set-variables - '(haskell-program-name "ghci") - '(haskell-process-type 'cabal-repl) - '(haskell-tags-on-save t) - ) - (add-to-list 'completion-ignored-extensions ".hi") - (add-hook 'haskell-mode-hook' - (lambda () - (push '("()" . ?∅) prettify-symbols-alist) - (push '("\\" . ?λ) prettify-symbols-alist) - (push '("pi" . ?π) prettify-symbols-alist) - (push '("=>" . ?⇒) prettify-symbols-alist) - (push '("->" . ?→) prettify-symbols-alist) - (push '("<-" . ?←) prettify-symbols-alist) - (push '("<=" . ?≤) prettify-symbols-alist) - (push '(">=" . ?≥) prettify-symbols-alist) - (push '("==" . ?≡) prettify-symbols-alist) - (push '("/=" . ?≢) prettify-symbols-alist) - (push '("!!" . "‼") prettify-symbols-alist) - (push '("&&" . ?∧) prettify-symbols-alist) - (push '("||" . ?∨) prettify-symbols-alist) - (push '("~>" . ?⇝) prettify-symbols-alist) - (push '("-<" . ?↢) prettify-symbols-alist) - (push '("not" . ?¬) prettify-symbols-alist) - (push '("forall" . ?∀) prettify-symbols-alist) - (push '("sqrt" . ?√) prettify-symbols-alist) - (push '("undefined" . ?⊥) prettify-symbols-alist) - (prettify-symbols-mode) - ) - ) - ) - ) +(use-package ghc + :if (executable-find "ghc-mod") + :after haskell-mode + :config + (autoload 'ghc-init "ghc" nil t) + (autoload 'ghc-debug "ghc" nil t) + (add-hook 'haskell-mode-hook (lambda () (ghc-init))) + ) #+END_SRC *** idris-mode #+BEGIN_SRC emacs-lisp - (use-package idris-mode - :ensure t - :config - (progn - (add-to-list 'completion-ignored-extensions ".ibc") - (add-hook 'idris-mode-hook' - (lambda () - (push '("()" . ?∅) prettify-symbols-alist) - (push '("\\" . ?λ) prettify-symbols-alist) - (push '("pi" . ?π) prettify-symbols-alist) - (push '("=>" . ?⇒) prettify-symbols-alist) - (push '("->" . ?→) prettify-symbols-alist) - (push '("<-" . ?←) prettify-symbols-alist) - (push '("<=" . ?≤) prettify-symbols-alist) - (push '(">=" . ?≥) prettify-symbols-alist) - (push '("==" . ?≡) prettify-symbols-alist) - (push '("/=" . ?≢) prettify-symbols-alist) - (push '("!!" . "‼") prettify-symbols-alist) - (push '("&&" . ?∧) prettify-symbols-alist) - (push '("||" . ?∨) prettify-symbols-alist) - (push '("~>" . ?⇝) prettify-symbols-alist) - (push '("-<" . ?↢) prettify-symbols-alist) - (push '("not" . ?¬) prettify-symbols-alist) - (push '("forall" . ?∀) prettify-symbols-alist) - (push '("sqrt" . ?√) prettify-symbols-alist) - (push '("undefined" . ?⊥) prettify-symbols-alist) - (prettify-symbols-mode) - ) - ) - ) - ) +(use-package idris-mode + :defer t + :config + (add-to-list 'completion-ignored-extensions ".ibc") + (add-hook 'idris-mode-hook' + (lambda () + (push '("()" . ?∅) prettify-symbols-alist) + (push '("\\" . ?λ) prettify-symbols-alist) + (push '("pi" . ?π) prettify-symbols-alist) + (push '("=>" . ?⇒) prettify-symbols-alist) + (push '("->" . ?→) prettify-symbols-alist) + (push '("<-" . ?←) prettify-symbols-alist) + (push '("<=" . ?≤) prettify-symbols-alist) + (push '(">=" . ?≥) prettify-symbols-alist) + (push '("==" . ?≡) prettify-symbols-alist) + (push '("/=" . ?≢) prettify-symbols-alist) + (push '("!!" . "‼") prettify-symbols-alist) + (push '("&&" . ?∧) prettify-symbols-alist) + (push '("||" . ?∨) prettify-symbols-alist) + (push '("~>" . ?⇝) prettify-symbols-alist) + (push '("-<" . ?↢) prettify-symbols-alist) + (push '("not" . ?¬) prettify-symbols-alist) + (push '("forall" . ?∀) prettify-symbols-alist) + (push '("sqrt" . ?√) prettify-symbols-alist) + (push '("undefined" . ?⊥) prettify-symbols-alist) + (prettify-symbols-mode) + ) + ) + ) #+END_SRC *** undo-tree @@ -1166,21 +1157,19 @@ Need to make haskell source be all pretty. Make undo more useful, and treelike. #+BEGIN_SRC emacs-lisp - (use-package undo-tree - :ensure t - :init - (global-undo-tree-mode) - :config - (progn (defadvice undo-tree-visualize (around undo-tree-split-side-by-side activate) - "Split undo-tree side-by-side" - (let ((split-height-threshold nil) - (split-width-threshold 0)) - ad-do-it) - ) - ) - :bind - ("C-x u" . undo-tree-visualize) +(use-package undo-tree + :ensure t + :config + (global-undo-tree-mode) + (defadvice undo-tree-visualize (around undo-tree-split-side-by-side activate) + "Split undo-tree side-by-side" + (let ((split-height-threshold nil) + (split-width-threshold 0)) + ad-do-it) ) + :bind + ("C-x u" . undo-tree-visualize) + ) #+END_SRC *** color-identifiers-mode @@ -1189,12 +1178,12 @@ Color variables for easy identification, its like a rainbow puked over everything opened in prog-mode-hook. #+BEGIN_SRC emacs-lisp - (use-package color-identifiers-mode - :diminish color-identifiers-mode - :ensure t - :config - (add-hook 'prog-mode-hook 'color-identifiers-mode) - ) +(use-package color-identifiers-mode + :defer t + :diminish color-identifiers-mode + :config + (add-hook 'prog-mode-hook 'color-identifiers-mode) + ) #+END_SRC *** idle-highlight-mode @@ -1203,12 +1192,12 @@ Highlight a variable when you're selecting it, helps in reviewing code to see where it exists. #+BEGIN_SRC emacs-lisp - (use-package idle-highlight-mode - :diminish idle-highlight-mode - :ensure t - :config - (add-hook 'prog-mode-hook 'idle-highlight-mode) - ) +(use-package idle-highlight-mode + :defer t + :diminish idle-highlight-mode + :config + (add-hook 'prog-mode-hook 'idle-highlight-mode) + ) #+END_SRC *** nix @@ -1216,34 +1205,35 @@ where it exists. Instead of text might as well get a decent mode hook going here. #+BEGIN_SRC emacs-lisp - (use-package nixos-options :ensure t) - (use-package company-nixos-options :ensure t) +(use-package nixos-options :defer t) +(use-package company-nixos-options :after company :defer t) #+END_SRC #+BEGIN_SRC emacs-lisp :tangle no - (use-package nix-mode :ensure t) - -(setq flycheck-command-wrapper-function +(use-package nix-mode + :config + (setq flycheck-command-wrapper-function (lambda (command) (apply 'nix-shell-command (nix-current-sandbox) command)) - flycheck-executable-find + flycheck-executable-find (lambda (cmd) (nix-executable-find (nix-current-sandbox) cmd))) -(add-to-list 'company-backends 'company-nixos-options) - + (add-to-list 'company-backends 'company-nixos-options) + ) #+END_SRC *** docker-mode #+BEGIN_SRC emacs-lisp - (use-package dockerfile-mode :defer t) +(use-package dockerfile-mode :defer t) #+END_SRC *** cscope +FIXME abandon in lieu of rtags? + #+BEGIN_SRC emacs-lisp - (use-package xcscope - :defer t - :config (progn (cscope-setup)) - ) +(use-package xcscope + :defer t + :config (cscope-setup)) #+END_SRC * mode related @@ -1253,43 +1243,45 @@ Common mode defaults I think are sensible. ***** prog-mode hook +FIXME think this should get use-packaged + #+BEGIN_SRC emacs-lisp - (add-hook 'prog-mode-hook - '(lambda () - (interactive) - (hl-line-mode) - (whitespace-mode) - (visual-line-mode) - (flyspell-prog-mode) - (custom-set-variables - '(indent-tabs-mode nil) - '(tab-width 2) - ) +(add-hook 'prog-mode-hook + '(lambda () + (interactive) + (hl-line-mode) + (whitespace-mode) + (visual-line-mode) + (flyspell-prog-mode) + (custom-set-variables + '(indent-tabs-mode nil) + '(tab-width 2) + ) + ) ) - ) #+END_SRC ***** c #+BEGIN_SRC emacs-lisp (add-to-list 'auto-mode-alist '("\\.[chm]\\'" . c-mode)) - (add-hook 'c-mode-common-hook - '(lambda () - (global-set-key "\C-x\C-m" 'compile) - (setq flycheck-clang-language-standard "c11") - (setq flycheck-idle-change-delay 2) - (setq flycheck-highlighting-mode 'symbols) +(add-hook 'c-mode-common-hook + '(lambda () + (global-set-key "\C-x\C-m" 'compile) + (setq flycheck-clang-language-standard "c11") + (setq flycheck-idle-change-delay 2) + (setq flycheck-highlighting-mode 'symbols) ;; later... ;; (add-hook 'before-save-hook 'clang-format-buffer nil t) - (c-toggle-auto-state 1) - (setq-default c-basic-offset 2 - tab-width 2 - indent-tabs-mode nil - c-electric-flag t - indent-level 2 - c-default-style "bsd" - backward-delete-function nil) - )) + (c-toggle-auto-state 1) + (setq-default c-basic-offset 2 + tab-width 2 + indent-tabs-mode nil + c-electric-flag t + indent-level 2 + c-default-style "bsd" + backward-delete-function nil) + )) #+END_SRC ***** elisp @@ -1308,152 +1300,156 @@ TODO: fixme ***** python-mode #+BEGIN_SRC emacs-lisp - (add-hook 'python-mode-hook - '(lambda () - (flycheck-select-checker 'python-flake8) - ) - ) +(add-hook 'python-mode-hook + '(lambda () + (flycheck-select-checker 'python-flake8) + ) + ) #+END_SRC ***** shell #+BEGIN_SRC emacs-lisp - (autoload 'sh--mode "sh-mode" "mode for shell stuff" t) +(autoload 'sh--mode "sh-mode" "mode for shell stuff" t) - (add-to-list 'auto-mode-alist '("\\.sh$\\'" . sh-mode)) - (add-to-list 'auto-mode-alist '("\\.[zk]sh$\\'" . sh-mode)) - (add-to-list 'auto-mode-alist '("\\.bash$\\'" . sh-mode)) - (add-to-list 'auto-mode-alist '("\\[.].*shrc$\\'" . sh-mode)) - (add-to-list 'auto-mode-alist '("sourceme$\\'" . sh-mode)) +(add-to-list 'auto-mode-alist '("\\.sh$\\'" . sh-mode)) +(add-to-list 'auto-mode-alist '("\\.[zk]sh$\\'" . sh-mode)) +(add-to-list 'auto-mode-alist '("\\.bash$\\'" . sh-mode)) +(add-to-list 'auto-mode-alist '("\\[.].*shrc$\\'" . sh-mode)) +(add-to-list 'auto-mode-alist '("sourceme$\\'" . sh-mode)) - (add-hook 'sh-mode-hook - '(lambda () - (setq sh-basic-offset 2 sh-indentation 4 - sh-indent-for-case-label 0 sh-indent-for-case-alt '+))) +(add-hook 'sh-mode-hook + '(lambda () + (setq sh-basic-offset 2 sh-indentation 4 + sh-indent-for-case-label 0 sh-indent-for-case-alt '+))) #+END_SRC ***** perl #+BEGIN_SRC emacs-lisp - (fset 'perl-mode 'cperl-mode) +(fset 'perl-mode 'cperl-mode) - (add-hook 'cperl-mode-hook - '(lambda () - (setq indent-tabs-mode t) - (setq tab-width 8) - (setq cperl-indent-level 4) - (setq tab-stop-list (number-sequence 4 200 4)) - (setq cperl-tab-always-indent t) - (setq cperl-indent-parens-as-block t) - ) - ) +(add-hook 'cperl-mode-hook + '(lambda () + (setq indent-tabs-mode t) + (setq tab-width 8) + (setq cperl-indent-level 4) + (setq tab-stop-list (number-sequence 4 200 4)) + (setq cperl-tab-always-indent t) + (setq cperl-indent-parens-as-block t) + ) + ) #+END_SRC *** auto-insert-mode new file templates +FIXME: review if this is worth keeping around, methinks there should be +something better like yasnippet out there. + Use auto-insert-mode to insert in templates for blank files. -So first up, add auto-insert to *find-file-hooks* so we insert straight away. Also setup the copyright bit to minimally put in name. +So first up, add auto-insert to *find-file-hooks* so we insert straight away. Also +setup the copyright bit to minimally put in name. #+BEGIN_SRC emacs-lisp - (add-hook 'find-file-hooks 'auto-insert) - (defvar auto-insert-copyright (user-full-name)) +(add-hook 'find-file-hooks 'auto-insert) +(defvar auto-insert-copyright (user-full-name)) #+END_SRC Create *auto-insert-alist* so all the mode lists are the same #+BEGIN_SRC emacs-lisp - (defvar auto-insert-alist '(())) +(defvar auto-insert-alist '(())) #+END_SRC ***** c #+BEGIN_SRC emacs-lisp - (setq auto-insert-alist - (append - '( - ((c-mode . "c") - nil - "/*\n" - "File: " (file-name-nondirectory buffer-file-name) "\n" - "Copyright: " (substring (current-time-string) -4) " " auto-insert-copyright "\n" - "Description: " _ "\n" - "*/\n" - "#include \n" - "#include \n\n" - "int main(int argc, char **argv) {\n" - " return 0;\n" - "}\n" - ) - ) - auto-insert-alist) +(setq auto-insert-alist + (append + '( + ((c-mode . "c") + nil + "/*\n" + "File: " (file-name-nondirectory buffer-file-name) "\n" + "Copyright: " (substring (current-time-string) -4) " " auto-insert-copyright "\n" + "Description: " _ "\n" + "*/\n" + "#include \n" + "#include \n\n" + "int main(int argc, char **argv) {\n" + " return 0;\n" + "}\n" ) + ) + auto-insert-alist) + ) #+END_SRC ***** elisp #+BEGIN_SRC emacs-lisp - (setq auto-insert-alist - (append - '( - ((emacs-lisp-mode . "elisp") - nil - ";;-*-mode: emacs-lisp; coding: utf-8;-*-\n" - ";; File: " (file-name-nondirectory buffer-file-name) "\n" - ";; Copyright: " (substring (current-time-string) -4) " " auto-insert-copyright "\n" - ";; Description: " _ "\n" - ) - ) - auto-insert-alist) +(setq auto-insert-alist + (append + '( + ((emacs-lisp-mode . "elisp") + nil + ";;-*-mode: emacs-lisp; coding: utf-8;-*-\n" + ";; File: " (file-name-nondirectory buffer-file-name) "\n" + ";; Copyright: " (substring (current-time-string) -4) " " auto-insert-copyright "\n" + ";; Description: " _ "\n" ) + ) + auto-insert-alist) + ) #+END_SRC ***** python #+BEGIN_SRC emacs-lisp - (setq auto-insert-alist - (append - '(((python-mode . "python") - nil - "#!/usr/bin/env python\n" - "# -*-mode: Python; coding: utf-8;-*-\n" - "# File: " (file-name-nondirectory buffer-file-name) "\n" - "# Copyright: " (substring (current-time-string) -4) " " auto-insert-copyright "\n" - "# Description: " _ "\n\n" - ) - ) - auto-insert-alist) - ) +(setq auto-insert-alist + (append + '(((python-mode . "python") + nil + "#!/usr/bin/env python\n" + "# -*-mode: Python; coding: utf-8;-*-\n" + "# File: " (file-name-nondirectory buffer-file-name) "\n" + "# Copyright: " (substring (current-time-string) -4) " " auto-insert-copyright "\n" + "# Description: " _ "\n\n" + ) + ) + auto-insert-alist) + ) #+END_SRC ***** shell #+BEGIN_SRC emacs-lisp - (setq auto-insert-alist - (append - '( - ((sh-mode . "sh") - nil - "#!/usr/bin/env sh\n" - "#-*-mode: Shell-script; coding: utf-8;-*-\n" - "# File: " (file-name-nondirectory buffer-file-name) "\n" - "# Copyright: " (substring (current-time-string) -4) " " auto-insert-copyright "\n" - "# Description: " _ "\n" - "export script=$(basename \"$0\")\n" - "export dir=$(cd \"$(dirname \"$0\")\"; pwd)\n" - "export iam=${dir}/${script}\n" - ) - ) - auto-insert-alist) - ) +(setq auto-insert-alist + (append + '( + ((sh-mode . "sh") + nil + "#!/usr/bin/env sh\n" + "#-*-mode: Shell-script; coding: utf-8;-*-\n" + "# File: " (file-name-nondirectory buffer-file-name) "\n" + "# Copyright: " (substring (current-time-string) -4) " " auto-insert-copyright "\n" + "# Description: " _ "\n" + "export script=$(basename \"$0\")\n" + "export dir=$(cd \"$(dirname \"$0\")\"; pwd)\n" + "export iam=${dir}/${script}\n" + ) + ) + auto-insert-alist) + ) #+END_SRC * custom Load this up last to allow for local customization if needed and to keep from custom writing to the init.el file. #+BEGIN_SRC emacs-lisp - (setq custom-file "~/.emacs.d/custom.el") - (load custom-file 'noerror) +(setq custom-file "~/.emacs.d/custom.el") +(load custom-file 'noerror) #+END_SRC * Load any local definitions