-
Notifications
You must be signed in to change notification settings - Fork 0
/
personal-python.el
48 lines (41 loc) · 1.73 KB
/
personal-python.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
;; This file assumes auto-complete and cedet installed
(require 'gpycomplete)
;(require 'pycomplete)
;;(require 'pysmell)
;;(require 'personal-semantic)
(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))
;; (semantic-add-system-include "/usr/lib/python2.5" 'python-mode)
;; (semantic-add-system-include "/usr/lib/python2.5/" 'python-mode)
(set-variable 'py-python-command "/usr/bin/python2.5")
;; (setq semantic-python-dependency-system-include-path
;; '("/usr/lib/python2.5/"))
(add-hook 'python-mode-hook
(lambda ()
(eldoc-mode 1)
(set (make-variable-buffer-local 'beginning-of-defun-function)
'py-beginning-of-def-or-class)
(setq outline-regexp "def\\|class ")
(gpycomplete-mode)
;; (add-to-list 'ac-omni-completion-sources
;; (cons "\\." '(ac-source-semantic)))
;; (my-cedet-hook)
;; (pysmell-mode 1)
))
;; Not provided by flymake itself, curiously
(defun flymake-create-temp-in-system-tempdir (filename prefix)
(make-temp-file (or prefix "flymake-temp-")))
;;Auto Syntax Error Hightlight
(when (load "flymake" t)
(defun flymake-pyflakes-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-in-system-tempdir))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "pyflakes" (list local-file))
))
(add-to-list 'flymake-allowed-file-name-masks
'("\\.py\\'" flymake-pyflakes-init)))
(add-hook 'find-file-hook 'flymake-find-file-hook)