dotfiles / emacs.d / mspython.el

;; Advanced Python stuff
;; Pymacs
;(require 'pymacs)
;(autoload 'pymacs "pymacs" nil t)
;(autoload 'pymacs-load "pymacs" nil t)
;(autoload 'pymacs-eval "pymacs" nil t)
;(autoload 'pymacs-apply "pymacs")
;(autoload 'pymacs-call "pymacs")

;; python-mode:
;(setq load-path (cons "/usr/share/emacs/site-lisp" load-path))
;(autoload 'python-mode "python-mode" "Python editing mode." t)
;(setq auto-mode-alist
;      (cons '("\\.py$" . python-mode) auto-mode-alist))

;; Bicycle Repair - Python Refactoring
;(pymacs-load "bikeemacs" "brm-")

;;; Get python documentation 
;; get help on a symbol: C-c C-f
;(add-hook 'python-mode-hook
;          '(lambda () (eldoc-mode 1)) t)

(add-to-list 'auto-mode-alist '("\\.tap\\'" . python-mode))
(add-to-list 'auto-mode-alist '("\\.tac\\'" . python-mode))
(add-to-list 'auto-mode-alist '("\\.tml\\'" . python-mode))

;; Pyflakes and Flymake for Python!  WHOOO!
; (defun py-pychecker-run ()
;  (interactive)
;    (shell-command (concat
;                    "pyflakes "
;                    (buffer-file-name))
;                   "*compilation*")
;    (switch-to-buffer-other-window "*compilation*"))

;; configure hooks to run pyflakes automatically with flymake mode:
;; NOTE: this is super sweet
(when (load "flymake" t)
  (defun flymake-pyflakes-init ()
    (let* ((temp-file (flymake-init-create-temp-buffer-copy
           (local-file (file-relative-name
                        (file-name-directory buffer-file-name))))
      (list "pyflakes" (list local-file))))
;; If you need to change the xml command you can do it be defining a flymake-xml-init function:
  ;; (defun flymake-xml-init ()
  ;;   (list "/usr/local/bin/xml" (list "validate --err" (flymake-init-create-temp-buffer-copy
  ;;                                           ;'flymake-create-temp-inplace
  ;;                                           'flymake-create-temp-with-folder-structure
  ;;                                           ))))
  (delete '("\\.html?\\'" flymake-xml-init) flymake-allowed-file-name-masks)
  (delete '("\\.xml?\\'" flymake-xml-init) flymake-allowed-file-name-masks)
  (add-to-list 'flymake-allowed-file-name-masks
               '("\\.py\\'" flymake-pyflakes-init)))
(add-hook 'find-file-hook 'flymake-find-file-hook)

;; run pyflakes(instead of pychecker) manually with C-c C-w:
;; python-mode.el from python
(setq py-pychecker-command "pyflakes")
(setq py-pychecker-command-args "")
;; python.el from emacs
(setq python-check-command "pyflakes")

(require 'mstest)

;; YAML mode:
(require 'yaml-mode)
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))

;; Let's try treating psp files as xml?
(add-to-list 'auto-mode-alist '("\\.psp\\'" . nxml-mode))
;;(add-to-list 'auto-mode-alist '("\\.jsp\\'" . jsp-mode))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.