From 96ee4bd0bd7b5cc8a6d9ca918ede26e82a9b20a7 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 12 Jan 2013 12:44:44 -0500 Subject: glob init files files for loading --- init/km-python.el | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 init/km-python.el (limited to 'init/km-python.el') diff --git a/init/km-python.el b/init/km-python.el new file mode 100644 index 0000000..ce7aa53 --- /dev/null +++ b/init/km-python.el @@ -0,0 +1,34 @@ +(defun km/python-sysexit () + (interactive) + (insert "sys.exit()")) + +(defun km/python-random-assignment () + (interactive) + (km/insert-random-string 10) + (insert " = None")) + +(defun km/python-shebang () + (interactive) + (km/shebang "python")) + +(defconst km/python-analysis-imports + "import sys +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt +from matplotlib.ticker import MaxNLocator + +from colors import brew, fgry, bgry" + ) + +(defun km/python-insert-analysis-imports () + "Common imports for analysis scripts" + (interactive) + (insert km/python-analysis-imports)) + +(defun km/python-hook () + (local-set-key (kbd "C-c p r") 'km/python-random-assignment) + (local-set-key (kbd "C-c p e") 'km/python-sysexit) + (local-set-key (kbd "C-c p s") 'km/python-shebang) + (local-set-key (kbd "C-c p a") 'km/python-insert-analysis-imports)) +(add-hook 'python-mode-hook 'km/python-hook) -- cgit v1.2.3