Mitch Tishmack 11 лет назад
Родитель
Сommit
d4dc830579
6 измененных файлов: 159 добавлений и 37 удалений
  1. +3
    -0
      .gitignore
  2. +5
    -2
      Makefile
  3. +134
    -34
      emacs/.emacs.d/emacs.org
  4. +1
    -1
      emacs/.emacs.d/init.el
  5. +8
    -0
      nix/.profile.d/20-functions-nix.sh
  6. +8
    -0
      nix/.profile.d/99-final-nix.sh

+ 3
- 0
.gitignore Просмотреть файл

@@ -8,3 +8,6 @@ emacs/.emacs.d/ac-comphist.dat
emacs/.emacs.d/elpa emacs/.emacs.d/elpa
emacs/.emacs.d/emacs.el emacs/.emacs.d/emacs.el
emacs/.emacs.d/url emacs/.emacs.d/url
emacs/.emacs.d/.emacs.desktop.lock
emacs/.emacs.d/tramp
emacs/.emacs.d/projectile-bookmarks.eld

+ 5
- 2
Makefile Просмотреть файл

@@ -5,12 +5,12 @@ STOWOPTS=-target $(HOME) -d $(PWD)
DOTGITCONFIG=~/.gitconfig DOTGITCONFIG=~/.gitconfig
DOTPROFILE=~/.profile 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) home: $(DOTGITCONFIG) $(DOTPROFILE)
$(DOTDEE) $(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 all: home


@@ -64,3 +64,6 @@ haskell:


perl: perl:
$(STOW) $(STOWOPTS) perl $(STOW) $(STOWOPTS) perl

nix:
$(STOW) $(STOWOPTS) nix

+ 134
- 34
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: but if you wanted to this is how you would do so:


** Clone this repo ** Clone this repo

#+BEGIN_SRC sh :tangle no #+BEGIN_SRC sh :tangle no
git clone https://github.com/mitchty/dotfiles git clone https://github.com/mitchty/dotfiles
#+END_SRC #+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 #+BEGIN_SRC sh :tangle no
tar cvf ~/.emacs-backup.tar ~/.emacs.d ~/.emacs tar cvf ~/.emacs-backup.tar ~/.emacs.d ~/.emacs

#+END_SRC #+END_SRC


** Remove/move your old configuration ** Remove/move your old configuration
@@ -31,6 +31,7 @@ rm -fr ~/.emacs.d ~/.emacs
#+END_SRC #+END_SRC


** Lastly copy necessary files ** Lastly copy necessary files

#+BEGIN_SRC sh :tangle no #+BEGIN_SRC sh :tangle no
mkdir ~/.emacs.d mkdir ~/.emacs.d
cp dotfiles/init.el dotfiles/emacs.org ~/.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 #+BEGIN_SRC emacs-lisp
(require 'use-package) (require 'use-package)
#+END_SRC #+END_SRC

* prelude * 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 ** 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. Add a save hook to always tangle and byte compile emacs.org file when we save it.
@@ -52,21 +65,24 @@ Add a save hook to always tangle and byte compile emacs.org file when we save it
(defun tangle-init () (defun tangle-init ()
"If the current buffer is 'emacs.org' the code-blocks are "If the current buffer is 'emacs.org' the code-blocks are
tangled, and the tangled file is compiled." 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)) (let ((prog-mode-hook nil))
(org-babel-tangle) (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) (add-hook 'after-save-hook 'tangle-init)
#+END_SRC #+END_SRC

** debug on error ** debug on error


Not having to start *emacs* with *--debug-init* is useful. Not having to start *emacs* with *--debug-init* is useful.


#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(customize-set-variable 'debug-on-error t)
(setq debug-on-error t)
#+END_SRC #+END_SRC

** emacs server ** emacs server


Start up the emacs server if it isn't running. Start up the emacs server if it isn't running.
@@ -75,6 +91,7 @@ Start up the emacs server if it isn't running.
(load "server") (load "server")
(unless (server-running-p) (server-start)) (unless (server-running-p) (server-start))
#+END_SRC #+END_SRC

** os detection ** os detection


Make it easier to determine what os we're running on. Make it easier to determine what os we're running on.
@@ -87,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)) (defvar on-linux (string-match "gnu/linux" (symbol-name system-type))
"Am I running under linux?") "Am I running under linux?")
#+END_SRC #+END_SRC

*** Mac OS X Gui emacs PATH setup *** Mac OS X Gui emacs PATH setup


This is here because if gui emacs gets started say from Finder, one can This is here because if gui emacs gets started say from Finder, one can
@@ -97,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 For now we restrict this only to OSX. It may be more generally useful
however. however.

