Skip to content

Commit

Permalink
Fix tramp issues: bbatsov/projectile#1129
Browse files Browse the repository at this point in the history
Acked-by: Vincent Zhang <seagle0128@gmail.com>
  • Loading branch information
seagle0128 committed Mar 25, 2017
1 parent e750de0 commit 7ebb236
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lisp/init-projectile.el
Expand Up @@ -38,6 +38,28 @@
("s-t" . projectile-find-file))
:init (add-hook 'after-init-hook 'projectile-mode)
:config
;; FIX tramp issues: https://github.com/bbatsov/projectile/pull/1129
(defun projectile-project-root ()
"Retrieves the root directory of a project if available.
The current directory is assumed to be the project's root otherwise."
(let* ((dir default-directory)
(is-local (not (file-remote-p dir)))
(is-connected (file-remote-p dir nil t)))
(or (when (or is-local is-connected)
(cl-some
(lambda (func)
(let* ((cache-key (format "%s-%s" func dir))
(cache-value (gethash cache-key projectile-project-root-cache)))
(if (and cache-value (file-exists-p cache-value))
cache-value
(let ((value (funcall func (file-truename dir))))
(puthash cache-key value projectile-project-root-cache)
value))))
projectile-project-root-files-functions))
(if projectile-require-project-root
(error "You're not in a project")
default-directory))))

(setq projectile-mode-line
'(:eval
(if (file-remote-p default-directory)
Expand Down

0 comments on commit 7ebb236

Please sign in to comment.