Function: cedet-gnu-global-version-check

cedet-gnu-global-version-check is an interactive and byte-compiled function defined in cedet-global.el.gz.

Signature

(cedet-gnu-global-version-check &optional NOERROR)

Documentation

Check the version of the installed GNU Global command.

If optional programmatic argument NOERROR is non-nil, then instead of throwing an error if Global isn't available, return nil.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/cedet-global.el.gz
(defun cedet-gnu-global-version-check (&optional noerror)
  "Check the version of the installed GNU Global command.
If optional programmatic argument NOERROR is non-nil,
then instead of throwing an error if Global isn't available,
return nil."
  (interactive)
  (let ((b (condition-case nil
	       (cedet-gnu-global-call (list "--version"))
	     (error nil)))
	(rev nil))
    (if (not b)
	(progn
	  (when (called-interactively-p 'interactive)
	    (message "GNU Global not found."))
	  nil)
      (with-current-buffer b
	(goto-char (point-min))
        (re-search-forward
         (rx (or
              ;; global (Global) 6.6.10
              "global (Global)"
              (seq (opt "(") "GNU GLOBAL" (opt ")")))
             " "
             (group (one-or-more (any "0-9."))))
         nil t)
	(setq rev (match-string 1))
        (if (version< rev cedet-global-min-version)
	    (if noerror
		nil
	      (error "Version of GNU Global is %s.  Need at least %s"
		     rev cedet-global-min-version))
	  ;; Else, return TRUE, as in good enough.
	  (when (called-interactively-p 'interactive)
	    (message "GNU Global %s  - Good enough for CEDET." rev))
	  t)))))