Skip to content

Commit

Permalink
Fix nil file name for buffer when projectile-cache-current-file
Browse files Browse the repository at this point in the history
When opening a file from the terminal, it is possible for the
file to be a project and have the `switch-to-buffer` hook run,
with a new buffer that has no associated file.
  • Loading branch information
jbenden committed Mar 17, 2016
1 parent 543841e commit f0d4a4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@

* Prefer ag's internal .gitignore parsing.
* Always use external find-tag implementations.
* When opening a specified file from the terminal, do not error inside of `projectile-cache-current-file`.

### Bugs fixed

* [#871](https://github.com/bbatsov/projectile/issues/871): Stop advice for `compilation-find-file` to override other advices.
* [#557](https://github.com/bbatsov/projectile/issues/557): stack overflow in `projectile-find-tag'.
* [#957](https://github.com/bbatsov/projectile/pull/957): When opening a specified file from the terminal, do not error inside of `projectile-cache-current-file`.

## 0.13.0 (10/21/2015)

Expand Down
4 changes: 2 additions & 2 deletions projectile.el
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,8 @@ The cache is created both in memory and on the hard drive."
"Add the currently visited file to the cache."
(interactive)
(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))))
(when (and (buffer-file-name) (gethash (projectile-project-root) projectile-projects-cache))
(let* ((abs-current-file (file-truename (buffer-file-name)))
(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))
Expand Down

0 comments on commit f0d4a4d

Please sign in to comment.