]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix #59: detect missing tag files and remove project cache
authorLeo Liu <sdl.web@gmail.com>
Wed, 21 May 2014 10:37:13 +0000 (18:37 +0800)
committerLeo Liu <sdl.web@gmail.com>
Wed, 21 May 2014 10:46:27 +0000 (18:46 +0800)
ggtags.el

index b78384f648e383b9c312c1d931146f6751123410..15b0b0ed17aa34afb9a12aa69585309ee6b7e15f 100644 (file)
--- a/ggtags.el
+++ b/ggtags.el
@@ -1468,7 +1468,17 @@ commands `next-error' and `previous-error'.
       (funcall cont buf how)))
    ((string-prefix-p "exited abnormally" how)
     ;; If exit abnormally display the buffer for inspection.
-    (ggtags-global--display-buffer))
+    (ggtags-global--display-buffer)
+    (when (save-excursion
+            (goto-char (point-max))
+            (re-search-backward
+             (eval-when-compile
+               (format "^global: %s not found.$"
+                       (regexp-opt '("GTAGS" "GRTAGS" "GSYMS" "GPATH"))))
+             nil t))
+      (ggtags-echo "WARNING: Global tag files missing in `%s'"
+                   ggtags-project-root)
+      (remhash ggtags-project-root ggtags-projects)))
    (ggtags-auto-jump-to-match
     (if (pcase (compilation-next-single-property-change
                 (point-min) 'compilation-message)
@@ -1497,6 +1507,10 @@ commands `next-error' and `previous-error'.
   ;; Note: Place `ggtags-global-output-format' as first element for
   ;; `ggtags-abbreviate-files'.
   (setq-local compilation-error-regexp-alist (list ggtags-global-output-format))
+  (when (markerp ggtags-global-start-marker)
+    (setq ggtags-project-root
+          (buffer-local-value 'ggtags-project-root
+                              (marker-buffer ggtags-global-start-marker))))
   (pcase ggtags-auto-jump-to-match
     (`history (make-local-variable 'ggtags-auto-jump-to-match-target)
               (setq-local compilation-auto-jump-to-first-error