------------------------------------------------------------ revno: 372 committer: Leo Liu <sdl....@gmail.com> branch nick: elpa timestamp: Thu 2013-03-21 15:16:18 +0800 message: * ggtags.el: Fix last change. modified: packages/ggtags/ggtags.el
=== modified file 'packages/ggtags/ggtags.el' --- a/packages/ggtags/ggtags.el 2013-03-21 03:34:22 +0000 +++ b/packages/ggtags/ggtags.el 2013-03-21 07:16:18 +0000 @@ -132,7 +132,7 @@ (> (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 @@ (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 @@ :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 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 @@ (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))))