BTW:
Just to extend this a little bit. The following (untested) code more or less should work.
``` (defun global-imeny-action (tag line regex) (goto-line line) (search-forward regex) (search-backward regex))
(defun my/parse (str) (let ((l (split-string str ":" t))) (list (car l) (string-to-number (nth 1 l)) #'global-imeny-action (nth 2 l))))
(defun my/imenu-create-index-function () (let ((file (buffer-file-name))) (when file (mapcar #'my/parse (with-temp-buffer (shell-command (concat "global -f --result \"grep\" " file) t)
(split-string (buffer-string) "\n" t) )))))
(setq imenu-create-index-function #'my/imenu-create-index-function) ```
BTW:
Just to extend this a little bit. The following (untested) code more or less should work.
```
(defun global-imeny-action (tag line regex)
(goto-line line)
(search-forward regex)
(search-backward regex))
(defun my/parse (str) to-number (nth 1 l)) imeny-action
(let ((l (split-string str ":" t)))
(list (car l)
(string-
#'global-
(nth 2 l))))
(defun my/imenu- create- index-function () file-name) ))
(with-temp- buffer
(let ((file (buffer-
(when file
(mapcar #'my/parse
(shell-command (concat "global -f --result \"grep\" " file) t)
(split-string (buffer-string) "\n" t)
)))))
(setq imenu-create- index-function 'my/imenu- create- index-function)
#
```