branch: externals/gtags-mode
commit 076ae4a55eadd3c5f18ea7b9dc5005b026ca1cff
Author: Jimmy Aguilar Mena <[email protected]>
Commit: Jimmy Aguilar Mena <[email protected]>
Fall back to default on imenu.
When gtags-mode-imenu-create-index-function doesn't apply, use the
default one.
---
gtags-mode.el | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/gtags-mode.el b/gtags-mode.el
index 09f47805e9..e0502da9fe 100644
--- a/gtags-mode.el
+++ b/gtags-mode.el
@@ -281,11 +281,14 @@ Return as a list of xref location objects."
(defun gtags-mode-imenu-create-index-function ()
"Make imenu use Global."
- (when buffer-file-name
- (gtags-mode--filter-find-symbol
- '("--file") (file-name-nondirectory buffer-file-name)
- (lambda (name _code _file line)
- (list name line #'gtags-mode--imenu-goto-function)))))
+ (if (and buffer-file-name gtags-mode--plist)
+ (gtags-mode--filter-find-symbol
+ '("--file") (file-name-nondirectory buffer-file-name)
+ (lambda (name _code _file line)
+ (list name line #'gtags-mode--imenu-goto-function)))
+ ;; Else try to use the default function.
+ (when (functionp gtags-mode--imenu-default-function)
+ (funcall gtags-mode--imenu-default-function))))
;; project integration ===============================================
(defun gtags-mode-project-backend (dir)