| @@ -5,3 +5,5 @@ url | |||||
| ac-dict | ac-dict | ||||
| ac-comphist.dat | ac-comphist.dat | ||||
| .emacs.desktop* | .emacs.desktop* | ||||
| *.elc | |||||
| emacs.el | |||||
| @@ -1,12 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (require 'haskell-mode) | |||||
| (require 'haskell-process) | |||||
| (require 'haskell-simple-indent) | |||||
| (require 'haskell-interactive-mode) | |||||
| (require 'haskell-font-lock) | |||||
| (require 'haskell-debug) | |||||
| (require 'sgml-mode) | |||||
| (require 'css-mode) | |||||
| (require 'helm-config) | |||||
| (helm-mode 1) | |||||
| (color-theme-solarized-light) | |||||
| @@ -1,68 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (require 'package) | |||||
| (setq my-packages | |||||
| '( | |||||
| helm | |||||
| dash | |||||
| s | |||||
| string-utils | |||||
| list-utils | |||||
| flycheck | |||||
| expand-region | |||||
| auto-complete | |||||
| auto-complete-clang-async | |||||
| magit | |||||
| smex | |||||
| column-marker | |||||
| ruby-end | |||||
| multi-term | |||||
| dropdown-list | |||||
| popup | |||||
| org-plus-contrib | |||||
| org-bullets | |||||
| org-pomodoro | |||||
| org-present | |||||
| color-theme | |||||
| perl-completion | |||||
| workgroups | |||||
| yasnippet | |||||
| figlet | |||||
| org-readme | |||||
| move-text | |||||
| smartparens | |||||
| markdown-mode | |||||
| yaml-mode | |||||
| go-mode | |||||
| rust-mode | |||||
| haskell-mode | |||||
| color-theme-solarized | |||||
| )) | |||||
| (package-initialize) | |||||
| (add-to-list 'package-archives | |||||
| '("melpa" . "http://melpa.milkbox.net/packages/")) | |||||
| (add-to-list 'package-archives | |||||
| '("gnu" . "http://elpa.gnu.org/packages/")) | |||||
| (add-to-list 'package-archives | |||||
| '("org" . "http://orgmode.org/elpa/")) | |||||
| ;; TODO: maybe set an ENV var to force refresh at startup? | |||||
| (when (not package-archive-contents) | |||||
| (package-refresh-contents)) | |||||
| (dolist (pkg my-packages) | |||||
| (when (and (not (package-installed-p pkg)) | |||||
| (assoc pkg package-archive-contents)) | |||||
| (package-install pkg))) | |||||
| (defun package-list-unaccounted-packages () | |||||
| "Like `package-list-packages', but shows only the packages that | |||||
| are installed and are not in `my-packages'. Useful for | |||||
| cleaning out unwanted packages." | |||||
| (interactive) | |||||
| (package-show-package-list | |||||
| (remove-if-not (lambda (x) (and (not (memq x my-packages)) | |||||
| (not (package-built-in-p x)) | |||||
| (package-installed-p x))) | |||||
| (mapcar 'car package-archive-contents)))) | |||||
| @@ -0,0 +1,646 @@ | |||||
| #+BABEL: :cache yes | |||||
| #+PROPERTY: header-args :tangle yes :comments org | |||||
| #+TITLE: Emacs Configuration | |||||
| #+AUTHOR: Mitch Tishmack | |||||
| * readme | |||||
| This is my emacs configuration file. I don't encourage anyone to use this verbatim, | |||||
| 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 | |||||
| ** Preferably backup your emacs configuration | |||||
| 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 | |||||
| This is up to you to do right, just an example. | |||||
| #+BEGIN_SRC sh :tangle no | |||||
| 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 | |||||
| #+END_SRC | |||||
| * use-package-hack | |||||
| For some reason init.el doesn't always seem to get reflecte here. Weird reaserch later. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (require 'use-package) | |||||
| #+END_SRC | |||||
| * prelude | |||||
| ** 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. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (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"))) | |||||
| (let ((prog-mode-hook nil)) | |||||
| (org-babel-tangle) | |||||
| (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) | |||||
| #+END_SRC | |||||
| ** emacs server | |||||
| Start up the emacs server if it isn't running. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (load "server") | |||||
| (unless (server-running-p) (server-start)) | |||||
| #+END_SRC | |||||
| ** os detection | |||||
| 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?") | |||||
| #+END_SRC | |||||
| *** Mac OS X Gui emacs PATH setup | |||||
| This is here because if gui emacs gets started say from Finder, one can | |||||
| end up with missing certain things that aren't in the default PATH. | |||||
| The strategy is fire off a $SHELL and have it echo the PATH it has and | |||||
| 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 | |||||
| (shell-command-to-string "$SHELL -i -c 'echo $PATH'"))) | |||||
| (setenv "PATH" path-from-shell) | |||||
| (setq exec-path (split-string path-from-shell path-separator)))) | |||||
| (if on-osx (set-exec-path-from-shell-PATH)) | |||||
| #+END_SRC | |||||
| ** disable pointless startup stuff | |||||
| Like the startup screen and the echo hooey. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (customize-set-variable 'inhibit-startup-screen t) | |||||
| (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. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (customize-set-variable 'temporary-file-directory "/tmp") | |||||
| (customize-set-variable 'backup-directory-alist `((".*" . ,temporary-file-directory))) | |||||
| (customize-set-variable 'auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) | |||||
| (customize-set-variable 'create-lockfiles nil) | |||||
| (customize-set-variable 'make-backup-files nil) | |||||
| (customize-set-variable 'auto-save-default nil) | |||||
| (customize-set-variable 'backup-by-copying t) | |||||
| (customize-set-variable 'auto-save-list-file-prefix temporary-file-directory) | |||||
| (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. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (customize-set-variable 'global-auto-revert-mode t) | |||||
| #+END_SRC | |||||
| ** dired | |||||
| 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. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (setq ediff-window-setup-function 'ediff-setup-windows-plain) | |||||
| (setq ediff-split-window-function 'split-window-horizontally) | |||||
| #+END_SRC | |||||
| ** tramp | |||||
| Tramp configuration. | |||||
| Make the proxy list less weird. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (require 'tramp) | |||||
| ;; FIXME | |||||
| ;; (customize-variable 'tramp-default-proxies-alist | |||||
| ;; (quote ((".*" "\\`root\\'" "/ssh:%h:")))) | |||||
| #+END_SRC | |||||
| So this was originally a way to do tramp over ssh where sudo only worked with su. | |||||
| Its a hack, but it work(ed). Will remove it at some date in the future. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (add-to-list 'tramp-methods | |||||
| '("susudo" | |||||
| (tramp-login-program "sudo") | |||||
| (tramp-login-args | |||||
| (("-u" "%u") | |||||
| ("-H") | |||||
| ("-p" "Password:") | |||||
| ("su -c /bin/sh"))) | |||||
| (tramp-remote-sh "/bin/sh") | |||||
| (tramp-copy-program nil) | |||||
| (tramp-copy-args nil) | |||||
| (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*. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (add-hook 'before-save-hook 'delete-trailing-whitespace) | |||||
| #+END_SRC | |||||
| ** chmod u+x on save for scripts | |||||
| 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) | |||||
| #+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. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| ;;(move-text-default-bindings) | |||||
| #+END_SRC | |||||
| *** default major mode | |||||
| So if we don't know, call it text-mode. | |||||
| #+BEGIN_SRC emacs-lis | |||||
| (custom-set-variables '(default-major-mode 'text-mode)) | |||||
| #+END_SRC | |||||
| *** encoding | |||||
| 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) | |||||
| #+END_SRC | |||||
| *** text selection | |||||
| If I selected text, delete the selection, I probably meant it emacs. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (delete-selection-mode 1) | |||||
| #+END_SRC | |||||
| *** line width | |||||
| 80 char line columns not 72. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (custom-set-variables '(fill-column 80)) | |||||
| #+END_SRC | |||||
| *** we aren't banging rocks on typewriters anymore emacs | |||||
| Double spacing after a line isn't needed. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (set-default 'sentence-end-double-space nil) | |||||
| #+END_SRC | |||||
| *** sentence end | |||||
| 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]*")) | |||||
| (custom-set-variables '(sentence-end-double-space nil)) | |||||
| #+END_SRC | |||||
| *** default tab-width | |||||
| Two seems sensible, cause well, tabs are evil incarnate. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (custom-set-variables '(default-tab-width 2)) | |||||
| #+END_SRC | |||||
| ** uncategorized | |||||
| I have no idea how to label these. | |||||
| Highlight parens. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (show-paren-mode) | |||||
| #+END_SRC | |||||
| Typing out *yes* or *no* is stupid. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (defalias 'yes-or-no-p 'y-or-n-p) | |||||
| #+END_SRC | |||||
| * global key bindings | |||||
| Global key bindings. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (global-set-key (kbd "C-,") 'kill-whole-line) | |||||
| (global-set-key (kbd "C-]") 'er/expand-region) | |||||
| #+END_SRC | |||||
| * appearance | |||||
| ** theme | |||||
| Solarized light is decent. I'll just use that. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (use-package solarized-theme | |||||
| :ensure t | |||||
| :init (load-theme 'solarized-light 't)) | |||||
| #+END_SRC | |||||
| ** 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")) | |||||
| (custom-set-variables '(display-time-interval 3)) | |||||
| (display-time-mode) | |||||
| #+END_SRC | |||||
| Display line and column always in the modeline. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (custom-set-variables '(line-number-mode t)) | |||||
| (custom-set-variables '(column-number-mode t)) | |||||
| #+END_SRC | |||||
| Format the mode line, I... can't decipher this anymore nor do I care to, it works eff it. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (custom-set-variables | |||||
| '(mode-line-format | |||||
| (list | |||||
| '(:eval (propertize "%b " 'face 'font-lock-keyword-face | |||||
| 'help-echo (buffer-file-name))) | |||||
| (propertize "%02l" 'face 'font-lock-type-face) "," | |||||
| (propertize "%02c" 'face 'font-lock-type-face) | |||||
| " [" | |||||
| '(:eval (propertize "%m" 'face 'font-lock-string-face | |||||
| 'help-echo buffer-file-coding-system)) | |||||
| minor-mode-alist | |||||
| "] " | |||||
| "[" | |||||
| '(:eval (propertize (if overwrite-mode "Ovr" "Ins") | |||||
| 'face 'font-lock-preprocessor-face | |||||
| 'help-echo (concat "Buffer is in " | |||||
| (if overwrite-mode "overwrite" "insert") " mode"))) | |||||
| '(:eval (when (buffer-modified-p) | |||||
| (concat "," (propertize "Mod" | |||||
| 'face 'font-lock-warning-face | |||||
| 'help-echo "Buffer has been modified")))) | |||||
| '(:eval (when buffer-read-only | |||||
| (concat "," (propertize "RO" | |||||
| 'face 'font-lock-type-face | |||||
| 'help-echo "Buffer is read-only")))) "] " | |||||
| '(:eval (propertize | |||||
| (format-time-string "%H:%M:%S") | |||||
| 'help-echo | |||||
| (concat (format-time-string "%c; ") | |||||
| (emacs-uptime "Uptime:%hh") | |||||
| ))) | |||||
| " --" | |||||
| "%-" | |||||
| ))) | |||||
| #+END_SRC | |||||
| ** 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) | |||||
| (setq whitespace-style '(face tabs trailing)) | |||||
| (set-face-attribute 'whitespace-tab nil | |||||
| :foreground "#2075c7" | |||||
| :background "lightgrey") | |||||
| (set-face-attribute 'whitespace-line nil | |||||
| :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. | |||||
| Basically, never show the tool bar or the scroll bar in gui or tty. In gui its ok to show the menu-bar. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (tool-bar-mode -1) | |||||
| (scroll-bar-mode -1) | |||||
| (when (not window-system) | |||||
| (menu-bar-mode -1)) | |||||
| #+END_SRC | |||||
| * packages | |||||
| All the packages I use. | |||||
| ** Helm | |||||
| By Helms Deep use Helm to do ALL THE THINGS. IDO is ass in comparison. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (use-package helm | |||||
| :ensure t | |||||
| :diminish helm-mode | |||||
| :bind (("M-x" . helm-M-x) | |||||
| ("M-y" . helm-show-kill-ring) | |||||
| ("C-x b" . helm-mini) | |||||
| ("C-x C-b" . helm-buffers-list) | |||||
| ("C-x C-f" . helm-find-files) | |||||
| ("C-x C-r" . helm-recentf) | |||||
| ("C-x c o" . helm-occur)) | |||||
| :init (progn | |||||
| (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)) | |||||
| ) | |||||
| #+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 | |||||
| ) | |||||
| #+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))) | |||||
| ) | |||||
| (use-package magit-blame | |||||
| :ensure magit | |||||
| :commands (magit-blame-mode) | |||||
| ) | |||||
| #+END_SRC | |||||
| ** autopair | |||||
| Highlight matching ()'s []'s etc... | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (use-package autopair | |||||
| :ensure t | |||||
| :config (customize-set-variable 'autopair-blink 'nil) | |||||
| ) | |||||
| #+END_SRC | |||||
| ** org | |||||
| Org mode keybindings and settings, pretty sparse really. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (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)) | |||||
| :config (customize-set-variable 'org-log-done t) | |||||
| ) | |||||
| #+END_SRC | |||||
| ** flycheck | |||||
| Flycheck for on the fly checking of code. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (use-package flycheck | |||||
| :ensure t | |||||
| :config (customize-set-variable 'flycheck-indication-mode 'right-fringe) | |||||
| ) | |||||
| #+END_SRC | |||||
| Need to vet this, used it more when I did more c. But its handy for non standard pkg-config | |||||
| 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 | |||||
| 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 | |||||
| Auto complete functionality is nice to have. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (use-package auto-complete | |||||
| :ensure t | |||||
| ) | |||||
| #+END_SRC | |||||
| ** smartparens | |||||
| Helpfully inserts matching parens, can be a pita too. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (use-package smartparens | |||||
| :ensure t | |||||
| ) | |||||
| #+END_SRC | |||||
| ** uniquify | |||||
| Make buffer names unique based on their directory and not have <N> or other nonsense. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (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. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (require 'desktop) | |||||
| (desktop-save-mode 1) | |||||
| (customize-set-variable 'desktop-restore-eager 5) | |||||
| (customize-set-variable 'desktop-path '("~/.emacs.d")) | |||||
| (customize-set-variable 'desktop-dirname "~/.emacs.d") | |||||
| (customize-set-variable 'desktop-base-file-name "desktop") | |||||
| (defun local-desktop-save () | |||||
| (interactive) | |||||
| (if (eq (desktop-owner) (emacs-pid)) | |||||
| (desktop-save desktop-dirname))) | |||||
| (add-hook 'auto-save-hook 'desktop-save-in-desktop-dir) | |||||
| #+END_SRC | |||||
| * mode related | |||||
| ** common defaults | |||||
| Common mode defaults I think are sensible. | |||||
| TODO: fixme kthxbai | |||||
| #+BEGIN_SRC emacs-lisp :tangle no | |||||
| (interactive) | |||||
| (highlight-lines-matching-regexp ".\{81\}" 'hi-green-b) | |||||
| (hl-line-mode) | |||||
| ;;(auto-complete-mode) | |||||
| (whitespace-mode) | |||||
| ;;(smartparens-mode) | |||||
| (visual-line-mode) | |||||
| (customize-set-variable 'indent-tabs-mode nil) | |||||
| (customize-set-variable 'tab-width 2) | |||||
| #+END_SRC | |||||
| ** auto-insert-mode new file templates | |||||
| 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. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (add-hook 'find-file-hooks 'auto-insert) | |||||
| (setq auto-insert-copyright (user-full-name)) | |||||
| #+END_SRC | |||||
| Create the *auto-insert-alist* so all the mode lists are the same | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (setq 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 <stdio.h>\n" | |||||
| "#include <stdlib.h>\n\n" | |||||
| "int main(int argc, char **argv) {\n" | |||||
| " return 0;\n" | |||||
| "}\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) | |||||
| ) | |||||
| #+END_SRC | |||||
| @@ -1,66 +1,25 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | ;;-*-mode: emacs-lisp; coding: utf-8;-*- | ||||
| ;; In case I screw up something later, debug stuff | |||||
| (setq debug-on-error t) | |||||
| ;; Simplify os detection a skosh | |||||
| (defvar mswindows-p (string-match "windows" (symbol-name system-type)) | |||||
| "Am I running under windows?") | |||||
| (defvar osx-p (string-match "darwin" (symbol-name system-type)) | |||||
| "Am I running under osx?") | |||||
| (defvar linux-p (string-match "gnu/linux" (symbol-name system-type)) | |||||
| "Am I running under linux?") | |||||
| ;; Yes, I miss perl chomp, sue me | |||||
| (defun chomp (str) | |||||
| "Chomp leading and trailing whitespace from STR." | |||||
| (let ((s (if (symbolp str) (symbol-name str) str))) | |||||
| (replace-regexp-in-string "\\(^[[:space:]\n]*\\|[[:space:]\n]*$\\)" "" s))) | |||||
| ;; I'm not about to redo logic to setup PATH in emacs that I have in | |||||
| ;; .profile/.*shrc crap. | |||||
| ;; So, just use whatever PATH had when we were run. | |||||
| (defun set-exec-path-from-shell-PATH () | |||||
| (let ((path-from-shell | |||||
| (shell-command-to-string "$SHELL -i -c 'echo $PATH'"))) | |||||
| (setenv "PATH" path-from-shell) | |||||
| (setq exec-path (split-string path-from-shell path-separator)))) | |||||
| ;; This is really only needed when the gui emacs runs. | |||||
| (if osx-p | |||||
| (set-exec-path-from-shell-PATH) | |||||
| ) | |||||
| ;; Base directory | |||||
| (defvar load-base "~/.emacs.d" "Where the emacs directory is kept") | |||||
| ;; Bootstrap load path | |||||
| (add-to-list 'load-path load-base) | |||||
| ;; Temp file dir (unixes) | |||||
| (setq temporary-file-directory "/tmp") | |||||
| ;; Set the default temp file dir for the current user based off username | |||||
| (defvar user-temporary-file-directory | |||||
| (format "%s/%s" temporary-file-directory user-login-name)) | |||||
| ;; mkdir for temporary-file-directory if needed | |||||
| (unless (file-accessible-directory-p user-temporary-file-directory) | |||||
| (make-directory user-temporary-file-directory t)) | |||||
| ;; Load up settings of things, in no particular order or anything | |||||
| (mapcar 'load-file (directory-files "~/.emacs.d/settings/" t ".*.el$")) | |||||
| ;; Setup/install third party packages using builtin package manager. | |||||
| (load "emacs-package") | |||||
| ;; Load up settings for things that el-get installed | |||||
| (mapcar 'load-file (directory-files "~/.emacs.d/package-settings/" t ".*.el$")) | |||||
| ;; Cleanup startup buffers | |||||
| (add-hook 'after-init-hook | |||||
| '(lambda () (load "after-init"))) | |||||
| ;; Fine, emacsclient -c and emacs --daemon don't mix well | |||||
| ;; From now on I start emacs as a gui and have this startup the daemon | |||||
| (load "server") | |||||
| (unless (server-running-p) (server-start)) | |||||
| ;; Shamelesly copied from https://github.com/correl/dotfiles | |||||
| ;; Bootstrap us into being able to use org for the initialization file. | |||||
| (require 'package) | |||||
| (package-initialize) | |||||
| (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) | |||||
| ;; Install use-package for later use and to install org mode. | |||||
| (unless (package-installed-p 'use-package) | |||||
| (progn | |||||
| (package-refresh-contents) | |||||
| (package-install 'use-package) | |||||
| (package-initialize))) | |||||
| (require 'use-package) | |||||
| ;; Somewhat needed so we can use org to manage things. | |||||
| (use-package org | |||||
| :ensure org-plus-contrib) | |||||
| (require 'org) | |||||
| (org-babel-load-file "~/.emacs.d/emacs.org") | |||||
| @@ -1,56 +0,0 @@ | |||||
| ;;; Clang-format emacs integration for use with C/Objective-C/C++. | |||||
| ;; This defines a function clang-format-region that you can bind to a key. | |||||
| ;; A minimal .emacs would contain: | |||||
| ;; | |||||
| ;; (load "<path-to-clang>/tools/clang-format/clang-format.el") | |||||
| ;; (global-set-key [C-M-tab] 'clang-format-region) | |||||
| ;; | |||||
| ;; Depending on your configuration and coding style, you might need to modify | |||||
| ;; 'style' in clang-format, below. | |||||
| (require 'json) | |||||
| ;; *Location of the clang-format binary. If it is on your PATH, a full path name | |||||
| ;; need not be specified. | |||||
| (defvar clang-format-binary "clang-format") | |||||
| (defun clang-format-region () | |||||
| "Use clang-format to format the currently active region." | |||||
| (interactive) | |||||
| (let ((beg (if mark-active | |||||
| (region-beginning) | |||||
| (min (line-beginning-position) (1- (point-max))))) | |||||
| (end (if mark-active | |||||
| (region-end) | |||||
| (line-end-position)))) | |||||
| (clang-format beg end))) | |||||
| (defun clang-format-buffer () | |||||
| "Use clang-format to format the current buffer." | |||||
| (interactive) | |||||
| (clang-format (point-min) (point-max))) | |||||
| (defun clang-format (begin end) | |||||
| "Use clang-format to format the code between BEGIN and END." | |||||
| (let* ((orig-windows (get-buffer-window-list (current-buffer))) | |||||
| (orig-window-starts (mapcar #'window-start orig-windows)) | |||||
| (orig-point (point)) | |||||
| (style "file")) | |||||
| (unwind-protect | |||||
| (call-process-region (point-min) (point-max) clang-format-binary | |||||
| t (list t nil) nil | |||||
| "-offset" (number-to-string (1- begin)) | |||||
| "-length" (number-to-string (- end begin)) | |||||
| "-cursor" (number-to-string (1- (point))) | |||||
| "-assume-filename" (buffer-file-name) | |||||
| "-style" style) | |||||
| (goto-char (point-min)) | |||||
| (let ((json-output (json-read-from-string | |||||
| (buffer-substring-no-properties | |||||
| (point-min) (line-beginning-position 2))))) | |||||
| (delete-region (point-min) (line-beginning-position 2)) | |||||
| (goto-char (1+ (cdr (assoc 'Cursor json-output)))) | |||||
| (dotimes (index (length orig-windows)) | |||||
| (set-window-start (nth index orig-windows) | |||||
| (nth index orig-window-starts))))))) | |||||
| @@ -1,7 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (auto-complete-mode) | |||||
| (whitespace-mode) | |||||
| (smartparens-mode) | |||||
| (visual-line-mode) | |||||
| (setq indent-tabs-mode nil) | |||||
| (setq tab-width 2) | |||||
| @@ -1,28 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (add-to-list 'auto-mode-alist '("\\.[chm]\\'" . c-mode)) | |||||
| (add-hook 'c-mode-common-hook | |||||
| '(lambda () | |||||
| (global-set-key "\C-x\C-m" 'compile) | |||||
| ;; c11 is best standard, silly c++11. | |||||
| (setq flycheck-clang-language-standard "c11") | |||||
| ;; Wait a bit for me to type things out guy. | |||||
| (setq flycheck-idle-change-delay 2) | |||||
| (setq flycheck-highlighting-mode 'symbols) | |||||
| (add-hook 'before-save-hook 'clang-format-buffer nil t) | |||||
| (auto-complete-mode) | |||||
| (whitespace-mode) | |||||
| (hl-line-mode) | |||||
| (visual-line-mode) | |||||
| (smartparens-mode) | |||||
| (flycheck-mode) | |||||
| (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) | |||||
| )) | |||||
| @@ -1,15 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (add-to-list 'auto-mode-alist '("\\.el" . emacs-lisp-mode)) | |||||
| (add-hook 'emacs-lisp-hook | |||||
| (lambda () | |||||
| (hl-line-mode) | |||||
| (whitespace-mode) | |||||
| (flycheck-mode) | |||||
| (setq-default tab-width 2) | |||||
| (setq-default indent-tabs-mode nil) | |||||
| (define-key emacs-lisp-map | |||||
| "\C-x\C-e" 'pp-eval-last-sexp) | |||||
| (define-key emacs-lisp-map | |||||
| "\r" 'reindent-then-newline-and-indent))) | |||||
| @@ -1,11 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (add-hook 'go-mode-hook '(lambda () | |||||
| (add-hook 'before-save-hook #'gofmt-before-save) | |||||
| (smartparens-mode) | |||||
| (auto-complete-mode) | |||||
| (hl-line-mode) | |||||
| (visual-line-mode) | |||||
| (whitespace-mode) | |||||
| (setq tab-width 8) | |||||
| )) | |||||
| @@ -1,89 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (custom-set-variables | |||||
| '(haskell-process-type 'ghci) | |||||
| '(haskell-process-args-ghci '()) | |||||
| '(haskell-notify-p t) | |||||
| '(haskell-stylish-on-save nil) | |||||
| '(haskell-tags-on-save t) | |||||
| '(haskell-process-suggest-remove-import-lines t) | |||||
| '(haskell-process-auto-import-loaded-modules t) | |||||
| '(haskell-process-log t) | |||||
| '(haskell-process-reload-with-fbytecode nil) | |||||
| '(haskell-process-use-presentation-mode t) | |||||
| '(haskell-interactive-mode-include-file-name nil) | |||||
| '(haskell-interactive-mode-eval-pretty nil) | |||||
| ;; '(shm-use-hdevtools t) | |||||
| ;; '(shm-use-presentation-mode t) | |||||
| ;; '(shm-auto-insert-skeletons t) | |||||
| ;; '(shm-auto-insert-bangs t) | |||||
| '(haskell-process-show-debug-tips nil) | |||||
| '(haskell-process-suggest-hoogle-imports nil) | |||||
| '(haskell-process-suggest-haskell-docs-imports t)) | |||||
| (setq haskell-complete-module-preferred | |||||
| '("Data.ByteString" | |||||
| "Data.ByteString.Lazy" | |||||
| "Data.Function" | |||||
| "Data.List" | |||||
| "Data.Map" | |||||
| "Data.Maybe" | |||||
| "Data.Monoid" | |||||
| "Data.Ord")) | |||||
| (autoload 'ghc-init "ghc" nil t) | |||||
| (autoload 'ghc-debug "ghc" nil t) | |||||
| (add-hook | |||||
| 'haskell-mode-hook | |||||
| '(lambda () | |||||
| (ghc-init) | |||||
| (setq haskell-interactive-mode-eval-mode 'haskell-mode) | |||||
| '(turn-on-haskell-indentation) | |||||
| (interactive-haskell-mode) | |||||
| (custom-set-variables | |||||
| '(haskell-process-suggest-remove-import-lines t) | |||||
| '(haskell-process-auto-import-loaded-modules t) | |||||
| '(haskell-process-log t) | |||||
| '(haskell-tags-on-save t) | |||||
| '(haskell-process-type 'cabal-repl) | |||||
| ) | |||||
| (define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload) | |||||
| (define-key haskell-mode-map (kbd "C-`") 'haskell-interactive-bring) | |||||
| (define-key haskell-mode-map (kbd "C-c C-n C-t") 'haskell-process-do-type) | |||||
| (define-key haskell-mode-map (kbd "C-c C-n C-i") 'haskell-process-do-info) | |||||
| (define-key haskell-mode-map (kbd "C-c C-n C-c") 'haskell-process-cabal-build) | |||||
| (define-key haskell-mode-map (kbd "C-c C-n c") 'haskell-process-cabal) | |||||
| (define-key haskell-mode-map (kbd "SPC") 'haskell-mode-contextual-space) | |||||
| (define-key haskell-mode-map (kbd "M-.") 'haskell-mode-jump-to-def-or-tag) | |||||
| (define-key haskell-mode-map [f8] 'haskell-navigate-imports) | |||||
| ) | |||||
| ) | |||||
| (add-hook 'cabal-mode-hook (lambda () | |||||
| (define-key haskell-cabal-mode-map (kbd "C-`") 'haskell-interactive-bring) | |||||
| (define-key haskell-cabal-mode-map (kbd "C-c C-k") 'haskell-interactive-ode-clear) | |||||
| (define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build) | |||||
| (define-key haskell-cabal-mode-map (kbd "C-c c") 'haskell-process-cabal))) | |||||
| ;; (stylish-haskell-mode) | |||||
| ;; (define-key haskell-mode-map | |||||
| ;; (kbd "C-x C-s") 'haskell-mode-save-buffer) | |||||
| ;; (add-to-list 'align-rules-list | |||||
| ;; '(haskell-types | |||||
| ;; (regexp . "\\(\\s-+\\)\\(::\\|∷\\)\\s-+") | |||||
| ;; (modes quote (haskell-mode literate-haskell-mode)))) | |||||
| ;; (add-to-list 'align-rules-list | |||||
| ;; '(haskell-assignment | |||||
| ;; (regexp . "\\(\\s-+\\)=\\s-+") | |||||
| ;; (modes quote (haskell-mode literate-haskell-mode)))) | |||||
| ;; (add-to-list 'align-rules-list | |||||
| ;; '(haskell-arrows | |||||
| ;; (regexp . "\\(\\s-+\\)\\(->\\|→\\)\\s-+") | |||||
| ;; (modes quote (haskell-mode literate-haskell-mode)))) | |||||
| ;; (add-to-list 'align-rules-list | |||||
| ;; '(haskell-left-arrows | |||||
| ;; (regexp . "\\(\\s-+\\)\\(<-\\|←\\)\\s-+") | |||||
| ;; (modes quote (haskell-mode literate-haskell-mode)))) | |||||
| ;; )) | |||||
| ;; MOVE ME | |||||
| (global-set-key (kbd "C-x a r") 'align-regexp) | |||||
| @@ -1,14 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (autoload 'makefile-mode "makefile-mode" "mode for makefile stuff" t) | |||||
| (add-to-list 'auto-mode-alist '("\\.[Mm]akefile\\'" . makefile-mode)) | |||||
| (add-to-list 'auto-mode-alist '("\\.GNUMakefile\\'" . makefile-mode)) | |||||
| (add-hook 'makefile-mode-hook | |||||
| '(lambda () | |||||
| (hl-line-mode) | |||||
| (smartparens-mode) | |||||
| (whitespace-mode) | |||||
| (visual-line-mode) | |||||
| (setq tab-width 4))) | |||||
| @@ -1,14 +0,0 @@ | |||||
| ;;-*-mode: Emacs-Lisp; coding: utf-8;-*- | |||||
| (add-to-list 'auto-mode-alist '("\\.org\>" . org-mode)) | |||||
| (add-hook 'org-mode-hook | |||||
| (lambda () | |||||
| (ispell-minor-mode) | |||||
| (visual-line-mode) | |||||
| (hl-line-mode) | |||||
| (delete '("\\.pdf\\'" . default) org-file-apps) | |||||
| (if osx-p | |||||
| (add-to-list 'org-file-apps '("\\.pdf\\'" . "open %s")) | |||||
| (add-to-list 'org-file-apps '("\\.pdf\\'" . "evince %s"))) | |||||
| )) | |||||
| @@ -1,12 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (autoload 'cperl-mode "cperl-mode" "mode for perl scripts" t) | |||||
| (add-to-list 'auto-mode-alist '("\\.[Pp][LlMm]\\'" . cperl-mode)) | |||||
| (add-hook 'cperl-mode-hook | |||||
| '(lambda () | |||||
| (load "mode-defaults") | |||||
| (smartparens-mode) | |||||
| (flycheck-mode) | |||||
| )) | |||||
| @@ -1,9 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (add-hook 'python-mode-hook | |||||
| '(lambda () | |||||
| (load "mode-defaults") | |||||
| (smartparens-mode) | |||||
| (flycheck-mode) | |||||
| (flycheck-select-checker 'python-flake8) | |||||
| )) | |||||
| @@ -1,18 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (autoload 'ruby-mode "ruby-mode" "mode for Ruby formatted stuff" t) | |||||
| (add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode)) | |||||
| (add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode)) | |||||
| (add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode)) | |||||
| (add-to-list 'auto-mode-alist '("Gemfile\\'" . ruby-mode)) | |||||
| (add-to-list 'auto-mode-alist '("Rakefile\\'" . ruby-mode)) | |||||
| (add-to-list 'auto-mode-alist '("Vagrantfile\\'" . ruby-mode)) | |||||
| (add-hook 'ruby-mode-hook | |||||
| '(lambda () | |||||
| (load "mode-defaults") | |||||
| (smartparens-mode) | |||||
| (ruby-end-mode) | |||||
| (flycheck-mode) | |||||
| )) | |||||
| @@ -1,33 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (add-hook 'rust-mode-hook '(lambda () (interactive) (column-marker-1 80))) | |||||
| (add-hook 'rust-mode-hook '(lambda () | |||||
| (smartparens-mode) | |||||
| (auto-complete-mode) | |||||
| (hl-line-mode) | |||||
| (visual-line-mode) | |||||
| (whitespace-mode) | |||||
| (setq tab-width 8) | |||||
| (flycheck-mode) | |||||
| )) | |||||
| (defun rust-run-current-buffers-file () | |||||
| "run a command on the current file" | |||||
| (interactive) | |||||
| (shell-command | |||||
| (format "rust run %s 2>&1 | grep -v 'no debug symbols in executable'" | |||||
| (shell-quote-argument (buffer-file-name)))) | |||||
| ) | |||||
| (defun rust-test-current-buffers-file () | |||||
| "run a command on the current file" | |||||
| (interactive) | |||||
| (shell-command | |||||
| (format "rust test %s 2>&1 | grep -v 'no debug symbols in executable'" | |||||
| (shell-quote-argument (buffer-file-name)))) | |||||
| ) | |||||
| (eval-after-load 'rust-mode | |||||
| '(define-key rust-mode-map (kbd "C-c C-r") 'rust-run-current-buffers-file)) | |||||
| (eval-after-load 'rust-mode | |||||
| '(define-key rust-mode-map (kbd "C-S-t") 'rust-test-current-buffers-file)) | |||||
| @@ -1,18 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (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-hook 'sh-mode-hook | |||||
| '(lambda () | |||||
| (load "mode-defaults") | |||||
| (smartparens-mode) | |||||
| (flycheck-mode) | |||||
| (setq-default indent-tabs-mode nil) | |||||
| (setq sh-basic-offset 2 sh-indentation 4 | |||||
| sh-indent-for-case-label 0 sh-indent-for-case-alt '+))) | |||||
| @@ -1,5 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; autopair, its awesome for non lisps and ()'s []'s etc... | |||||
| (require 'autopair nil 'noerror) | |||||
| (setq autopair-blink 'nil) | |||||
| @@ -1,21 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; use gtk-ide for my color theme, solarized has... issues. | |||||
| ;; aka with it setup, even from latest git source, it seems to crash | |||||
| ;; connections with emacsclient due to some face issue. | |||||
| ;; so eff it, ignore the thing. TODO: find out how/why | |||||
| ;; emacs segv's on linux/osx with it on, but i'm lazy prolly won't | |||||
| (color-theme-initialize) | |||||
| (if (or window-system osx-p) | |||||
| (color-theme-gtk-ide) | |||||
| (color-theme-hober)) | |||||
| (unless (or window-system osx-p) | |||||
| (color-theme-install-frame-params | |||||
| '((background-color . "white")))) | |||||
| ;; fixup multi-term fg/bg color support as it doesn't always | |||||
| ;; pickup defaults | |||||
| (setq term-default-bg-color (face-background 'default)) | |||||
| (setq term-default-fg-color (face-foreground 'default)) | |||||
| @@ -1,4 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; expand region is awesome for selecting ever increasing regions. | |||||
| (global-set-key (kbd "C-]") 'er/expand-region) | |||||
| @@ -1,26 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; flymake is old, lets use something better. | |||||
| (setq flycheck-indication-mode 'right-fringe) | |||||
| ;; Test out grizzl for completions. | |||||
| ;;(setq flycheck-select-checker 'grizzl) | |||||
| ;; Make flycheck able to parse CFLAGS from pkg-config | |||||
| (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."))) | |||||
| @@ -1,4 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; make magit mode simpler to use | |||||
| (global-set-key (kbd "C-x m") 'magit-status) | |||||
| @@ -1,2 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (move-text-default-bindings) | |||||
| @@ -1,26 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; multi-term only on non-windows, stupid windows command line | |||||
| (unless mswindows-p | |||||
| ;; multi-term setup | |||||
| (autoload 'multi-term "multi-term" nil t) | |||||
| (autoload 'multi-term-next "multi-term" nil t) | |||||
| ;; fuck you audible beeps | |||||
| (setq ring-bell-function (lambda () (message "*beep beep imma jeep*"))) | |||||
| ;; try and use zsh when we can, cause bourne/bourne-again are the suck | |||||
| (setq multi-term-program (cond | |||||
| ((file-exists-p "/bin/zsh") "/bin/zsh") | |||||
| ((file-exists-p "/usr/bin/zsh") "/usr/bin/zsh") | |||||
| ((t) "/bin/sh");; fine use whatever the hell /bin/sh is | |||||
| )) | |||||
| ;; allow switching to the next terminal in line | |||||
| (global-set-key (kbd "C-c C-t") 'multi-term-next) | |||||
| ;; zomg annoying, term-unbind-key-list is what it unbinds, not what you want | |||||
| ;; to unbind. bit of a logic weirdout in my mind. | |||||
| ;; aka, what is in the term-unbind-key-list is what you can type to the terminal | |||||
| (setq term-unbind-key-list '("C-x" "C-y" "M-x")) | |||||
| ) | |||||
| @@ -1,12 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (require 'org-install) | |||||
| (add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) | |||||
| (define-key global-map "\C-ca" 'org-agenda) | |||||
| (define-key global-map "\C-cb" 'org-iswitchb) | |||||
| (define-key global-map "\C-cc" 'org-capture) | |||||
| (define-key global-map "\C-cl" 'org-store-link) | |||||
| (define-key global-map "\C-cp" 'org-latex-export-to-pdf) | |||||
| (setq org-log-done t) | |||||
| @@ -1,5 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; setup uniquify for buffer names | |||||
| (require 'uniquify) | |||||
| (setq uniquify-buffer-name-style 'post-forward) | |||||
| @@ -1,11 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (when osx-p | |||||
| (setq exec-path | |||||
| (append exec-path | |||||
| '("/Users/mitch/homebrew/Cellar/llvm/3.4/bin")))) | |||||
| (when linux-p | |||||
| (setq exec-path (append '("/home/mitch/local/bin") exec-path))) | |||||
| (load "~/.emacs.d/misc/clang-format.el") | |||||
| (global-set-key [C-M-tab] 'clang-format-region) | |||||
| @@ -1,9 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; Get rid of all of the stupid "look here's emacs" kthxbai | |||||
| (setq inhibit-startup-message t) | |||||
| (setq inhibit-startup-screen t) | |||||
| (setq inhibit-startup-echo-area-message t) | |||||
| ;; Update non-edited files changed on disk automatically | |||||
| (setq global-auto-revert-mode t) | |||||
| @@ -1,18 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; desktop saving for session sanity, add a hook into auto-save-hook | |||||
| ;; to save it at logical times | |||||
| (require 'desktop) | |||||
| (desktop-save-mode 1) | |||||
| (setq desktop-path '("~/.emacs.d/")) | |||||
| (setq desktop-dirname "~/.emacs.d") | |||||
| (setq desktop-base-file-name ".emacs.desktop") | |||||
| (defun local-desktop-save () | |||||
| (interactive) | |||||
| (if (eq (desktop-owner) (emacs-pid)) | |||||
| (desktop-save desktop-dirname))) | |||||
| (add-hook 'auto-save-hook 'desktop-save-in-desktop-dir) | |||||
| @@ -1,2 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (add-hook 'dired-load-hook (function (lambda () (load "dired-x")))) | |||||
| @@ -1,25 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; if I selected it, deleting it is OK kthxbai | |||||
| (delete-selection-mode 1) | |||||
| ;; be more like vi, display line/col always | |||||
| (custom-set-variables '(line-number-mode t)) | |||||
| (custom-set-variables '(column-number-mode t)) | |||||
| ;; 80 char lines not 72 | |||||
| (custom-set-variables '(fill-column 80)) | |||||
| ;; ok, double spacing after a period for sentences | |||||
| ;; is fucking archaic, we don't use typewriters any longer | |||||
| (set-default 'sentence-end-double-space nil) | |||||
| ;; What emacs thinks a sentence ending is, make it less derp. | |||||
| (custom-set-variables '(sentence-end "[.?!][]\"')]*\\($\\|\t\\| \\)[ \t\n]*")) | |||||
| (custom-set-variables '(sentence-end-double-space nil)) | |||||
| ;; Tabs suck, no | |||||
| (custom-set-variables '(default-tab-width 2)) | |||||
| ;; Always remove trailing whitespace | |||||
| (add-hook 'before-save-hook 'delete-trailing-whitespace) | |||||
| @@ -1,4 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (setq ediff-window-setup-function 'ediff-setup-windows-plain) | |||||
| (setq ediff-split-window-function 'split-window-horizontally) | |||||
| @@ -1,8 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; utf8 by default | |||||
| (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) | |||||
| @@ -1,45 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; Default file template definitions | |||||
| (add-hook 'find-file-hooks 'maybe-load-template) | |||||
| (setq template-file-prefix (concat (getenv "HOME") "/.emacs.d/templates")) | |||||
| (defun maybe-load-template () | |||||
| (interactive) | |||||
| (when (and | |||||
| (string-match "\\.rb$" (buffer-file-name)) | |||||
| (eq 1 (point-max))) | |||||
| (insert-file (concat template-file-prefix "/ruby.rb")) | |||||
| (ruby-mode)) | |||||
| (when (and | |||||
| (string-match "\\.sh$" (buffer-file-name)) | |||||
| (eq 1 (point-max))) | |||||
| (insert-file (concat template-file-prefix "/shell.sh")) | |||||
| (sh-mode)) | |||||
| (when (and | |||||
| (string-match "\\.ksh$" (buffer-file-name)) | |||||
| (eq 1 (point-max))) | |||||
| (insert-file (concat template-file-prefix "/shell.ksh")) | |||||
| (sh-mode)) | |||||
| (when (and | |||||
| (string-match "\\.pl$" (buffer-file-name)) | |||||
| (eq 1 (point-max))) | |||||
| (insert-file (concat template-file-prefix "/perl.pl")) | |||||
| (perl-mode)) | |||||
| (when (and | |||||
| (string-match "\\.py$" (buffer-file-name)) | |||||
| (eq 1 (point-max))) | |||||
| (insert-file (concat template-file-prefix "/python.py")) | |||||
| (python-mode)) | |||||
| (when (and | |||||
| (string-match "\\.pm$" (buffer-file-name)) | |||||
| (eq 1 (point-max))) | |||||
| (insert-file (concat template-file-prefix "/perl-module.pm")) | |||||
| (perl-mode)) | |||||
| (when (and | |||||
| (string-match "\\.el$" (buffer-file-name)) | |||||
| (eq 1 (point-max))) | |||||
| (insert-file (concat template-file-prefix "/elisp.el")) | |||||
| (emacs-lisp-mode)) | |||||
| ) | |||||
| @@ -1,21 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (when window-system | |||||
| (require 'cl) | |||||
| (defun font-candidate (&rest fonts) | |||||
| "Return first font that matches list of provided fonts." | |||||
| (find-if (lambda (f) (find-font (font-spec :name f))) fonts)) | |||||
| ;; Try out these fonts in order of preference depending on install status. | |||||
| (set-face-attribute 'default nil :font | |||||
| (font-candidate '"Source Code Pro-14:weight=normal" | |||||
| "Menlo-12:weight=normal" | |||||
| "Monaco-12:weight=normal")) | |||||
| (cond (linux-p | |||||
| (setq interprogram-paste-function 'x-cut-buffer-or-selection-value) | |||||
| (setq x-select-enable-clipboard t) | |||||
| ) | |||||
| ) | |||||
| ) | |||||
| @@ -1,16 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; show what is being typed quicker | |||||
| (custom-set-variables '(echo-keystrokes 0.1)) | |||||
| ;; Let shift+arrow keys change panes | |||||
| (require 'windmove) | |||||
| (windmove-default-keybindings) | |||||
| ;; Ok, so make it possible to use option+char on osx to type accented | |||||
| ;; chars in cocoa emacs. | |||||
| ;; Also makes command is meta. | |||||
| (when window-system | |||||
| (cond (osx-p | |||||
| (setq mac-option-modifier 'none) | |||||
| (setq mac-command-modifier 'meta)))) | |||||
| @@ -1,9 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (when window-system | |||||
| (tool-bar-mode -1)) | |||||
| (when window-system | |||||
| (scroll-bar-mode -1)) | |||||
| (menu-bar-mode -1) | |||||
| @@ -1,33 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; use incremental complete mode for the minibuffer | |||||
| (icomplete-mode) | |||||
| ;; highlight parens n stuff | |||||
| (show-paren-mode) | |||||
| ;; y/n is good enough | |||||
| (defalias 'yes-or-no-p 'y-or-n-p) | |||||
| ;; Default major mode is just text | |||||
| (custom-set-variables '(default-major-mode 'text-mode)) | |||||
| ;; Don't clobber minibuffer text | |||||
| (custom-set-variables '(help-at-pt-timer-delay 0.9)) | |||||
| ;; Auto chmod u+x on scripts, because why wouldn't you? | |||||
| (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) | |||||
| ;; Ok backup files are annoying | |||||
| (setq make-backup-files nil) | |||||
| (setq auto-save-default nil) | |||||
| ;; What to do with backup crap/autosave files | |||||
| (setq backup-by-copying t) | |||||
| (setq backup-directory-alist | |||||
| `((".*" . ,user-temporary-file-directory) | |||||
| (,tramp-file-name-regexp nil))) | |||||
| (setq auto-save-list-file-prefix | |||||
| (concat user-temporary-file-directory ".auto-saves-")) | |||||
| (setq auto-save-file-name-transforms | |||||
| `((".*" ,user-temporary-file-directory t))) | |||||
| @@ -1,33 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (custom-set-variables '(mode-line-format | |||||
| (list | |||||
| '(:eval (propertize "%b " 'face 'font-lock-keyword-face | |||||
| 'help-echo (buffer-file-name))) | |||||
| (propertize "%02l" 'face 'font-lock-type-face) "," | |||||
| (propertize "%02c" 'face 'font-lock-type-face) | |||||
| " [" | |||||
| '(:eval (propertize "%m" 'face 'font-lock-string-face | |||||
| 'help-echo buffer-file-coding-system)) | |||||
| minor-mode-alist | |||||
| "] " | |||||
| "[" | |||||
| '(:eval (propertize (if overwrite-mode "Ovr" "Ins") | |||||
| 'face 'font-lock-preprocessor-face | |||||
| 'help-echo (concat "Buffer is in " | |||||
| (if overwrite-mode "overwrite" "insert") " mode"))) | |||||
| '(:eval (when (buffer-modified-p) | |||||
| (concat "," (propertize "Mod" | |||||
| 'face 'font-lock-warning-face | |||||
| 'help-echo "Buffer has been modified")))) | |||||
| '(:eval (when buffer-read-only | |||||
| (concat "," (propertize "RO" | |||||
| 'face 'font-lock-type-face | |||||
| 'help-echo "Buffer is read-only")))) "] " | |||||
| '(:eval (propertize (format-time-string "%H:%M:%S") | |||||
| 'help-echo | |||||
| (concat (format-time-string "%c; ") | |||||
| (emacs-uptime "Uptime:%hh")))) | |||||
| " --" | |||||
| "%-" | |||||
| ))) | |||||
| @@ -1,4 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; Load/setup mode hook file(s) in ~/modes | |||||
| (mapcar 'load-file (directory-files "~/.emacs.d/modes" t ".*.el$")) | |||||
| @@ -1,9 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (unless window-system | |||||
| (require 'mouse) | |||||
| (xterm-mouse-mode t) | |||||
| (defun track-mouse (e)) | |||||
| (setq mouse-sel-mode t) | |||||
| (global-set-key [mouse-5] '(lambda () (interactive) (scroll-up 1))) | |||||
| (global-set-key [mouse-4] '(lambda () (interactive) (scroll-down 1)))) | |||||
| @@ -1,5 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| (require 'recentf) | |||||
| (recentf-mode 1) | |||||
| (setq recentf-max-menu-items 25) | |||||
| (global-set-key "\C-x\ \C-r" 'recentf-open-files) | |||||
| @@ -1,11 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; I only want the time in my modeline, not system load | |||||
| ;; %T is HH:MM:SS basically | |||||
| ;; Also update every 5 seconds instead of 60 | |||||
| (custom-set-variables '(display-time-default-load-average nil)) | |||||
| (custom-set-variables '(display-time-format "%T")) | |||||
| (custom-set-variables '(display-time-interval 5)) | |||||
| ;; Set the time in the mode line | |||||
| (display-time-mode) | |||||
| @@ -1,27 +0,0 @@ | |||||
| ;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ; Tramp mode setup | |||||
| (require 'tramp) | |||||
| ; Make the default proxy list sane(r) | |||||
| (set-default 'tramp-default-proxies-alist | |||||
| (quote ((".*" "\\`root\\'" "/ssh:%h:")))) | |||||
| ; Since work sudo only allows for su with sudo. | |||||
| ; We add a new 'susudo' method that uses | |||||
| ; sudo args USER su -c 'command you wanted to run' | |||||
| ; instead of sudo command | |||||
| ; gay but pci "security" can be pretty dumb | |||||
| (add-to-list 'tramp-methods | |||||
| '("susudo" | |||||
| (tramp-login-program "sudo") | |||||
| (tramp-login-args | |||||
| (("-u" "%u") | |||||
| ("-H") | |||||
| ("-p" "Password:") | |||||
| ("su -c /bin/sh"))) | |||||
| (tramp-remote-sh "/bin/sh") | |||||
| (tramp-copy-program nil) | |||||
| (tramp-copy-args nil) | |||||
| (tramp-copy-keep-date nil) | |||||
| (tramp-password-end-of-line nil))) | |||||
| @@ -1,14 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| ;; Setup whitespace mode to highlight tabs and over 80 char spaces | |||||
| (require 'whitespace) | |||||
| (setq whitespace-style '(face tabs trailing)) | |||||
| (set-face-attribute 'whitespace-tab nil | |||||
| :foreground "#2075c7" | |||||
| :background "lightgrey") | |||||
| (set-face-attribute 'whitespace-line nil | |||||
| :foreground "#2075c7" | |||||
| :background "lightgrey") | |||||
| @@ -1 +0,0 @@ | |||||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||||
| @@ -1,18 +0,0 @@ | |||||
| #-*-mode: Perl; coding: utf-8;-*- | |||||
| package MyModule; | |||||
| use strict; | |||||
| use Exporter; | |||||
| use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); | |||||
| $VERSION = 1.00; | |||||
| @ISA = qw(Exporter); | |||||
| @EXPORT = (); | |||||
| @EXPORT_OK = qw(func1 func2); | |||||
| %EXPORT_TAGS = ( DEFAULT => [qw(&func1)], | |||||
| Both => [qw(&func1 &func2)]); | |||||
| sub func1 { return reverse @_ } | |||||
| sub func2 { return map{ uc }@_ } | |||||
| 1; | |||||
| @@ -1,3 +0,0 @@ | |||||
| #!/usr/bin/env perl | |||||
| #-*-mode: Perl; coding: utf-8;-*- | |||||
| @@ -1,3 +0,0 @@ | |||||
| #!/usr/bin/env python | |||||
| # -*-mode: Python; coding: utf-8;-*- | |||||
| @@ -1,3 +0,0 @@ | |||||
| #!/usr/bin/env ruby | |||||
| #-*-mode: Ruby; coding: utf-8;-*- | |||||
| @@ -1,5 +0,0 @@ | |||||
| #!/usr/bin/env ksh | |||||
| #-*-mode: Shell-script; coding: utf-8;-*- | |||||
| script=$(basename $0) | |||||
| dir=$(cd $(dirname $0); pwd) | |||||
| iam=${dir}/${script} | |||||
| @@ -1,5 +0,0 @@ | |||||
| #!/usr/bin/env sh | |||||
| #-*-mode: Shell-script; coding: utf-8;-*- | |||||
| script=$(basename $0) | |||||
| dir=$(cd $(dirname $0); pwd) | |||||
| iam=${dir}/${script} | |||||
| @@ -1,5 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: assert(...); | |||||
| # key: assert/ | |||||
| # -- | |||||
| assert(${1:0 == 1}); | |||||
| @@ -1,5 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: {...} *... = ({...}[]){...}; | |||||
| # key: literal/ | |||||
| # -- | |||||
| ${1:double} *${2:name} = ($1[]){${3:1.1, NAN}}; | |||||
| @@ -1,10 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: doxygen comment | |||||
| # key: dox/ | |||||
| # -- | |||||
| /** | |||||
| \brief ${1:brief comment} | |||||
| ${0:long explanation of boring} | |||||
| \param ${3:param1}, ${4:value} | |||||
| \returns ${5:returns whatever} | |||||
| */ | |||||
| @@ -1,7 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: typedef enum { ... } ...; | |||||
| # key: enum/ | |||||
| # -- | |||||
| typedef enum { | |||||
| ${0:values_and_such} | |||||
| } ${1:name}_t; | |||||
| @@ -1,7 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: for (...; ...; ...) { ... } | |||||
| # key: for/ | |||||
| # -- | |||||
| for (${1:int i = 0}; ${2:i < N}; ${3:i++}){ | |||||
| ${0:0 == 0;} | |||||
| } | |||||
| @@ -1,6 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: for (...; ...; ...) ... | |||||
| # key: for/ | |||||
| # -- | |||||
| for (${1:int i = 0}; ${2:i < N}; ${3:i++}) | |||||
| ${0:0 == 0;} | |||||
| @@ -1,5 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: free(...); | |||||
| # key: free/ | |||||
| # -- | |||||
| free(${1:stuff}); | |||||
| @@ -1,8 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: insert a function | |||||
| # key: fn/ | |||||
| # -- | |||||
| ${1:void} ${2:function_name}(${3:args}) { | |||||
| $0 | |||||
| return ${4:NULL}; | |||||
| } | |||||
| @@ -1,5 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: insert a function prototype | |||||
| # key: fnp/ | |||||
| # -- | |||||
| ${1:void} ${2:function_name}(${3:args}); | |||||
| @@ -1,9 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: insert a function with prototype | |||||
| # key: func/ | |||||
| # -- | |||||
| ${1:void} ${2:function_name}(${3:args}); | |||||
| $1 $2($3){ | |||||
| $0 | |||||
| return ${4:NULL}; | |||||
| } | |||||
| @@ -1,8 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: #ifndef XXX; #define XXX; #endif | |||||
| # key: guard/ | |||||
| # -- | |||||
| #ifndef ${1:_`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H_} | |||||
| #define $1 | |||||
| ${0:some_header_guarded_stuff} | |||||
| #endif /* $1 */ | |||||
| @@ -1,7 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: #ifdef ...; ...; #endif | |||||
| # key: ifdef/ | |||||
| # -- | |||||
| #ifdef ${1:somedef} | |||||
| ${0:somedef_guarded_junk} | |||||
| #endif | |||||
| @@ -1,5 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: #include "...\.h" | |||||
| # key: inc/ | |||||
| # -- | |||||
| #include "${1:someuserheader}.h" | |||||
| @@ -1,5 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: #include <...\.h> | |||||
| # key: inc/ | |||||
| # -- | |||||
| #include <${1:somesystemheader}.h> | |||||
| @@ -1,7 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: int main(argc, argv) { ... } | |||||
| # key: main/ | |||||
| # -- | |||||
| int main(int argc, char *argv[]) { | |||||
| $0 | |||||
| } | |||||
| @@ -1,7 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: int main(void) { ... } | |||||
| # key: main/ | |||||
| # -- | |||||
| int main(void) { | |||||
| $0 | |||||
| } | |||||
| @@ -1,5 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: malloc(...); | |||||
| # key: malloc/ | |||||
| # -- | |||||
| malloc(${1:stuff}); | |||||
| @@ -1,12 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: insert clang pragma to ignore some warning | |||||
| # key: cprag/ | |||||
| # -- | |||||
| #ifdef __clang__ | |||||
| #pragma clang diagnostic push | |||||
| #pragma clang diagnostic ignored "-W${1:somewarning}" | |||||
| #endif | |||||
| ${0:some_evil_codez} | |||||
| #ifdef __clang__ | |||||
| #pragma clang diagnostic pop | |||||
| #endif | |||||
| @@ -1,12 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: insert gcc pragma to ignore some warning | |||||
| # key: gprag/ | |||||
| # -- | |||||
| #ifdef __GNUC__ | |||||
| #pragma GCC diagnostic push | |||||
| #pragma GCC diagnostic ignored "-W${1:somewarning}" | |||||
| #endif | |||||
| ${0:some_evil_codez} | |||||
| #ifdef __GNUC__ | |||||
| #pragma GCC diagnostic pop | |||||
| #endif | |||||
| @@ -1,7 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: printf | |||||
| # contributor: joaotavora | |||||
| # key: printf/ | |||||
| # -- | |||||
| printf("${1:%s}\\n"${1:$(if (string-match "%" yas-text) "," "\);") | |||||
| }$2${1:$(if (string-match "%" yas-text) "\);" "")} | |||||
| @@ -1,5 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: puts(...); | |||||
| # key: puts/ | |||||
| # -- | |||||
| puts(${1:stuff}); | |||||
| @@ -1,5 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: static const ... ... = ...; | |||||
| # key: sconst/ | |||||
| # -- | |||||
| static const ${1:int} ${2:FOO} = 1; | |||||
| @@ -1,7 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: struct ... { ... } | |||||
| # key: struct/ | |||||
| # -- | |||||
| typedef struct { | |||||
| ${0:some_struct_stuffs} | |||||
| } ${1:name}_s; | |||||
| @@ -1,11 +0,0 @@ | |||||
| #-*- mode: snippet; coding: utf-8 -*- | |||||
| # name: switch(...) {case ... : ... break; default : ...} | |||||
| # key: switch/ | |||||
| # -- | |||||
| switch (${1:something}){ | |||||
| case ${2:constant_expression} : | |||||
| ${0:fill_me_in_dork} | |||||
| break; | |||||
| default : | |||||
| ${3:default_thing_to_do} | |||||
| } | |||||