Permalink
Browse files

recent updates

  • Loading branch information...
1 parent eaf518d commit 24cfb63cb47e380819080a6ad5e5133b615f8e83 @nsh-ableton nsh-ableton committed Feb 24, 2012
Showing with 2,240 additions and 10 deletions.
  1. +22 −0 .bash_aliases
  2. +2 −0 .bashrc
  3. +28 −10 .emacs
  4. +158 −0 .emacs.d/elisp/grep-buffers.el
  5. +1 −0 .emacs.d/elisp/haml-mode
  6. +2,021 −0 .emacs.d/elisp/markdown-mode.el
  7. +5 −0 .gitconfig
  8. +3 −0 .gitmodules
View
@@ -1 +1,23 @@
alias lr='ls -ralt'
+alias rmpyc="find -name '*.pyc' -exec rm {} \;"
+
+# "fnl" == "find named like"
+function fnl() {
+ find -name "*$@*"
+}
+
+# "pyg" == "grep in python files"
+function pyg() {
+ find -name '*.py' -exec egrep --color --with-filename "$@" {} \;
+}
+
+# switch_to --> switch virtualenv *AND* go to the right directory
+function now_on() {
+ venv_name=$1
+ proj_name=`echo $venv_name | sed -e 's/_.\+//' -`
+ shopt -q expand_aliases
+ workon $venv_name
+ cd $HOME/projects/$proj_name
+}
+
+complete -o nospace -F _virtualenvs now_on
View
@@ -102,5 +102,7 @@ if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
+# Enable virtualenvwrapper functionality.
+
export PYTHONSTARTUP="$HOME/.pystartup"
export EDITOR="emacsclient -t"
View
38 .emacs
@@ -5,6 +5,18 @@
(require 'feature-mode)
+(autoload 'markdown-mode "markdown-mode.el"
+ "Major mode for editing Markdown files" t)
+(setq auto-mode-alist
+ (cons '("\\.md" . markdown-mode) auto-mode-alist))
+
+(require 'haml-mode)
+
+(add-hook 'haml-mode-hook
+ '(lambda ()
+ (setq indent-tabs-mode nil)
+ (define-key haml-mode-map "\C-m" 'newline-and-indent)))
+
(setq inhibit-startup-message t)
(setq transient-mark-mode t)
@@ -34,15 +46,7 @@
(setq uniquify-after-kill-buffer-p t)
(setq uniquify-ignore-buffers-re "^\\*")
-(global-set-key [f4] 'goto-line)
-(defun really-refresh-file ()
- (interactive)
- (revert-buffer t t t)
- )
-(global-set-key [f5] 'really-refresh-file)
-(global-set-key (read-kbd-macro "C-c C-c") 'comment-or-uncomment-region)
-(global-set-key (read-kbd-macro "<insert>") 'nil)
-(global-unset-key (kbd "C-M-l"))
+(require 'grep-buffers)
(global-set-key [f6] 'revert-all-buffers)
(defun revert-all-buffers ()
@@ -80,7 +84,7 @@
;; (this method will render the setting of frame size unreliable, this
;; could be resolved by using the .Xresources file instead)
(tool-bar-mode 0)
-(menu-bar-mode 0)
+;(menu-bar-mode 0)
(set-scroll-bar-mode nil)
;; Activate python highlighting for PYX and PPL files
@@ -116,4 +120,18 @@
dired-directory
(revert-buffer-function " %b"
("%b - Dir: " default-directory)))))))
+
+(global-set-key [f4] 'goto-line)
+(defun really-refresh-file ()
+ (interactive)
+ (revert-buffer t t t)
+ )
+(global-set-key [f5] 'really-refresh-file)
+(global-set-key (read-kbd-macro "C-M-c") 'comment-or-uncomment-region)
+(global-set-key (read-kbd-macro "<insert>") 'nil)
+(global-unset-key (kbd "C-M-l"))
+
+;; Start sh-mode for this/these too....
+(add-to-list 'auto-mode-alist '(".bash_aliases'" . sh-mode))
+
(server-start)
@@ -0,0 +1,158 @@
+;;; grep-buffers.el --- grep through buffers (a la 'moccur')
+
+;; Copyright (C) 2007-2009 Scott Frazer
+
+;; Author: Scott Frazer <frazer.scott@gmail.com>
+;; Maintainer: Scott Frazer <frazer.scott@gmail.com>
+;; Created: 01 Jan 2007
+;; Version: 2.2
+;; Keywords: grep buffers
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; This code lets you grep through all loaded buffers that have a file
+;; associated with them. It's similar to 'moccur' and it's many variants, but
+;; uses the standard compilation-mode interface, i.e. next-error,
+;; previous-error, etc. all work.
+
+(defvar grep-buffers-buffer-name "*grep-buffers*"
+ "grep-buffers buffer name.")
+
+(defvar grep-buffers-name-regexps-to-ignore (list "TAGS$")
+ "*Name regexps to ignore")
+
+(defvar grep-buffers-regexp-history nil
+ "Regexp history for grep-buffers.")
+
+(defvar grep-buffers-match-index -1
+ "Current match index.")
+
+;; Grep buffers
+
+(defun grep-buffers ()
+ "Grep buffers that have file names associated with them."
+ (interactive)
+ (let ((buffers (sort (buffer-list)
+ (function (lambda (elt1 elt2)
+ (string< (downcase (buffer-name elt1))
+ (downcase (buffer-name elt2)))))))
+ (regexp (grep-buffers-symbol-at-point)))
+ (setq regexp (read-string (format "grep buffers for [%s]: " regexp)
+ nil 'grep-buffers-regexp-history regexp))
+ (add-to-list 'grep-buffers-regexp-history regexp)
+ (get-buffer-create grep-buffers-buffer-name)
+ (save-excursion
+ (set-buffer grep-buffers-buffer-name)
+ (erase-buffer)
+ (display-buffer grep-buffers-buffer-name)
+ (insert (format "grep buffers for '%s' ...\n\n" regexp))
+ (mapcar (lambda (x)
+ (when (grep-buffers-do-this-one x)
+ (set-buffer x)
+ (save-excursion
+ (save-match-data
+ (goto-char (point-min))
+ (while (re-search-forward regexp nil t)
+ (let ((line (count-lines 1 (point)))
+ (substr (buffer-substring (point-at-bol)
+ (point-at-eol))))
+ (save-excursion
+ (set-buffer grep-buffers-buffer-name)
+ (insert (format "%s:%d:%s\n" x line substr))))
+ (goto-char (point-at-eol)))))))
+ buffers)
+ (set-buffer grep-buffers-buffer-name)
+ (goto-char (point-max))
+ (insert "\ngrep finished\n")
+ (if (< emacs-major-version 22)
+ (progn
+ (compilation-mode)
+ (set (make-local-variable 'compilation-parse-errors-function)
+ 'grep-buffers-parse-matches))
+ (grep-mode)
+ (grep-buffers-parse-matches nil nil)
+ (setq grep-buffers-match-index -1)
+ (setq overlay-arrow-position nil)
+ (setq next-error-function 'grep-buffers-next-match))
+ (goto-char (point-min))
+ (set-buffer-modified-p nil)
+ (setq buffer-read-only nil)
+ (force-mode-line-update))))
+
+(defun grep-buffers-symbol-at-point ()
+ (save-excursion
+ (buffer-substring (progn (skip-syntax-backward "w_") (point))
+ (progn (skip-syntax-forward "w_") (point)))))
+
+(defun grep-buffers-do-this-one (buf)
+ (let ((name (buffer-file-name buf))
+ (case-fold-search nil)
+ match)
+ (when name
+ (mapcar
+ (lambda (x) (setq match (or match (string-match x name))))
+ grep-buffers-name-regexps-to-ignore)
+ (not match))))
+
+;; Parse matches
+
+(defun grep-buffers-parse-matches (limit-search find-at-least)
+ "Parse the grep buffer for matches.
+See variable `compilation-parse-errors-function' for interface."
+ (save-excursion
+ (set-buffer grep-buffers-buffer-name)
+ (goto-char (point-min))
+ (setq compilation-error-list nil)
+ (while (re-search-forward "^\\(.+?\\):\\([0-9]+?\\):\\(.+?\\)$" nil t)
+ (let ((buffer-of-match (match-string 1))
+ (line-of-match (string-to-number (match-string 2))))
+ (setq compilation-error-list
+ (nconc compilation-error-list
+ (list (cons
+ (save-excursion
+ (beginning-of-line)
+ (point-marker))
+ (save-excursion
+ (set-buffer buffer-of-match)
+ (goto-line line-of-match)
+ (beginning-of-line)
+ (point-marker))))))))))
+
+;; Next match (Emacs 22)
+
+(defun grep-buffers-next-match (&optional arg reset)
+ (let (match-info)
+ (if reset
+ (setq grep-buffers-match-index 0)
+ (if (= arg 0)
+ (setq grep-buffers-match-index (- (count-lines (point-at-bol) (point-min)) 2))
+ (setq grep-buffers-match-index (+ grep-buffers-match-index arg)))
+ (when (< grep-buffers-match-index 0)
+ (setq grep-buffers-match-index 0))
+ (when (> grep-buffers-match-index (length compilation-error-list))
+ (setq grep-buffers-match-index (length compilation-error-list))))
+ (setq match-info (elt compilation-error-list grep-buffers-match-index))
+ (pop-to-buffer (marker-buffer (car match-info)))
+ (goto-char (marker-position (car match-info)))
+ (setq overlay-arrow-position (point-marker))
+ (pop-to-buffer (marker-buffer (cdr match-info)))
+ (goto-char (marker-position (cdr match-info)))))
+
+(provide 'grep-buffers)
+
+;;; grep-buffers.el ends here
Submodule haml-mode added at 9b71c6
Oops, something went wrong.

0 comments on commit 24cfb63

Please sign in to comment.