]> code.delx.au - gnu-emacs-elpa/commitdiff
* ggtags.el: Fix last change.
authorLeo Liu <sdl.web@gmail.com>
Thu, 21 Mar 2013 07:16:18 +0000 (15:16 +0800)
committerLeo Liu <sdl.web@gmail.com>
Thu, 21 Mar 2013 07:16:18 +0000 (15:16 +0800)
packages/ggtags/ggtags.el

index 6cac43e133568b5ef03235b7dc1a7ea1a4984c96..a646edf34f738f9fbb66a132a47d92f2d8c67014 100644 (file)
@@ -132,7 +132,7 @@ Return -1 if it does not exist."
   (> (ggtags-get-timestamp key)
      (or (fourth (ggtags-cache-get key)) 0)))
 
-(defvar-local ggtags-root-directory 'init
+(defvar-local ggtags-root-directory 'unset
   "Internal; use function `ggtags-root-directory' instead.")
 
 ;;;###autoload
@@ -406,7 +406,7 @@ When called with prefix, ask the name and kind of tag."
          (message "%d %s killed" count (if (= count 1) "buffer" "buffers")))))
 
 (defun ggtags-after-save-function ()
-  (let ((root (ggtags-root-directory)))
+  (let ((root (with-demoted-errors (ggtags-root-directory))))
     (and root (ggtags-cache-mark-dirty root t))))
 
 (defvar ggtags-tag-overlay nil)
@@ -456,10 +456,9 @@ When called with prefix, ask the name and kind of tag."
   :lighter (:eval (if ggtags-navigation-mode "" " GG"))
   (if ggtags-mode
       (progn
-        (or (ggtags-root-directory)
-            (message "File GTAGS not found"))
         (add-hook 'after-save-hook 'ggtags-after-save-function nil t)
-        (add-hook 'post-command-hook 'ggtags-post-command-function nil t))
+        (when (executable-find "global")
+          (add-hook 'post-command-hook 'ggtags-post-command-function nil t)))
     (remove-hook 'after-save-hook 'ggtags-after-save-function t)
     (remove-hook 'post-command-hook 'ggtags-post-command-function t)
     (and (overlayp ggtags-tag-overlay)
@@ -481,8 +480,8 @@ When called with prefix, ask the name and kind of tag."
   (when buffer-file-name
     (let ((file (file-truename buffer-file-name)))
       (with-temp-buffer
-        (when (zerop (with-demoted-errors
-                       (call-process "global" nil t nil "-f" file)))
+        (when (with-demoted-errors
+                (zerop (call-process "global" nil t nil "-f" file)))
           (goto-char (point-min))
           (loop while (re-search-forward
                        "^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)" nil t)
@@ -503,7 +502,7 @@ When called with prefix, ask the name and kind of tag."
                       (point))
       (setq he-expand-list
             (and (not (equal he-search-string ""))
-                 (ggtags-root-directory)
+                 (with-demoted-errors (ggtags-root-directory))
                  (sort (all-completions he-search-string
                                         (ggtags-tag-names))
                        'string-lessp))))