X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/d8462361f2d087d6f7c745305c61a266843ee19c..a644fa367504c4587c1b9e5fc20b7af79e6e99a0:/lisp/cedet/cedet-global.el?ds=sidebyside diff --git a/lisp/cedet/cedet-global.el b/lisp/cedet/cedet-global.el index 99bffcb16b..f1cc3c905f 100644 --- a/lisp/cedet/cedet-global.el +++ b/lisp/cedet/cedet-global.el @@ -1,6 +1,6 @@ ;;; cedet-global.el --- GNU Global support for CEDET. -;; Copyright (C) 2008-2015 Free Software Foundation, Inc. +;; Copyright (C) 2008-2016 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Package: cedet @@ -36,7 +36,7 @@ (defcustom cedet-global-gtags-command "gtags" "Command name for the GNU Global gtags executable. -GTAGS is used to create the tags table queried by the 'global' command." +GTAGS is used to create the tags table queried by the `global' command." :type 'string :group 'cedet) @@ -97,14 +97,15 @@ SCOPE is the scope of the search, such as 'project or 'subdirs." ;; Check for warnings. (with-current-buffer b (goto-char (point-min)) - (when (re-search-forward "Error\\|Warning" nil t) + (when (re-search-forward "Error\\|Warning\\|invalid" nil t) (error "Output:\n%S" (buffer-string)))) b)) (defun cedet-gnu-global-expand-filename (filename) "Expand the FILENAME with GNU Global. -Return a fully qualified filename." +Return a list of absolute filenames or nil if none found. +Signal an error if Gnu global not available." (interactive "sFile: ") (let ((ans (with-current-buffer (cedet-gnu-global-call (list "-Pa" filename)) (goto-char (point-min)) @@ -126,9 +127,9 @@ Return a fully qualified filename." (message "%s" (cedet-gnu-global-root))) (defun cedet-gnu-global-root (&optional dir) - "Return the root of any GNU Global scanned project. -If a default starting DIR is not specified, the current buffer's -`default-directory' is used." + "Return the root of any GNU Global scanned project containing DIR. +Returns nil if no GNU Global project can be found. +DIR defaults to `default-directory'." (let ((default-directory (or dir default-directory))) (with-current-buffer (cedet-gnu-global-call (list "-pq")) (goto-char (point-min)) @@ -186,12 +187,14 @@ If a database already exists, then just update it." (let ((root (cedet-gnu-global-root dir))) (if root (setq dir root)) (let ((default-directory dir)) - (cedet-gnu-global-gtags-call - (when root - '("-u");; Incremental update flag. - )) - ) - )) + (if root + ;; Incremental update. This can be either "gtags -i" or + ;; "global -u"; the gtags manpage says it's better to use + ;; "global -u". + (cedet-gnu-global-call (list "-u")) + (cedet-gnu-global-gtags-call nil) + ) + ))) (provide 'cedet-global)