Skip to content

Commit

Permalink
Merge pull request #691 from IvanMalison/master
Browse files Browse the repository at this point in the history
file-truename when caching current file. Closes #667
  • Loading branch information
bbatsov committed Jun 19, 2015
2 parents cc56126 + 924d731 commit e22a775
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
### Bugs fixed

* [#721](https://github.com/bbatsov/projectile/issues/721#issuecomment-100830507): Remove current buffer from `helm-projectile-switch-project`.
* [#667](https://github.com/bbatsov/projectile/issues/667) Use `file-truename` when caching filenames to prevent duplicate/symlinked filepaths from appearing when opening a project file.

## 0.12.0 (03/29/2015)

Expand Down
8 changes: 4 additions & 4 deletions projectile.el
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,10 @@ The cache is created both in memory and on the hard drive."
(defun projectile-cache-current-file ()
"Add the currently visited file to the cache."
(interactive)
(let* ((current-project (projectile-project-root))
(abs-current-file (buffer-file-name (current-buffer)))
(current-file (file-relative-name abs-current-file current-project)))
(let ((current-project (projectile-project-root)))
(when (gethash (projectile-project-root) projectile-projects-cache)
(let* ((abs-current-file (file-truename (buffer-file-name (current-buffer))))
(current-file (file-relative-name abs-current-file current-project)))
(unless (or (projectile-file-cached-p current-file current-project)
(projectile-ignored-directory-p (file-name-directory abs-current-file))
(projectile-ignored-file-p abs-current-file))
Expand All @@ -566,7 +566,7 @@ The cache is created both in memory and on the hard drive."
(projectile-serialize-cache)
(message "File %s added to project %s cache."
(propertize current-file 'face 'font-lock-keyword-face)
(propertize current-project 'face 'font-lock-keyword-face))))))
(propertize current-project 'face 'font-lock-keyword-face)))))))

;; cache opened files automatically to reduce the need for cache invalidation
(defun projectile-cache-files-find-file-hook ()
Expand Down

0 comments on commit e22a775

Please sign in to comment.