Permalink
Browse files

init import

  • Loading branch information...
0 parents commit a16e888c7671efa32f6ae0003c5ac0a8b50335f0 @tavisrudd committed Apr 23, 2010
Showing 356 changed files with 96,184 additions and 0 deletions.
@@ -0,0 +1,2 @@
+^.*\.elc$
+^tavis/.*$
Oops, something went wrong.
@@ -0,0 +1,14 @@
+This is my personal .emacs.d configuration. Feel free to clone it or
+copy anything you like. Everything in the top directory is licensed
+under the GPL v3 (see the COPYING file).
+
+I've structured this as Phil Hagelberg did in the "Emacs Starter Kit"
+(http://github.com/technomancy/emacs-starter-kit). I've stolen ideas
+and code from many people on http://www.emacswiki.org/ and elsewhere.
+I've tried to include attribution wherever I remember the origin of
+stuff, but apologize in advance if I've missed someone.
+
+The 'dss' prefix stands for 'Damn Simple Solutions', my
+company name.
+
+See "requirements.txt".
@@ -0,0 +1,19 @@
+;; http://www.emacswiki.org/emacs/RecursiveEditPreservingWindowConfig
+;; inspired by Erik Naggum's `recursive-edit-with-single-window'
+(defmacro recursive-edit-preserving-window-config (body)
+ "*Return a command that enters a recursive edit after executing BODY.
+ Upon exiting the recursive edit (with\\[exit-recursive-edit] (exit)
+ or \\[abort-recursive-edit] (abort)), restore window configuration
+ in current frame."
+ `(lambda ()
+ "See the documentation for `recursive-edit-preserving-window-config'."
+ (interactive)
+ (save-window-excursion
+ ,body
+ (recursive-edit))))
+
+(global-set-key (kbd "C-c 0") (recursive-edit-preserving-window-config (delete-window)))
+(global-set-key (kbd "C-c 1") (recursive-edit-preserving-window-config
+ (if (one-window-p 'ignore-minibuffer)
+ (error "Current window is the only window in its frame")
+ (delete-other-windows))))
@@ -0,0 +1,26 @@
+;;; cheetah-mode.el -- A derivation of nxml-mode for Cheetah .tmpl files
+
+;(define-derived-mode cheetah-mode html-mode "Cheetah"
+(define-derived-mode cheetah-mode nxml-mode "Cheetah"
+ (make-face 'cheetah-variable-face)
+ (font-lock-add-keywords
+ nil
+ '(
+ ("\\(#\\(from\\|else\\|include\\|extends\\|set\\|def\\|import\\|for\\|if\\|end\\)+\\)\\>" 1 font-lock-type-face)
+ ("\\(#\\(from\\|for\\|end\\)\\).*\\<\\(for\\|import\\|def\\|if\\|in\\)\\>" 3 font-lock-type-face)
+ ("\\(##.*\\)\n" 1 font-lock-comment-face)
+ ("\\(\\$\\(?:\\sw\\|}\\|{\\|\\s_\\)+\\)" 1 font-lock-variable-name-face))
+ )
+ (font-lock-mode 1)
+ )
+;(mapc (lambda (list)
+; (mapc (lambda (pair)
+; (if (or (eq (cdr pair) 'html-mode)
+; (eq (cdr pair) 'cheetah-mode)
+; (eq (cdr pair) 'php-mode))
+; (setcdr pair (lambda ()
+; (require 'nxhtml-mode "/site-lisp/nxhtml/autostart")
+; (nxhtml-mumamo-mode)))))
+; list))
+; (list auto-mode-alist magic-mode-alist))
+(provide 'cheetah-mode)
@@ -0,0 +1,9 @@
+(custom-set-variables
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(ecb-options-version "2.40")
+ '(ecb-vc-supported-backends (quote ((ecb-vc-dir-managed-by-CVS . ecb-vc-state) (ecb-vc-dir-managed-by-RCS . ecb-vc-state) (ecb-vc-dir-managed-by-SCCS . ecb-vc-state) (ecb-vc-dir-managed-by-SVN . ecb-vc-state) (ecb-vc-dir-managed-by-GIT . ecb-vc-state) (ecb-vc-dir-managed-by-MTN . ecb-vc-state) (ecb-vc-dir-managed-by-HG . ecb-vc-state))))
+ '(org-agenda-files (quote ("~/org_mode/haskell.org" "~/org_mode/ccl.org" "~/org_mode/mandarin.org" "~/org_mode/personal.org" "~/org_mode/meta.org" "~/org_mode/dss.org" "~/org_mode/refile.org" "~/org_mode/dentalle.org" "~/org_mode/pw.org")))
+ )
@@ -0,0 +1,15 @@
+;;; cython-mode.el -- A derivation of python-mode for Cython .pyx and .pxd files
+
+(require 'python-mode)
+(define-derived-mode cython-mode python-mode "Cython"
+ (font-lock-add-keywords
+ nil
+ `((,(concat "\\<\\(NULL"
+ "\\|c\\(def\\|har\\|typedef\\)"
+ "\\|e\\(num\\|xtern\\)"
+ "\\|float"
+ "\\|in\\(clude\\|t\\)"
+ "\\|object\\|public\\|struct\\|type\\|union\\|void"
+ "\\)\\>")
+ 1 font-lock-keyword-face t))))
+(provide 'cython-mode)
@@ -0,0 +1,51 @@
+(fset 'yes-or-no-p 'y-or-n-p) ; less typing
+
+;; encoding
+(setq 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)
+
+;; visual frame / modeline settings
+(setq inhibit-startup-echo-area-message t)
+(setq inhibit-startup-screen t)
+(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
+(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
+(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
+(setq frame-title-format "Emacs--> %S: %f")
+(setq visible-bell t)
+
+;; modeline settings
+(column-number-mode 1)
+(display-time-mode 1)
+
+;; tabs and column defs
+(setq-default indent-tabs-mode nil) ; no fucking tabs!
+(setq tab-width 4) ; but just in case
+(setq tab-stop-list (quote (4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92)))
+(setq fill-column 80)
+(setq c-basic-offset 4)
+
+;; scrolling behaviour
+(setq scroll-step 1)
+(setq scroll-conservatively 50)
+(setq scroll-preserve-screen-position nil)
+
+;; misc minor / helper modes
+(global-font-lock-mode 1)
+(delete-selection-mode 1)
+(setq show-paren-style (quote expression))
+(show-paren-mode t)
+
+(setq default-major-mode 'text-mode)
+(add-hook 'text-mode-hook 'turn-on-auto-fill)
+
+;; mouse and selection settings
+(add-hook 'after-init-hook (lambda ()
+ (require 'xt-mouse)
+ (xterm-mouse-mode)))
+(setq x-select-enable-clipboard t)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(provide 'dss-basic-default-config)
@@ -0,0 +1,20 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; bookmarks & registers
+(require 'bookmark+)
+(defun dss/bookmark-jump (bookmark)
+ (interactive
+ (progn
+ (require 'bookmark)
+ (bookmark-maybe-load-default-file)
+ (list (ido-completing-read "Jump to bookmark: "
+ (mapcar 'car bookmark-alist)))))
+ (bookmark-jump bookmark))
+(global-set-key (kbd "C-x r b") 'dss/bookmark-jump)
+
+; study http://emacs-fu.blogspot.com/2009/01/using-registers.html
+(require 'list-register)
+(global-set-key (kbd "C-x r v") 'list-register)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(provide 'dss-bookmarks-registers)
@@ -0,0 +1,176 @@
+(defun view-url ()
+ "Open a new buffer containing the contents of URL.
+http://github.com/technomancy/emacs-starter-kit/blob/master/starter-kit-defuns.el"
+ (interactive)
+ (let* ((default (thing-at-point-url-at-point))
+ (url (read-from-minibuffer "URL: " default)))
+ (switch-to-buffer (url-retrieve-synchronously url))
+ (rename-buffer url t)
+ ;; TODO: switch to nxml/nxhtml mode
+ (cond ((search-forward "<?xml" nil t) (xml-mode))
+ ((search-forward "<html" nil t) (html-mode)))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; mozilla integration
+; FF settings in about:config
+; extensions.mozrepl.autoStart;true
+; extensions.mozrepl.initUrl;file://localhost/home/tavis/tr_toolchain/mozrepl/custom.js
+
+(require 'moz)
+(require 'json)
+(defun moz-connect()
+ (interactive)
+ (global-set-key "\C-x\C-g" (lambda ()
+ (interactive)
+ (save-buffer)
+ (comint-send-string (inferior-moz-process) "this.BrowserReload()\n"))))
+
+(defun moz-reload ()
+ "Reload the url in the current tab"
+ (interactive)
+ (comint-send-string (inferior-moz-process)
+ (concat "this.BrowserReload()\n")))
+
+(defun moz-update (&rest ignored)
+ "Update the remote mozrepl instance"
+ (interactive)
+ (comint-send-string (inferior-moz-process)
+ (concat "content.document.body.innerHTML="
+ (json-encode (buffer-string)) ";")))
+
+(defun moz-enable-auto-reload ()
+ "Automatically reload the remote mozrepl when this buffer changes"
+ (interactive)
+ (add-hook 'after-save-hook 'moz-reload t t))
+
+(defun moz-disable-auto-reload ()
+ "Disable automatic mozrepl updates"
+ (interactive)
+ (remove-hook 'after-save-hook 'moz-reload t))
+
+(add-hook 'js2-mode-hook (lambda (moz-minor-mode 1)))
+; * C-c C-s: open a MozRepl interaction buffer and switch to it
+; * C-c C-l: save the current buffer and load it in MozRepl
+; * C-M-x: send the current function (as recognized by c-mark-function) to MozRepl
+; * C-c C-c: send the current function to MozRepl and switch to the interaction buffer
+; * C-c C-r: send the current region to MozRepl
+
+; http://cpansearch.perl.org/src/ZIGOROU/MozRepl-Plugin-LinkTools-0.01/lib/MozRepl/Plugin/OpenNewTab.pm
+; function (url, selected) {
+; selected = (selected) ? true : false;
+; var tab;
+; try {
+; tab = window.top.getBrowser ().addTab (url);
+;
+; if (!tab) {
+; return false;
+; }
+;
+; if (selected) {
+; window.top.getBrowser ().selectedTab = tab;
+; }
+; }
+; catch (e) {
+; return false;
+; }
+; return true;
+; }
+
+; http://cpansearch.perl.org/src/ZIGOROU/MozRepl-Plugin-LinkTools-0.01/lib/MozRepl/Plugin/Location.pm
+; function (all) {
+; function getLocationAsJSON (tWindow) {
+; var json = {};
+; for (var p in tWindow.location) {
+; var type;
+;
+; try {
+; type = typeof tWindow.location [p];
+; }
+; catch (e) {
+; continue;
+; }
+;
+; if (type == "object" || type == "function" || type == "undefined") {
+; continue;
+; }
+; json [p] = tWindow.location [p];
+; }
+; return json;
+; }
+;
+; if (all) {
+; return JSONstring.make (Array.prototype.map.call (
+; window.getBrowser ().tabContainer.childNodes,
+; function (tab) {
+; return JSONString.make (getLocationAsJSON (tab.linkedBrowser.contentWindow));
+; }));
+; }
+; else {
+; return JSONstring.make (getLocationAsJSON (window.getBrowser ().contentWindow));
+; }
+; }
+
+; http://cpansearch.perl.org/src/ZIGOROU/MozRepl-Plugin-LinkTools-0.01/lib/MozRepl/Plugin/PageReload.pm
+; (function (args) {
+; try {
+; if (args.regex && args.regex instanceof RegExp) {
+; var rcnt = 0;
+;
+; Array.prototype.forEach.call (
+; window.getBrowser ().tabContainer.childNodes,
+; function (tab) {
+; var tLocation = tab.linkedBrowser.contentWindow.location;
+;
+; if (args.regex.test (tLocation.href)) {
+; tLocation.reload ();
+; rcnt++;
+; }
+; });
+;
+; return rcnt;
+; }
+; else if (typeof args.tab_index == "number") {
+; window.getBrowser ().getBrowserAtIndex (tab_index).linkedBrowser.contentWindow.location.reload ();
+; return 1;
+; }
+; else {
+; window.getBrowser ().contentWindow.location.reload ();
+; return 1;
+; }
+; }
+; catch (e) {
+; return 0;
+; }
+; }) ({ tab_index: [% tab_index %], regex: [% regex %] });
+;
+
+;(require 'webjump)
+;(global-set-key [f2] 'webjump)
+;(setq webjump-sites
+; (append '(
+; ("Google Image Search" .
+; [simple-query "images.google.com" "images.google.com/images?hl=en&q=" ""])
+; ("Flickr Search" .
+; [simple-query "www.flickr.com" "flickr.com/search/?q=" ""])
+; )
+; webjump-sample-sites))
+;
+
+;; http://www.rlazo.org/blog/entry/2008/sep/13/do-you-use-google-to-find-definitions/
+(require 'mm-url)
+(defun dss/google-define-word-or-phrase (query)
+ (interactive "sInsert word or phrase to search: ")
+ (let* ((url (concat "http://www.google.com.pe/search?hl=en&q=define%3A"
+ (replace-regexp-in-string " " "+" query)))
+ (definition
+ (save-excursion
+ (with-temp-buffer
+ (mm-url-insert url)
+ (goto-char (point-min))
+ (if (search-forward "No definitions found of " nil t)
+ "No definitions found"
+ (buffer-substring (search-forward "<li>") (- (search-forward "<") 1)))))))
+ (message "%s: %s" query definition)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(provide 'dss-browser-integration)
@@ -0,0 +1,47 @@
+(when (fboundp 'winner-mode)
+ (winner-mode 1))
+
+(require 'uniquify)
+(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
+
+; http://dfan.org/blog/2009/02/19/emacs-dedicated-windows/
+(defun dss/toggle-current-window-dedication ()
+ (interactive)
+ (let* ((window (selected-window))
+ (dedicated (window-dedicated-p window)))
+ (set-window-dedicated-p window (not dedicated))
+ (message "Window %sdedicated to %s"
+ (if dedicated "no longer " "")
+ (buffer-name))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(require 'ibuffer)
+(setq ibuffer-saved-filter-groups
+ (quote (("default"
+ ("Org" ;; all org-related buffers
+ (mode . org-mode))
+ ("DSS"
+ (filename . "code/active/dss.hg/"))
+ ("Dentalle"
+ (filename . "code/active/dentalle.hg/"))
+ ("Programming" ;; prog stuff not already in MyProjectX
+ (or
+ (mode . c-mode)
+ (mode . perl-mode)
+ (mode . python-mode)
+ (mode . emacs-lisp-mode)
+ ;; etc
+ ))
+ ("emacs" (or
+ (name . "^\\*scratch\\*$")
+ (name . "^\\*Messages\\*$")))
+ ;("ERC" (mode . erc-mode))
+ ))))
+; this didn't work when I first tried it
+(add-hook 'ibuffer-mode-hook
+ (lambda ()
+ (ibuffer-switch-to-saved-filter-groups "default")))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(provide 'dss-buffer-and-window-handling)
@@ -0,0 +1,9 @@
+;;; setting up clojure/slime http://technomancy.us/126
+;;; requires elpa
+
+(defun dss/init-clojure ()
+ (interactive)
+ (dss/init-elpa)
+ (clojure-slime-config))
+
+(provide 'dss-clojure)
Oops, something went wrong.

0 comments on commit a16e888

Please sign in to comment.