--- a/.emacs-my Thu Nov 17 22:38:03 2011 +0200
+++ b/.emacs-my Fri Nov 18 22:29:01 2011 +0200
@@ -301,6 +301,22 @@
0 -1) ; -1 for stripping final \0.
))))
+(defun my-dos2cygwin-path (path)
+ "Convert DOS path to Cygwin according to current mount table."
+ (interactive (list (read-directory-name "Enter DOS path: ")))
+ (setq path (replace-regexp-in-string "\\\\" "/" (expand-file-name path)))
+ (let ( (table cygwin-mount-table--internal) item prefix )
+ (while table
+ (setq item (car table))
+ (setq prefix (concat "\\`" (regexp-quote (car item))))
+ (setq table (cdr table))
+ (when (string-match prefix path)
+ (setq path (replace-regexp-in-string prefix (cdr item) path))
+ (setq table nil)
+ ) )
+ path
+ ))
+
(when (eq system-type 'windows-nt)
(ignore-errors
(require 'cygwin-mount)
@@ -1921,6 +1937,32 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(message "python")
+(setq python-indent 4)
+
+(defun my-python-add-to-path (path)
+ (interactive (list (read-directory-name "Enter new path for PYTHONPATH: ")))
+ (when (featurep 'cygwin-mount)
+ (setq path (my-dos2cygwin-path path))
+ )
+ (python-send-string (format "import sys; sys.path.append(\"%s\")" path))
+ )
+
+(defun my-python-django-fix (path)
+ "XXX not work on Cygwin + naive Emacs."
+ (interactive (list (read-directory-name "Enter new path for PYTHONPATH: ")))
+ (when (featurep 'cygwin-mount)
+ (setq path (my-dos2cygwin-path path))
+ )
+ (let ((file (concat path "manage.py")))
+ (if (file-exists-p file)
+ (python-send-string (format "import os; os.chdir(\"%s\"); execfile(\"%s\")" path file))
+ (error (format "file '%s' does not exist" file))
+ )))
+
+(when (>= emacs-major-version 22)
+ (add-hook 'python-mode-hook 'turn-on-eldoc-mode)
+ )
+
(when (equal window-system 'w32)
(add-to-list 'process-coding-system-alist '("python" cp1251-unix . cp1251-unix))
)