.emacs-my
changeset 732 139665dd6ada
parent 731 5b6105640c0e
child 835 bfc9412ed633
--- a/.emacs-my	Sun Oct 16 00:39:28 2011 +0300
+++ b/.emacs-my	Sun Oct 16 01:14:02 2011 +0300
@@ -288,7 +288,7 @@
 
 (defun my-dos2cygwin-path (path)
   "Convert DOS path to Cygwin according to current mount table."
-  (interactive (list (read-directory-name "Enter new path for PYTHONPATH: ")))
+  (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
@@ -1629,6 +1629,26 @@
 
 (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)
   )