 (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)))
+	 (files (directory-files directory 1))
+	 (starts-with-dot (apply-partially #'s-starts-with? "."))
+	 (dir-names (-filter #'file-directory-p files))
+	 (entries (-map #'file-name-nondirectory dir-names)))
+    (-drop-while starts-with-dot entries)))
 
 (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-env)
-  (pyvenv-deactivate)
+	 (git-repo-name (or (file-name-base git-remote-name) ""))
+	 (venv-names (py-venv-known-names py-workon-home))
+	 (repo-venv (apply-partially #'s-contains? git-repo-name))
+	 (venvs-matched (-filter repo-venv venv-names)))
+    (if (and (> 0 (length venvs-matched)) pyvenv-virtual-env)
+	(pyvenv-deactivate)
       (pyvenv-workon (car venvs-matched)))))
 
 (defun py-set-newline-and-indent ()

  (auto-fill-mode t)
  (handle-virtualenvs))

(add-hook 'rst-mode #'py-handle-sphinx-docs)

(defun py-setup ()
  "Setup Python developemnt environment."
  (py-auto-workon-maybe)
  (py-handle-virtualenvs)
  (py-set-newline-and-indent)
  (py-set-flycheck-flake8rc-for-current-git-repo))

(add-hook 'python-mode-hook #'py-setup)

(defun notify-jabber-notify (from buf text proposed-alert)
  "Notify via notify.el about new messages using FROM BUF TEXT PROPOSED-ALERT."
  (when (or jabber-message-alert-same-buffer
            (not (memq (selected-window) (get-buffer-window-list buf))))
    (if (jabber-muc-sender-p from)
        (notify (format "(PM) %s"
                       (jabber-jid-displayname (jabber-jid-user from)))
               (format "%s: %s" (jabber-jid-resource from) text)))
      (notify (format "%s" (jabber-jid-displayname from))
             text)))

(add-hook 'jabber-alert-message-hooks 'notify-jabber-notify)

(defun dired-omit-hook ()
  "Omit mode on by default."
  (dired-omit-mode 1))

(add-hook 'dired-load-hook 'dired-omit-hook)

(defun setup-global-key-bindings ()
  "Setup global key bindings."
  (require 'magit)
  (require 'org)
  (global-set-key (kbd "C-c +") 'text-scale-increase)
  (global-set-key (kbd "C-c -") 'text-scale-decrease)
  (global-set-key (kbd "C-c l") 'org-store-link)
  (global-set-key (kbd "C-c c") 'org-capture)
  (global-set-key (kbd "C-c a") 'org-agenda)
  (global-set-key (kbd "C-c b") 'org-iswitchb)
  (global-set-key (kbd "C-c m") 'magit-status))

(add-hook #'after-init-hook #'setup-global-key-bindings)

(provide '.emacs-custom)
;;; .emacs-custom.el ends here

      (magit-get "remote" remote "url"))))

(defun py-set-flycheck-flake8rc-for-current-git-repo()
  "Set the flake8rc file for the current git repository."
  (let* ((curr-git-remote-url (git-get-current-remote-name))
	 (flake8rc-filename "flake8rc"))
    (if (and curr-git-remote-url
