[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 07/14: Fix #65: Clear ggtags-project-root based on default-direct
From: |
Leo Liu |
Subject: |
[elpa] 07/14: Fix #65: Clear ggtags-project-root based on default-directory |
Date: |
Sun, 22 Jun 2014 09:41:41 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit e16006067babac5d88b778f5da4399dc60710abd
Author: Leo Liu <address@hidden>
Date: Sat Jun 14 15:08:18 2014 +0800
Fix #65: Clear ggtags-project-root based on default-directory
---
ggtags.el | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/ggtags.el b/ggtags.el
index a17c5b3..18f47e3 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -474,21 +474,18 @@ Value is new modtime if updated."
(size (let ((project (or project (ggtags-find-project))))
(and project (> (ggtags-project-tag-size project) size))))))
+(defvar-local ggtags-last-default-directory nil)
(defvar-local ggtags-project-root 'unset
"Internal variable for project root directory.")
-(defun ggtags-clear-project-root ()
- (kill-local-variable 'ggtags-project-root))
-
;;;###autoload
(defun ggtags-find-project ()
;; See https://github.com/leoliu/ggtags/issues/42
;;
- ;; It is unsafe to cache `ggtags-project-root' in non-file buffers.
- ;; But we keep the cache for a command's duration so that multiple
- ;; calls of `ggtags-find-project' has no performance impact.
- (unless buffer-file-name
- (add-hook 'pre-command-hook #'ggtags-clear-project-root nil t))
+ ;; It is unsafe to cache `ggtags-project-root' in non-file buffers
+ ;; whose `default-directory' can often change.
+ (unless (equal ggtags-last-default-directory default-directory)
+ (kill-local-variable 'ggtags-project-root))
(let ((project (gethash ggtags-project-root ggtags-projects)))
(if (ggtags-project-p project)
(if (ggtags-project-expired-p project)
@@ -496,6 +493,7 @@ Value is new modtime if updated."
(remhash ggtags-project-root ggtags-projects)
(ggtags-find-project))
project)
+ (setq ggtags-last-default-directory default-directory)
(setq ggtags-project-root
(or (ignore-errors-unless-debug
(file-name-as-directory
- [elpa] branch master updated (76cd6eb -> 4e171a5), Leo Liu, 2014/06/22
- [elpa] 01/14: Fix #54: New command ggtags-find-tag-mouse, Leo Liu, 2014/06/22
- [elpa] 02/14: Update doc strings and comments, Leo Liu, 2014/06/22
- [elpa] 03/14: Fix #56: Restore variable ggtags-completing-read-function, Leo Liu, 2014/06/22
- [elpa] 05/14: Fix #59: detect missing tag files and remove project cache, Leo Liu, 2014/06/22
- [elpa] 04/14: New command ggtags-find-definition for #57, Leo Liu, 2014/06/22
- [elpa] 06/14: Make ggtags-create-tags invalidate ggtags-project-root, Leo Liu, 2014/06/22
- [elpa] 07/14: Fix #65: Clear ggtags-project-root based on default-directory,
Leo Liu <=
- [elpa] 11/14: Fix #58: Search history can be manipulated with C-k and C-y, Leo Liu, 2014/06/22
- [elpa] 08/14: Fix #64: Bind M-s s to ggtags-navigation-isearch-forward, Leo Liu, 2014/06/22
- [elpa] 09/14: Fix #60: Declutter command and highlight tag in search history, Leo Liu, 2014/06/22
- [elpa] 10/14: Refactoring: Use a major mode for viewing search history, Leo Liu, 2014/06/22
- [elpa] 14/14: Merge branch 'master' of github.com:leoliu/ggtags, Leo Liu, 2014/06/22
- [elpa] 13/14: Fix ggtags-global-handle-exit to conditionally pop up window, Leo Liu, 2014/06/22
- [elpa] 12/14: Replace kill-buffer-and-window with ggtags-kill-window, Leo Liu, 2014/06/22