Skip to content

Instantly share code, notes, and snippets.

@AeroNotix
Created February 5, 2012 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AeroNotix/1745249 to your computer and use it in GitHub Desktop.
Save AeroNotix/1745249 to your computer and use it in GitHub Desktop.
;; EMACS CONFIGURATION FILE
(add-to-list 'load-path "~/.emacs.d/")
(let ((default-directory "~/.emacs.d/color-theme-6.6.0/"))
(normal-top-level-add-to-load-path '("."))
(normal-top-level-add-subdirs-to-load-path))
(require 'color-theme)
(color-theme-initialize)
(color-theme-pok-wob) ;; "White on Black" theme
;;; Line numbers on everything
(global-linum-mode t)
(setq-default truncate-lines t)
(setq truncate-partial-width-windows nil) ;; for vertical windows
;;; Vertical EOL indicator
(require 'fill-column-indicator)
(fci-mode)
(define-globalized-minor-mode global-fci-mode fci-mode
(lambda () (fci-mode 1)))
(global-fci-mode 1)
;;; Show trailing whitespace
(setq-default show-trailing-whitespace t)1
;;;----------------GENERAL FUNCTIONS-------------------------------
(defun electric-pair ()
"Insert character pair without surroundding spaces"
(interactive)
(let (parens-require-spaces)
(insert-pair)))
;;;-----------------------------------------------------------------
;;; Get rid of that nasty bell noise
(setq visible-bell t)
(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.
'(appmenu-mode t)
'(cua-mode t nil (cua-base))
'(emacsw32-max-frames t)
'(emacsw32-style-frame-title t)
'(hfyview-quick-print-in-files-menu t)
'(menuacc-mode t)
'(noprint-hide-print-in-menus t)
'(noprint-hide-ps-print-in-menus t)
'(ourcomments-ido-ctrl-tab t)
'(py-shell-name "python2")
'(rebind-keys-mode t)
'(recentf-mode t)
'(sex-mode t)
'(tabkey2-mode t)
'(w32-meta-style (quote emacs))
'(w32shell-shell (quote cmd)))
(custom-set-faces
;; custom-set-faces 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.
)
;------------------PYTHON MODES---------------------------------
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
;;; Encase line in string
(add-hook 'python-mode-hook
'(lambda ()
(defun stringify ()
(interactive)
(beginning-of-line)
(insert "\"")
(end-of-line)
(insert "\""))))
;;; turns the line into a string with
;;; comma.
;;; intended to be used with
;;; (apply-function-to-region-lines)
(add-hook 'python-mode-hook
'(lambda ()
(defun string-lister ()
(interactive)
(beginning-of-line)
(insert "\"")
(end-of-line)
(insert "\","))))
;;; adds a comma on the end of the line
;;; intended to be used with
;;; (apply-function-to-region-lines)
(add-hook 'python-mode-hook
'(lambda ()
(defun listmaker ()
(interactive)
(end-of-line)
(insert ","))))
;;; Bind stringify to C-`
(add-hook 'python-mode-hook
'(lambda ()
(global-set-key (kbd "C-`") 'stringify)))
(add-hook 'python-mode-hook
'(lambda ()
(global-set-key (kbd "<f5>") 'py-execute-buffer)))
;;; Electric pair modes
(add-hook 'python-mode-hook
(lambda ()
(define-key python-mode-map "\"" 'electric-pair)
(define-key python-mode-map "\'" 'electric-pair)
(define-key python-mode-map "(" 'electric-pair)
(define-key python-mode-map "[" 'electric-pair)
(define-key python-mode-map "{" 'electric-pair)))
;;; Python mode newline and indent on return
(add-hook 'python-mode-hook '(lambda ()
(define-key python-mode-map "\C-m" 'newline-and-indent)))
;;; Python hook to set Python theme
(add-hook 'python-mode-hook '(lambda ()
(color-theme-easy-python)))
(add-hook 'python-mode-hook '(lambda ()
(load-file "~/.emacs.d/python-mode.el")))
;;; ident-tab no, tab width 4
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
;;; Set column width to 78 maximum in python code
(add-hook 'python-mode-hook
'(lambda ()
(setq-default fill-column 78)))
(add-hook 'python-mode-hook 'turn-on-auto-fill)
;-----------------CLOJURE MODES----------------------------------
(add-hook 'clojure-mode-hook '(lambda ()
(color-theme-pok-wob)))
;(add-hook 'clojure-mode-hook
; (lambda ()
; (define-key clojure-mode-map "(" 'electric-pair)
; (define-key clojure-mode-map "[" 'electric-pair)
; (define-key clojure-mode-map "{" 'electric-pair)))
;---------------------------------------------------------------
;;; This was installed by package-install.el.
;;; This provides support for the package system and
;;; interfacing with ELPA, the package archive.
;;; Move this code earlier if you want to reference
;;; packages in your .emacs.
(when
(load
(expand-file-name "~/.emacs.d/elpa/package.el"))
(package-initialize))
;-----------------AUTOCOMPLETE-----------------------------------
(add-to-list 'load-path "~/.emacs.d/autocomplete")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/autocomplete/ac-dict")
(ac-config-default)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment