emacsorphanage / helm-gtags

GNU GLOBAL helm interface
203 stars 32 forks source link

Show all references #192

Closed piratkin closed 3 years ago

piratkin commented 3 years ago

I can't get a reference to the symbol under the cursor to be displayed, dwim is a more appropriate choice, but in the case of a function, it shows / goes to the declaration.

;- on function symbol then show its definition
;- on variable symbol then show its reference
(defun my1_helm-gtags-find-rtag ()
  (interactive
   (helm-gtags-dwim)))

;- on function symbol then doing nothing
;- on variable symbol then show its reference
(defun my2_helm-gtags-find-rtag ()
  (interactive
  (helm-gtags-find-symbol (thing-at-point 'symbol))))

;- on variable symbol then doing nothing
;- on function symbol then show its reference
(defun my3_helm-gtags-find-rtag ()
  (interactive
  (helm-gtags-find-rtag (thing-at-point 'symbol))))

;- on variable symbol then doing nothing
;- on function symbol then show its definition
(defun my4_helm-gtags-find-rtag ()
  (interactive
  (helm-gtags-find-tag (thing-at-point 'symbol))))
jcs090218 commented 3 years ago

Hmm... not quite sure what you are trying to do here. I guess you would like to call call-interactively like

(call-interactively 'helm-gtags-find-tag)

Can you elaborate a bit more your issue? Thanks! 😕

piratkin commented 3 years ago

My config:

(use-package ggtags
  :ensure t
  :config
  (progn
    (setq ggtags-update-on-save t)
    (setq ggtags-completing-read-function 'nil)
    (setq-local eldoc-documentation-function #'ggtags-eldoc-function)
    (setq-local imenu-create-index-function #'ggtags-build-imenu-index)
    (add-hook 'c-mode-common-hook
          (lambda ()
            (when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
              (ggtags-mode 1))))
    (eldoc-mode t)))

(use-package helm
  :ensure t
  :config
  (progn
    (setq helm-full-frame t)
    (setq helm-input-idle-delay 0.05))
  (helm-mode 1))

(use-package helm-gtags
  :ensure t
  :requires (ggtags)
  :init
  (progn
    (setq helm-gtags-fuzzy-match t))
  :config
  (progn
    (setq helm-gtags-auto-update t)
    (setq helm-gtags-use-input-at-cursor t)
    (add-hook 'c-mode-common-hook
              (lambda ()
                (when (derived-mode-p 'c-mode 'c++-mode)
                  (helm-gtags-mode 1))))))

(defun my_helm-gtags-find-rtag ()
  (interactive
  (call-interactively 'helm-gtags-find-tag)))

The result is unchanged.

Probably in the case of helm-gtags-find-symbol, the links are not drawn from the tags file, perhaps somehow directly from the global. Detected, if I call gtags-find-reference then it also finds nothing, the result is:

`lisp Global found 0 references

But if you call ggtags-find-other-symbol or ggtags-find-tag-dwim, then the references are displayed.

helm-gtags seems to work correctly, the problem occurs in gtags.