 (add-hook 'rst-mode #'py-handle-sphinx-docs)
 
 (add-hook 'dired-load-hook
-	  '(lambda ()
-	     (dired-omit-mode 1)))
+          '(lambda ()
+             (require 'dired-x)
+             (dired-omit-mode 1)))
 
 (setq-default jabber-account-list
-    '((:password: nil)
-      (:network-server . "")
-      (:port 5220)
-      (:connection-type . ssl)))
+              '((:password: nil)
+                (:network-server . "")
+                (:port 5220)
+                (:connection-type . ssl)))
 
 (provide '.emacs-custom)
 ;;; .emacs-custom.el ends here
-
-

(defun py-venv-known-names (directory)
  "List `known` virtualenvs names only in DIRECTORY."
  (let* ((dir-name (directory-file-name directory))
	 (full-names 1)
	 (files (directory-files directory full-names))
	 (dirs (remove-if-not #'file-directory-p files))
	 (names (remove-if #'(lambda (name) (s-match ".+\\.+$" name)) dirs)))
    (mapcar #'file-name-base names)))

(defun py-auto-workon-maybe ()
  "Attempt to automatically workon known virtualenvs."
  (require 'pyvenv)
  (let* ((git-remote-name (git-get-current-remote-name))
	 (git-repo-name (or (file-name-base git-remote-name) ""))
	 (venv-names (py-venv-known-names py-workon-home))
	 (venvs-matched
	  (remove-if-not
	   #'(lambda (venv-name) (s-contains? git-repo-name venv-name))
	   venv-names)))
    (if (and (> 1 (length venvs-matched)) pyvenv-virtual-venv)
	(pyvenv-deactivate)
      (pyvenv-workon (car venvs-matched)))))


(defun py-handle-virtualenvs ()
  "Handle Python virualenvs."


(defvar pylons-git-repos
  (list "colander.git"
       "deform.git"
    "peppercorn.git"
    "pyramid.git"
    "pyramid_chameleon.git"
    "pyramid_mako.git"
    "pyramid_layout.git"
    "pyramid_ldap"
    "pyramid_zcml.git"
    "pyramid_zodbconn.git"
    "sdidemo.git"
    "substanced.git"))

(defun is-pylons-repo (url)
  "Return true if URL is a Pylons repository."
  (delq nil (mapcar (lambda (repo-suffix)
                      (s-suffix? repo-suffix url))
                    pylons-git-repos)))


(defun git-get-current-remote-name ()
