diff options
author | Chong Yidong <cyd@gnu.org> | 2012-10-02 02:10:29 +0800 |
---|---|---|
committer | Chong Yidong <cyd@gnu.org> | 2012-10-02 02:10:29 +0800 |
commit | 62a81506f802e4824b718cc30321ee3a0057cdf7 (patch) | |
tree | d681d7b767b1c3f7e4aee24ce39f6bef0d7f1f7e /lisp/cedet/semantic/db-global.el | |
parent | b3317662acc0157406c20c8e14c43b7126eaa8a0 (diff) | |
download | emacs-62a81506f802e4824b718cc30321ee3a0057cdf7.tar.gz emacs-62a81506f802e4824b718cc30321ee3a0057cdf7.tar.bz2 emacs-62a81506f802e4824b718cc30321ee3a0057cdf7.zip |
Update CEDET from upstream.
Diffstat (limited to 'lisp/cedet/semantic/db-global.el')
-rw-r--r-- | lisp/cedet/semantic/db-global.el | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/lisp/cedet/semantic/db-global.el b/lisp/cedet/semantic/db-global.el index eceb830341f..0d144483cb9 100644 --- a/lisp/cedet/semantic/db-global.el +++ b/lisp/cedet/semantic/db-global.el @@ -40,10 +40,17 @@ ;;; Code: ;;;###autoload -(defun semanticdb-enable-gnu-global-databases (mode) +(defun semanticdb-enable-gnu-global-databases (mode &optional noerror) "Enable the use of the GNU Global SemanticDB back end for all files of MODE. This will add an instance of a GNU Global database to each buffer -in a GNU Global supported hierarchy." +in a GNU Global supported hierarchy. + +Two sanity checks are performed to assure (a) that GNU global program exists +and (b) that the GNU global program version is compatibility with the database +version. If optional NOERROR is nil, then an error may be signalled on version +mismatch. If NOERROR is not nil, then no error will be signlled. Instead +return value will indicate success or failure with non-nil or nil respective +values." (interactive (list (completing-read "Enable in Mode: " obarray @@ -51,17 +58,18 @@ in a GNU Global supported hierarchy." t (symbol-name major-mode)))) ;; First, make sure the version is ok. - (cedet-gnu-global-version-check) - - ;; Make sure mode is a symbol. - (when (stringp mode) - (setq mode (intern mode))) - - (let ((ih (mode-local-value mode 'semantic-init-mode-hook))) - (eval `(setq-mode-local - ,mode semantic-init-mode-hook - (cons 'semanticdb-enable-gnu-global-hook ih)))) - + (if (not (cedet-gnu-global-version-check noerror)) + nil + ;; Make sure mode is a symbol. + (when (stringp mode) + (setq mode (intern mode))) + + (let ((ih (mode-local-value mode 'semantic-init-mode-hook))) + (eval `(setq-mode-local + ,mode semantic-init-mode-hook + (cons 'semanticdb-enable-gnu-global-hook ih)))) + t + ) ) (defun semanticdb-enable-gnu-global-hook () @@ -72,6 +80,8 @@ MODE is the major mode to support." (defclass semanticdb-project-database-global ;; @todo - convert to one DB per directory. (semanticdb-project-database eieio-instance-tracker) + + ;; @todo - use instance tracker symbol. () "Database representing a GNU Global tags file.") @@ -102,6 +112,11 @@ if optional DONT-ERR-IF-NOT-AVAILABLE is non-nil; else throw an error." ) "A table for returning search results from GNU Global.") +(defmethod object-print ((obj semanticdb-table-global) &rest strings) + "Pretty printer extension for `semanticdb-table-global'. +Adds the number of tags in this file to the object print name." + (apply 'call-next-method obj (cons " (proxy)" strings))) + (defmethod semanticdb-equivalent-mode ((table semanticdb-table-global) &optional buffer) "Return t, pretend that this table's mode is equivalent to BUFFER. Equivalent modes are specified by the `semantic-equivalent-major-modes' |