]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/cedet-cscope.el
Doc fixes for fclist and grep
[gnu-emacs] / lisp / cedet / cedet-cscope.el
index 18cb7071d5c7236b67389e7067ed6a84966ece56..373149c16e365c5c21e6745e42faf8542860fd02 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cedet-cscope.el --- CScope support for CEDET
 
-;;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;;; Copyright (C) 2009-2016 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Package: cedet
@@ -28,7 +28,7 @@
 
 (declare-function inversion-check-version "inversion")
 
-(defvar cedet-cscope-min-version "16.0"
+(defvar cedet-cscope-min-version "15.7"
   "Minimum version of CScope required.")
 
 (defcustom cedet-cscope-command "cscope"
@@ -52,7 +52,7 @@ SCOPE is the scope of the search, such as 'project or 'subdirs."
   ;; -0 = Find C symbol
   ;; -1 = Find global definition
   ;; -3 = Find references
-  ;; -6 = Find egrep pattern
+  ;; -6 = Find grep -E pattern
   ;; -7 = Find file
   (let ((idx (cond ((eq type 'file)
                    "-7")
@@ -73,6 +73,12 @@ SCOPE is the scope of the search, such as 'project or 'subdirs."
        )
     (cedet-cscope-call (list "-d" "-L" idx searchtext))))
 
+(defun cedet-cscope-create (flags)
+  "Create a CScope database at the current directory.
+FLAGS are additional flags to pass to cscope beyond the
+options -cR."
+  (cedet-cscope-call (append (list "-cR") flags)))
+
 (defun cedet-cscope-call (flags)
   "Call CScope with the list of FLAGS."
   (let ((b (get-buffer-create "*CEDET CScope*"))
@@ -113,18 +119,24 @@ Return a fully qualified filename."
 If DIR is not supplied, use the current default directory.
 This works by running cscope on a bogus symbol, and looking for
 the error code."
+  (interactive "DDirectory: ")
   (save-excursion
     (let ((default-directory (or dir default-directory)))
       (set-buffer (cedet-cscope-call (list "-d" "-L" "-7" "moose")))
       (goto-char (point-min))
-      (if (looking-at "[^ \n]*cscope: ")
-         nil
-       t))))
+      (let ((ans (looking-at "[^ \n]*cscope: ")))
+       (if (called-interactively-p 'interactive)
+           (if ans
+               (message "No support for CScope in %s" default-directory)
+             (message "CScope is supported in %s" default-directory))
+         (if ans
+             nil
+           t))))))
 
 (defun cedet-cscope-version-check (&optional noerror)
   "Check the version of the installed CScope command.
-If optional programatic argument NOERROR is non-nil, then
-instead of throwing an error if CScope isn't available, then
+If optional programmatic argument NOERROR is non-nil,
+then instead of throwing an error if CScope isn't available,
 return nil."
   (interactive)
   (require 'inversion)
@@ -151,7 +163,14 @@ return nil."
            (message "CScope %s  - Good enough for CEDET." rev))
          t)))))
 
+(defun cedet-cscope-create/update-database (&optional dir)
+  "Create a CScope database in DIR.
+CScope will automatically choose incremental rebuild if
+there is already a database in DIR."
+  (interactive "DDirectory: ")
+  (let ((default-directory dir))
+    (cedet-cscope-create nil)))
+
 (provide 'cedet-cscope)
 
-;; arch-tag: 9973f1ad-f13b-4399-bc67-7f488478d78d
 ;;; cedet-cscope.el ends here