#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun set-exec-path-from-shell-PATH () (defun set-exec-path-from-shell-PATH ()
(let ((path-from-shell (let ((path-from-shell
@@ -115,6 +134,7 @@ Like the startup screen and the echo hooey.
(customize-set-variable 'inhibit-startup-message t) (customize-set-variable 'inhibit-startup-message t)
(customize-set-variable 'inhibit-startup-echo-area-message t) (customize-set-variable 'inhibit-startup-echo-area-message t)
#+END_SRC #+END_SRC

** temporary files ** temporary files


Keep temporary stuff isolated from everyone else. It infects everything otherwise. As bad as the .DS_Store files on osx. Keep temporary stuff isolated from everyone else. It infects everything otherwise. As bad as the .DS_Store files on osx.
@@ -131,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 'backup-directory-alist `((".*" . ,temporary-file-directory)))
(customize-set-variable 'auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) (customize-set-variable 'auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
#+END_SRC #+END_SRC

** auto revert ** auto revert


Update files in open buffers as they're changed on disk, freaking annoying without this on. Update files in open buffers as they're changed on disk, freaking annoying without this on.
@@ -146,6 +167,7 @@ Use dired-x.
#+BEGIN_SRC emacs-lisp #+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 #+END_SRC

** ediff ** ediff


For those rare times I use it, make it a bit less derp on output. For those rare times I use it, make it a bit less derp on output.
@@ -154,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-window-setup-function 'ediff-setup-windows-plain)
(setq ediff-split-window-function 'split-window-horizontally) (setq ediff-split-window-function 'split-window-horizontally)
#+END_SRC #+END_SRC

** tramp ** tramp


Tramp configuration. Tramp configuration.
@@ -186,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-copy-keep-date nil)
(tramp-password-end-of-line nil))) (tramp-password-end-of-line nil)))
#+END_SRC #+END_SRC

** always remove trailing whitespace ** always remove trailing whitespace


Trailing whitespace is not normally useful. Remove it always on save in the *before-save-hook*. Trailing whitespace is not normally useful. Remove it always on save in the *before-save-hook*.
@@ -201,13 +225,14 @@ Because its derp to have to chmod 755 stuff after I save. Honestly, do it for me
#+BEGIN_SRC emacs-lisp #+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 #+END_SRC

** misc text related ** misc text related


Not sure what to categorize this crap as tbh. Not sure what to categorize this crap as tbh.


*** wtf does this do? *** 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 #+BEGIN_SRC emacs-lisp :tangle no
(move-text-default-bindings) (move-text-default-bindings)
@@ -297,6 +322,7 @@ Global key bindings.
(global-set-key (kbd "C-]") 'er/expand-region) (global-set-key (kbd "C-]") 'er/expand-region)
(global-set-key (kbd "C-x C-m") 'compile) (global-set-key (kbd "C-x C-m") 'compile)
#+END_SRC #+END_SRC

* appearance * appearance
** theme ** theme


@@ -307,9 +333,11 @@ Solarized light is decent. I'll just use that.
:ensure t :ensure t
:init (load-theme 'solarized-light 't)) :init (load-theme 'solarized-light 't))
#+END_SRC #+END_SRC

** modeline ** modeline


Updat the time every ~3 seconds in the mode line. Updat the time every ~3 seconds in the mode line.

#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(custom-set-variables '(display-time-default-load-average nil)) (custom-set-variables '(display-time-default-load-average nil))
(custom-set-variables '(display-time-format "%T")) (custom-set-variables '(display-time-format "%T"))
@@ -362,9 +390,11 @@ Format the mode line, I... can't decipher this anymore nor do I care to, it work
"%-" "%-"
))) )))
#+END_SRC #+END_SRC

** whitespace ** whitespace


Customize whitespace mode to make tabs obvious as boxes, and to highlight lines over 80 characters in length. Customize whitespace mode to make tabs obvious as boxes, and to highlight lines over 80 characters in length.

#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(require 'whitespace) (require 'whitespace)


@@ -378,6 +408,7 @@ Customize whitespace mode to make tabs obvious as boxes, and to highlight lines
:foreground "#2075c7" :foreground "#2075c7"
:background "lightgrey") :background "lightgrey")
#+END_SRC #+END_SRC

** gui chrome ** gui chrome


When i'm running in a terminal emacs, most of this junk isn't needed. For that matter gui counts for most. When i'm running in a terminal emacs, most of this junk isn't needed. For that matter gui counts for most.
@@ -390,6 +421,7 @@ Basically, never show the tool bar or the scroll bar in gui or tty. In gui its o
(when (not window-system) (when (not window-system)
(menu-bar-mode -1)) (menu-bar-mode -1))
#+END_SRC #+END_SRC

** fonts ** fonts


Fonts. Let me specify them for gui emacs. Fonts. Let me specify them for gui emacs.
@@ -416,6 +448,7 @@ Fonts. Let me specify them for gui emacs.
) )


