Skip to content

Instantly share code, notes, and snippets.

@fberger
Last active September 25, 2015 17:48
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 fberger/960514 to your computer and use it in GitHub Desktop.
Save fberger/960514 to your computer and use it in GitHub Desktop.
.emacs
(custom-set-variables
'(dabbrev-upcase-means-case-search t)
'(tags-revert-without-query t)
'(custom-file "~/.emacs")
'(blink-cursor-mode nil)
'(dabbrev-case-fold-search t)
'(iswitchb-mode t nil (iswitchb))
'(global-font-lock-mode t nil (font-lock)))
(setq-default fill-column 80)
(setq-default column-number-mode t)
(iswitchb-default-keybindings)
(tool-bar-mode -1)
(column-number-mode 1)
(server-start)
;; function to switch between (beginning-of-buffer) and (goto-line)
;; use carefully, as (beginning-of-buffer) expects an optional argument
;; as well. Read documentation for details
(defun line-switch (&optional arg)
"Decide whether to go to beginning of file or to specified line"
(interactive "P")
(if arg
(goto-line arg)
(beginning-of-buffer)
)
)
(global-set-key "\M-<" 'line-switch)
(global-set-key [f7] 'next-error)
(global-set-key [f8] 'compile)
(global-set-key [f9] 'recompile)
(global-set-key [(control shift y)] 'x-clipboard-yank)
(global-set-key [C-tab] 'ff-find-other-file)
(global-set-key "\C-xf" 'find-file-at-point)
(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward)
(require 'ipython)
(defun django-shell (&optional argprompt)
(interactive "P")
;; Set the default shell if not already set
(labels ((read-django-project-dir
(prompt dir)
(let* ((dir (read-directory-name prompt dir))
(manage (expand-file-name (concat dir "manage.py"))))
(if (file-exists-p manage)
(expand-file-name dir)
(progn
(message "%s is not a Django project directory" manage)
(sleep-for .5)
(read-django-project-dir prompt dir))))))
(let* ((dir (read-django-project-dir
"project directory: "
default-directory))
(project-name (first
(remove-if (lambda (s) (or (string= "src" s) (string= "" s)))
(reverse (split-string dir "/")))))
(buffer-name (format "django-%s" project-name))
(manage (concat dir "manage.py")))
(cd dir)
(if (not (equal (buffer-name) buffer-name))
(switch-to-buffer-other-window
(apply 'make-comint buffer-name manage nil '("shell")))
(apply 'make-comint buffer-name manage nil '("shell")))
(make-local-variable 'comint-prompt-regexp)
(setq comint-prompt-regexp (concat py-shell-input-prompt-1-regexp "\\|"
py-shell-input-prompt-2-regexp "\\|"
"^([Pp]db) "))
(add-hook 'comint-output-filter-functions
'py-comint-output-filter-function)
;; pdbtrack
(add-hook 'comint-output-filter-functions 'py-pdbtrack-track-stack-file)
(setq py-pdbtrack-do-tracking-p t)
(set-syntax-table py-mode-syntax-table)
(use-local-map py-shell-map)
(run-hooks 'py-shell-hook))))
(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.
'(default ((t (:stipple nil :background "#ffffff" :foreground "#000000" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 123 :width normal :family "misc-fixed"))))
'(bold ((t (:weight bold :height 130 :family "misc-fixed"))))
'(border ((t (:background "black" :foreground "white" :family "misc-fixed")))))
(setq initial-frame-alist '((top . 0) (left . 0) (width . 81) (height . 54)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment