(defvar xref-current-project nil "current xref project, can be nil for no project")
(defvar xref-key-binding 'global "how xref should bind its keys, can be 'global, 'local or 'none")
(add-to-list 'load-path (expand-file-name "xref/emacs/" emacs-packages-dir))
(add-to-list 'exec-path (expand-file-name "xref/" emacs-packages-dir))
(load "xrefactory")
(global-set-key [(meta f5)] 'xref-pop-only)
(global-set-key [(meta f6)] 'xref-push-name)
(global-set-key [(f7)] 'xref-show-browser)
(global-set-key [(control f7)] 'xref-push-this-file-unused-symbols)
(global-set-key [(meta f7)] 'xref-push-global-unused-symbols)
(global-set-key [(f8)] 'xref-search-in-tag-file)
(global-set-key [(control f8)] 'xref-search-definition-in-tag-file)
(global-set-key [(meta f8)] 'xref-class-tree-show)
(defun xref-indent-complete ()
"A special indent/complete function"
(interactive)
(let ((oldpoint (point))
(java-or-c-mode-p (or (equal major-mode 'jde-mode) (equal major-mode 'c-mode)
(equal major-mode 'java-mode) (equal major-mode 'c++-mode))))
(if (mark-or-region-active)
(indent-region (mark) oldpoint nil)
(if (save-excursion (skip-chars-backward " \t") (not (bolp)))
(if java-or-c-mode-p
(xref-completion)
(hippie-expand 1))
(indent-for-tab-command)
(if (and java-or-c-mode-p (= oldpoint (point)) (looking-at "$"))
(xref-completion))))))
(define-key jde-mode-map [tab] 'xref-indent-complete)