-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpython-emacs-init.el
More file actions
57 lines (40 loc) · 1.96 KB
/
Copy pathpython-emacs-init.el
File metadata and controls
57 lines (40 loc) · 1.96 KB
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
49
50
51
52
53
54
55
56
57
;;; python-emacs-init.el --- Init file for Emacs as a Python IDE settings
;;; Author: Vedang Manerikar
;;; Created on: 20 Jun 2012
;;; Time-stamp: "2012-06-22 00:42:11 vedang"
;;; Copyright (c) 2012 Vedang Manerikar <vedang.manerikar@gmail.com>
;; This file is not part of GNU Emacs.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Do What The Fuck You Want to
;; Public License, Version 2, which is included with this distribution.
;; See the file LICENSE.txt
;;; Commentary:
;; To use this code, simply add
;; (add-to-list 'load-path "/path/to/python-emacs/")
;; (require 'python-emacs-init)
;; to your .emacs file
;;; Code:
(defun vedang/list-dirs-recursively (directory)
"List all the directories in DIRECTORY and in it's sub-directories."
(let* ((current-directory-list (directory-files-and-attributes directory t))
(dirs-list (delq nil (mapcar (lambda (lst)
(and (car (cdr lst))
(not (equal "." (substring (car lst) -1)))
(not (equal ".git" (substring (car lst) -4)))
(car lst)))
current-directory-list))))
(apply #'append dirs-list (mapcar (lambda (d)
(vedang/list-dirs-recursively d))
dirs-list))))
(defun vedang/add-dirs-to-load-path (directory)
"Add all directories under the input directory to the emacs load path"
(dolist (dirname (vedang/list-dirs-recursively directory))
(add-to-list 'load-path dirname)))
(vedang/add-dirs-to-load-path (file-name-directory
(or (buffer-file-name) load-file-name)))
(autoload 'python-mode "python" "Load python mode" t)
(eval-after-load "python"
'(progn
(require 'python-mode-config)))
(provide 'python-emacs-init)