From c166db5fa050a772cb88702beb9381b537268390 Mon Sep 17 00:00:00 2001 From: Mitch Tishmack Date: Sun, 22 Feb 2015 14:49:13 -0600 Subject: [PATCH 1/4] Add a nix dotfile target. --- Makefile | 7 +++++-- nix/.profile.d/20-functions-nix.sh | 8 ++++++++ nix/.profile.d/99-final-nix.sh | 8 ++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 nix/.profile.d/20-functions-nix.sh create mode 100755 nix/.profile.d/99-final-nix.sh diff --git a/Makefile b/Makefile index f625219..0e90fd6 100644 --- a/Makefile +++ b/Makefile @@ -5,12 +5,12 @@ STOWOPTS=-target $(HOME) -d $(PWD) DOTGITCONFIG=~/.gitconfig DOTPROFILE=~/.profile -.PHONY: mosh common emacs git ruby haskell perl tmux vim zsh list home osx linux ws +.PHONY: mosh common emacs git ruby haskell perl tmux vim zsh list home osx linux ws nix home: $(DOTGITCONFIG) $(DOTPROFILE) $(DOTDEE) $(DOTPROFILE) -ws: common mosh git ruby haskell perl tmux vim zsh home +ws: common emacs nix mosh git ruby haskell perl tmux vim zsh home all: home @@ -64,3 +64,6 @@ haskell: perl: $(STOW) $(STOWOPTS) perl + +nix: + $(STOW) $(STOWOPTS) nix diff --git a/nix/.profile.d/20-functions-nix.sh b/nix/.profile.d/20-functions-nix.sh new file mode 100644 index 0000000..135c808 --- /dev/null +++ b/nix/.profile.d/20-functions-nix.sh @@ -0,0 +1,8 @@ +# nix/.profile.d/20-functions-nix.sh +mk_nix_shell() +{ + cabal2nix --sha256="0" . \ + | perl -0777 -p -e 's/{.+}:/{ haskellPackages ? (import {}).haskellPackages }:/s' \ + | sed -E -e 's/(cabal\.mkDerivation)/with haskellPackages; \1/' -e 'sXsha256 = "0";Xsrc = "./.";X' \ + > shell.nix; +} diff --git a/nix/.profile.d/99-final-nix.sh b/nix/.profile.d/99-final-nix.sh new file mode 100755 index 0000000..7c485d7 --- /dev/null +++ b/nix/.profile.d/99-final-nix.sh @@ -0,0 +1,8 @@ +# nix.profile.d/99-final-nix.sh + +# The nix installer put something like this into the .profile. +# BAD INSTALLER NO COOKIE! +if [ -e ${HOME}/.nix-profile/etc/profile.d/nix.sh ]; then + . ${HOME}/.nix-profile/etc/profile.d/nix.sh; + export NIX_PATH=${HOME}/Developer/github.com/NixOS/nixpkgs:nixpkgs=${HOME}/Developer/github.com/NixOS/nixpkgs +fi From ba2300a3e286fc173b58173af1923c7acb3fc32c Mon Sep 17 00:00:00 2001 From: Mitch Tishmack Date: Sun, 22 Feb 2015 14:55:52 -0600 Subject: [PATCH 2/4] Update with packages from test branch. --- emacs/.emacs.d/emacs.org | 155 +++++++++++++++++++++++++++++++-------- emacs/.emacs.d/init.el | 2 +- 2 files changed, 124 insertions(+), 33 deletions(-) diff --git a/emacs/.emacs.d/emacs.org b/emacs/.emacs.d/emacs.org index 4e176b5..9ba8b1e 100644 --- a/emacs/.emacs.d/emacs.org +++ b/emacs/.emacs.d/emacs.org @@ -31,6 +31,7 @@ rm -fr ~/.emacs.d ~/.emacs #+END_SRC ** Lastly copy necessary files + #+BEGIN_SRC sh :tangle no mkdir ~/.emacs.d cp dotfiles/init.el dotfiles/emacs.org ~/.emacs.d @@ -43,7 +44,19 @@ For some reason init.el doesn't always seem to get reflecte here. Weird reaserch #+BEGIN_SRC emacs-lisp (require 'use-package) #+END_SRC + * prelude +** 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) + ) +#+END_SRC + ** always babel tangle and byte compile emacs.org Add a save hook to always tangle and byte compile emacs.org file when we save it. @@ -52,20 +65,22 @@ Add a save hook to always tangle and byte compile emacs.org file when we save it (defun tangle-init () "If the current buffer is 'emacs.org' the code-blocks are tangled, and the tangled file is compiled." - (when (equal (buffer-file-name) - (expand-file-name (concat user-emacs-directory "emacs.org"))) + (when (string/ends-with (buffer-file-name) ".emacs.d/emacs.org") (let ((prog-mode-hook nil)) (org-babel-tangle) - (byte-compile-file (concat user-emacs-directory "emacs.el"))))) + (byte-compile-file (concat user-emacs-directory "emacs.el"))) + ) + ) (add-hook 'after-save-hook 'tangle-init) #+END_SRC + ** debug on error Not having to start *emacs* with *--debug-init* is useful. #+BEGIN_SRC emacs-lisp -(customize-set-variable 'debug-on-error t) +(setq debug-on-error t) #+END_SRC ** emacs server @@ -296,6 +311,7 @@ Global key bindings. (global-set-key (kbd "C-,") 'kill-whole-line) (global-set-key (kbd "C-]") 'er/expand-region) #+END_SRC + * appearance ** theme @@ -306,6 +322,7 @@ Solarized light is decent. I'll just use that. :ensure t :init (load-theme 'solarized-light 't)) #+END_SRC + ** modeline Updat the time every ~3 seconds in the mode line. @@ -361,6 +378,7 @@ Format the mode line, I... can't decipher this anymore nor do I care to, it work "%-" ))) #+END_SRC + ** whitespace Customize whitespace mode to make tabs obvious as boxes, and to highlight lines over 80 characters in length. @@ -377,6 +395,7 @@ Customize whitespace mode to make tabs obvious as boxes, and to highlight lines :foreground "#2075c7" :background "lightgrey") #+END_SRC + ** gui chrome When i'm running in a terminal emacs, most of this junk isn't needed. For that matter gui counts for most. @@ -415,6 +434,7 @@ Fonts. Let me specify them for gui emacs. ) #+END_SRC + * packages All the packages I use. @@ -438,55 +458,59 @@ By Helms Deep use Helm to do ALL THE THINGS. IDO is ass in comparison. (require 'helm-config) (helm-mode 1))) #+END_SRC + ** helm-descbinds Its nice being able to describe helm things you know? #+BEGIN_SRC emacs-lisp (use-package helm-descbinds - :ensure t - :bind (("C-h b" . helm-descbinds) - ("C-h w" . helm-descbinds)) - ) + :ensure t + :bind (("C-h b" . helm-descbinds) + ("C-h w" . helm-descbinds)) + ) #+END_SRC + ** helm-ag Helm search plugin for [[Ag%20(The%20Silver%20Searcher)][Ag (The Silver Searcher)]] so much nicer than regular searching in helm imo. #+BEGIN_SRC emacs-lisp (use-package helm-ag - :ensure t - ) + :ensure t + ) #+END_SRC + ** magit 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 - :ensure t - :commands (magit-init - magit-status - magit-diff - magit-commit) - :bind ("C-x m" . magit-status) - :config - (progn - (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))) - ) + :ensure t + :commands (magit-init + magit-status + magit-diff + magit-commit) + :bind ("C-x m" . magit-status) + :config + (progn + (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-blame - :ensure magit - :commands (magit-blame-mode) - ) + :ensure magit + :commands (magit-blame-mode) + ) #+END_SRC + ** workgroups2 Save workgroup layouts. Similar..ish to desktop-save. @@ -518,6 +542,7 @@ Highlight matching ()'s []'s etc... :config (customize-set-variable 'autopair-blink 'nil) ) #+END_SRC + ** org Org mode keybindings and settings, pretty sparse really. @@ -534,6 +559,7 @@ Org mode keybindings and settings, pretty sparse really. ) #+END_SRC + ** flycheck Flycheck for on the fly checking of code. @@ -578,17 +604,24 @@ Auto complete functionality is nice to have. #+BEGIN_SRC emacs-lisp (use-package auto-complete :ensure t + :defer t + :init + (progn (require 'auto-complete-config) + (ac-config-default) + (global-auto-complete-mode t)) ) #+END_SRC + ** smartparens Helpfully inserts matching parens, can be a pita too. #+BEGIN_SRC emacs-lisp (use-package smartparens - :ensure t - ) + :ensure t + ) #+END_SRC + ** uniquify Make buffer names unique based on their directory and not have or other nonsense. @@ -597,6 +630,7 @@ Make buffer names unique based on their directory and not have or other nons (require 'uniquify) (customize-set-variable 'uniquify-buffer-name-style 'post-forward) #+END_SRC + ** desktop-save Desktop saving of session information handy to keep the same buffers between sessions. @@ -618,6 +652,63 @@ Desktop saving of session information handy to keep the same buffers between ses (add-hook 'auto-save-hook 'desktop-save-in-desktop-dir) #+END_SRC + +** projectile + +#+BEGIN_SRC emacs-lisp + (use-package projectile + :ensure t + :defer t + :idle (projectile-global-mode) + :config (progn (require 'helm-projectile) + (helm-projectile-on)) + ) +#+END_SRC + +** git gutter + +#+BEGIN_SRC emacs-lisp + (use-package git-gutter + :ensure t + :defer t + :idle (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)) + ) +#+END_SRC + +** ggtags + +#+BEGIN_SRC emacs-lisp :tangle no + (use-package ggtags + :ensure t + ) +#+END_SRC + +** company-mode + +#+BEGIN_SRC emacs-lisp :tangle no + (use-package company-mode + :ensure t + ) +#+END_SRC + +** helm-gtags + +#+BEGIN_SRC emacs-lisp + (use-package helm-gtags + :ensure t + ) + +#+END_SRC + * mode related ** common defaults diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index d8ac2b8..69d4bea 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -19,7 +19,7 @@ ;; Somewhat needed so we can use org to manage things. (use-package org - :ensure org-plus-contrib) + :ensure org-plus-contrib) (require 'org) (org-babel-load-file "~/.emacs.d/emacs.org") From c6bef9664ede1828f72bff7785caf53685b3251a Mon Sep 17 00:00:00 2001 From: Mitch Tishmack Date: Sun, 22 Feb 2015 14:57:38 -0600 Subject: [PATCH 3/4] update .gitignore with new emacs ignores --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index a03fb29..1fcec1b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ emacs/.emacs.d/ac-comphist.dat emacs/.emacs.d/elpa emacs/.emacs.d/emacs.el emacs/.emacs.d/url +emacs/.emacs.d/.emacs.desktop.lock +emacs/.emacs.d/tramp +emacs/.emacs.d/projectile-bookmarks.eld From ab518f20fde9fe2408e7cb81249bd9c6556fa80f Mon Sep 17 00:00:00 2001 From: Mitch Tishmack Date: Sun, 22 Feb 2015 15:17:44 -0600 Subject: [PATCH 4/4] Ocd changes. --- emacs/.emacs.d/emacs.org | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/emacs.org b/emacs/.emacs.d/emacs.org index 9ba8b1e..f98e315 100644 --- a/emacs/.emacs.d/emacs.org +++ b/emacs/.emacs.d/emacs.org @@ -9,6 +9,7 @@ This is my emacs configuration file. I don't encourage anyone to use this verbat but if you wanted to this is how you would do so: ** Clone this repo + #+BEGIN_SRC sh :tangle no git clone https://github.com/mitchty/dotfiles #+END_SRC @@ -19,7 +20,6 @@ Always good to back things up, just in case you hate how I did things. #+BEGIN_SRC sh :tangle no tar cvf ~/.emacs-backup.tar ~/.emacs.d ~/.emacs - #+END_SRC ** Remove/move your old configuration @@ -82,6 +82,7 @@ Not having to start *emacs* with *--debug-init* is useful. #+BEGIN_SRC emacs-lisp (setq debug-on-error t) #+END_SRC + ** emacs server Start up the emacs server if it isn't running. @@ -90,6 +91,7 @@ Start up the emacs server if it isn't running. (load "server") (unless (server-running-p) (server-start)) #+END_SRC + ** os detection Make it easier to determine what os we're running on. @@ -102,6 +104,7 @@ Make it easier to determine what os we're running on. (defvar on-linux (string-match "gnu/linux" (symbol-name system-type)) "Am I running under linux?") #+END_SRC + *** Mac OS X Gui emacs PATH setup This is here because if gui emacs gets started say from Finder, one can @@ -112,6 +115,7 @@ then parse that to setup emacs exec-path. For now we restrict this only to OSX. It may be more generally useful however. + #+BEGIN_SRC emacs-lisp (defun set-exec-path-from-shell-PATH () (let ((path-from-shell @@ -130,6 +134,7 @@ Like the startup screen and the echo hooey. (customize-set-variable 'inhibit-startup-message t) (customize-set-variable 'inhibit-startup-echo-area-message t) #+END_SRC + ** temporary files Keep temporary stuff isolated from everyone else. It infects everything otherwise. As bad as the .DS_Store files on osx. @@ -146,6 +151,7 @@ Keep temporary stuff isolated from everyone else. It infects everything otherwis (customize-set-variable 'backup-directory-alist `((".*" . ,temporary-file-directory))) (customize-set-variable 'auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) #+END_SRC + ** auto revert Update files in open buffers as they're changed on disk, freaking annoying without this on. @@ -161,6 +167,7 @@ Use dired-x. #+BEGIN_SRC emacs-lisp (add-hook 'dired-load-hook (function (lambda () (load "dired-x")))) #+END_SRC + ** ediff For those rare times I use it, make it a bit less derp on output. @@ -169,6 +176,7 @@ For those rare times I use it, make it a bit less derp on output. (setq ediff-window-setup-function 'ediff-setup-windows-plain) (setq ediff-split-window-function 'split-window-horizontally) #+END_SRC + ** tramp Tramp configuration. @@ -201,6 +209,7 @@ Its a hack, but it work(ed). Will remove it at some date in the future. (tramp-copy-keep-date nil) (tramp-password-end-of-line nil))) #+END_SRC + ** always remove trailing whitespace Trailing whitespace is not normally useful. Remove it always on save in the *before-save-hook*. @@ -216,13 +225,14 @@ Because its derp to have to chmod 755 stuff after I save. Honestly, do it for me #+BEGIN_SRC emacs-lisp (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) #+END_SRC + ** misc text related Not sure what to categorize this crap as tbh. *** wtf does this do? -TOOD: find out why I added this ages ago. +TODO: find out why I added this ages ago. #+BEGIN_SRC emacs-lisp :tangle no (move-text-default-bindings) @@ -326,6 +336,7 @@ Solarized light is decent. I'll just use that. ** modeline Updat the time every ~3 seconds in the mode line. + #+BEGIN_SRC emacs-lisp (custom-set-variables '(display-time-default-load-average nil)) (custom-set-variables '(display-time-format "%T")) @@ -382,6 +393,7 @@ Format the mode line, I... can't decipher this anymore nor do I care to, it work ** whitespace Customize whitespace mode to make tabs obvious as boxes, and to highlight lines over 80 characters in length. + #+BEGIN_SRC emacs-lisp (require 'whitespace) @@ -408,6 +420,7 @@ Basically, never show the tool bar or the scroll bar in gui or tty. In gui its o (when (not window-system) (menu-bar-mode -1)) #+END_SRC + ** fonts Fonts. Let me specify them for gui emacs.