Or maybe better this if you don't want to use the `--result \"grep\"`:
(defun my/global-imeny-action (tag line regex) (goto-line line) (search-forward regex) (search-backward regex))
(defun myparse (str) (when (string-match "\\(^[^ ]+\\)[[:blank:]]+\\([[:digit:]]+\\) [^ ]+[[:blank:]]\\{2,\\}\\(.+\\)" str) (list (match-string-no-properties 1 str) (string-to-number (match-string-no-properties 2 str)) #'my/global-imeny-action (match-string-no-properties 3 str))))
(defun my/imenu-create-index-function () (let ((file (buffer-file-name))) (when file (mapcar #'myparse (with-temp-buffer (shell-command (concat "global -f " file) t)
(split-string (buffer-string) "\n" t) )))))
(setq imenu-create-index-function #'my/imenu-create-index-function)
Or maybe better this if you don't want to use the `--result \"grep\"`:
(defun my/global- imeny-action (tag line regex)
(goto-line line)
(search-forward regex)
(search-backward regex))
(defun myparse (str) :blank: ]]+\\([ [:digit: ]]+\\) [^ ]+[[:blank: ]]\\{2, \\}\\(. +\\)" str) string- no-properties 1 str) to-number (match- string- no-properties 2 str)) global- imeny-action string- no-properties 3 str))))
(when (string-match "\\(^[^ ]+\\)[[
(list (match-
(string-
#'my/
(match-
(defun my/imenu- create- index-function () file-name) ))
(with-temp- buffer
(let ((file (buffer-
(when file
(mapcar #'myparse
(shell-command (concat "global -f " file) t)
(split-string (buffer-string) "\n" t)
)))))
(setq imenu-create- index-function 'my/imenu- create- index-function)
#