#+END_SRC #+END_SRC

* packages * packages


All the packages I use. All the packages I use.
@@ -439,55 +472,59 @@ By Helms Deep use Helm to do ALL THE THINGS. IDO is ass in comparison.
(require 'helm-config) (require 'helm-config)
(helm-mode 1))) (helm-mode 1)))
#+END_SRC #+END_SRC

** helm-descbinds ** helm-descbinds


Its nice being able to describe helm things you know? Its nice being able to describe helm things you know?


#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package helm-descbinds (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 #+END_SRC

** helm-ag ** helm-ag


Helm search plugin for [[Ag%20(The%20Silver%20Searcher)][Ag (The Silver Searcher)]] so much nicer than regular searching in helm imo. 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 #+BEGIN_SRC emacs-lisp
(use-package helm-ag (use-package helm-ag
:ensure t
)
:ensure t
)
#+END_SRC #+END_SRC

** magit ** magit


Make git not ass to use. At least in emacs. magit is the best git interface... in the world. Make git not ass to use. At least in emacs. magit is the best git interface... in the world.


#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package magit (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 (use-package magit-blame
:ensure magit
:commands (magit-blame-mode)
)
:ensure magit
:commands (magit-blame-mode)
)
#+END_SRC #+END_SRC

** workgroups2 ** workgroups2


Save workgroup layouts. Similar..ish to desktop-save. Save workgroup layouts. Similar..ish to desktop-save.
@@ -519,6 +556,7 @@ Highlight matching ()'s []'s etc...
:config (customize-set-variable 'autopair-blink 'nil) :config (customize-set-variable 'autopair-blink 'nil)
) )
#+END_SRC #+END_SRC

** org ** org


Org mode keybindings and settings, pretty sparse really. Org mode keybindings and settings, pretty sparse really.
@@ -535,6 +573,7 @@ Org mode keybindings and settings, pretty sparse really.
) )


#+END_SRC #+END_SRC

** flycheck ** flycheck


Flycheck for on the fly checking of code. Flycheck for on the fly checking of code.
@@ -579,17 +618,24 @@ Auto complete functionality is nice to have.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package auto-complete (use-package auto-complete
:ensure t :ensure t
:defer t
:init
(progn (require 'auto-complete-config)
(ac-config-default)
(global-auto-complete-mode t))
) )
#+END_SRC #+END_SRC

** smartparens ** smartparens


Helpfully inserts matching parens, can be a pita too. Helpfully inserts matching parens, can be a pita too.


#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package smartparens (use-package smartparens
:ensure t
)
:ensure t
)
#+END_SRC #+END_SRC

** uniquify ** uniquify


Make buffer names unique based on their directory and not have <N> or other nonsense. Make buffer names unique based on their directory and not have <N> or other nonsense.
@@ -598,6 +644,7 @@ Make buffer names unique based on their directory and not have <N> or other nons
(require 'uniquify) (require 'uniquify)
(customize-set-variable 'uniquify-buffer-name-style 'post-forward) (customize-set-variable 'uniquify-buffer-name-style 'post-forward)
#+END_SRC #+END_SRC

** desktop-save ** desktop-save


Desktop saving of session information handy to keep the same buffers between sessions. Desktop saving of session information handy to keep the same buffers between sessions.
@@ -620,12 +667,65 @@ Desktop saving of session information handy to keep the same buffers between ses
(add-hook 'auto-save-hook 'desktop-save-in-desktop-dir) (add-hook 'auto-save-hook 'desktop-save-in-desktop-dir)
#+END_SRC #+END_SRC


<<<<<<< HEAD
** fic-mode ** fic-mode


Highlight TODO/FIXME type messages in comments. Highlight TODO/FIXME type messages in comments.


#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package fic-mode :ensure t) (use-package fic-mode :ensure t)
=======
** 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 #+END_SRC


* mode related * mode related


+ 1
- 1
emacs/.emacs.d/init.el Просмотреть файл

@@ -19,7 +19,7 @@


;; Somewhat needed so we can use org to manage things. ;; Somewhat needed so we can use org to manage things.
(use-package org (use-package org
:ensure org-plus-contrib)
:ensure org-plus-contrib)


(require 'org) (require 'org)
(org-babel-load-file "~/.emacs.d/emacs.org") (org-babel-load-file "~/.emacs.d/emacs.org")

+ 8
- 0
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 <nixpkgs> {}).haskellPackages }:/s' \
| sed -E -e 's/(cabal\.mkDerivation)/with haskellPackages; \1/' -e 'sXsha256 = "0";Xsrc = "./.";X' \
> shell.nix;
}

+ 8
- 0
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

Загрузка…
Отмена
Сохранить