Created
May 7, 2014 19:24
-
-
Save ssanderson/37454a9c41c5a0c5a1d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Root directory for Quantopian projects. | |
(setq quantopian-root | |
(let (temp) | |
(setq temp (getenv "QUANTO_ROOT")) | |
(if temp (file-name-as-directory temp) "~/quantopian"))) | |
;; ============= | |
;; Package Repos | |
;; ============= | |
(require 'package) | |
(add-to-list 'package-archives | |
'("marmalade" . "http://marmalade-repo.org/packages/")) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.milkbox.net/packages/")) | |
;; Show matching parens/braces under point. | |
(require 'paren) | |
(show-paren-mode t) | |
(setq show-paren-delay 0) | |
;; ================ | |
;; Custom functions | |
;; ================ | |
(defun qtags () | |
"Run etags on Quantopian python source file." | |
(interactive) | |
(shell-command | |
(format | |
"find %s -and -and -name '*.py' -not -name '*\.pyc' -not -name '*__init__.py' | xargs etags -o %s" | |
quantopian-root (concat quantopian-root "TAGS")))) | |
(defun qgrep () | |
"Grep for regex in python files within the value specified for" | |
"quantopian-root. Uses grep-find for built-in history." | |
(interactive) | |
(let (sym regex grep-fmt grep-flags) | |
;; Interactively get a regex to search for, using the symbol under the | |
;; point as a default. | |
(setq sym (thing-at-point 'symbol)) | |
(setq regex (read-regexp "Expression" sym)) | |
(setq grep-flags "-nH") | |
(setq grep-fmt "find %s -type f '(' -name \"*.py\" -or -name \"*.sh\" ')' \ | |
-and -not -name \"*.pyc\" -exec grep %s --color=auto -e \"%s\" {} +") | |
;; Grep for the specified regex in .py and .sh files within quantopian-root. | |
(grep-find (format grep-fmt quantopian-root grep-flags regex)))) | |
(defun iqgrep () | |
"Grep for regex in python files within the value specified for" | |
"quantopian-root. Uses grep-find for built-in history." | |
(interactive) | |
(let (sym regex grep-fmt grep-flags) | |
;; Interactively get a regex to search for, using the symbol under the | |
;; point as a default. | |
(setq sym (thing-at-point 'symbol)) | |
(setq regex (read-regexp "Expression" sym)) | |
(setq grep-flags "-niH") | |
(setq grep-fmt "find %s -type f '(' -name \"*.py\" -or -name \"*.sh\" ')' \ | |
-and -not -name \"*.pyc\" -exec grep %s --color=auto -e \"%s\" {} +") | |
;; Grep for the specified regex in .py and .sh files within quantopian-root. | |
(grep-find (format grep-fmt quantopian-root grep-flags regex)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment