I'm using helm-gtags-find-tag-from-here command a lot. It works fine as long as there is no change to the source file contains the definition of symbol under the cursor. However, if I modify the source file that contains definition of symbol, the command doesn't work as it always jumps to the old line number that contains definition, which has changed due to the modification.

It seems the tags are automatically-updated or there is some cache of the tags that keep referencing the old definition position. So, I issue helm-gtags-clear-all-cache but it doesn't work.

Currently, if I modify the file, I have to remove GPATH, GRTAGS, GTAG and regenerate them so that I can have the tags reflect the latest change. This is huge pain. So, I'm wondering what can go wrong?

Here is my setup for helm-gtags:

;; this variables must be set before load helm-gtags
;; you can change to any prefix key of your choice
(setq helm-gtags-prefix-key "\C-cg")

(use-package helm-gtags
    (setq helm-gtags-ignore-case t
          helm-gtags-auto-update t
          helm-gtags-use-input-at-cursor t
          helm-gtags-pulse-at-cursor t
          helm-gtags-prefix-key "\C-cg"
          helm-gtags-suggested-key-mapping t)

    ;; Enable helm-gtags-mode in Dired so you can jump to any tag
    ;; when navigate project tree with Dired
    (add-hook 'dired-mode-hook 'helm-gtags-mode)

    ;; Enable helm-gtags-mode in Eshell for the same reason as above
    (add-hook 'eshell-mode-hook 'helm-gtags-mode)

    ;; Enable helm-gtags-mode in languages that GNU Global supports
    (add-hook 'c-mode-hook 'helm-gtags-mode)
    (add-hook 'c++-mode-hook 'helm-gtags-mode)
    (add-hook 'java-mode-hook 'helm-gtags-mode)
    (add-hook 'asm-mode-hook 'helm-gtags-mode)

    ;; key bindings
    (with-eval-after-load 'helm-gtags
      (define-key helm-gtags-mode-map (kbd "C-c g a") 'helm-gtags-tags-in-this-function)
      (define-key helm-gtags-mode-map (kbd "C-j") 'helm-gtags-select)
      (define-key helm-gtags-mode-map (kbd "M-.") 'helm-gtags-dwim)
      (define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack)
      (define-key helm-gtags-mode-map (kbd "C-c <") 'helm-gtags-previous-history)
      (define-key helm-gtags-mode-map (kbd "C-c >") 'helm-gtags-next-history)
      (define-key helm-gtags-mode-map (kbd "<f5>") 'helm-gtags-find-tag-from-here)

(provide 'setup-helm-gtags)

1 Answer 1


You need to execute helm-gtags-update-tags to update the tag files. Quote README:

Update TAG file. Default is update only current file, You can update all files with C-u prefix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.