leoliu/ggtags

`ggtags-create-tags` blocks emacs ui

Closed this issue · 6 comments

On large projects, ggtags-create-tags (and ggtags-update-tags) completely blocks the ui for minutes, while only the message "`gtags' in progress..." is shown.

The problem can be reproduced with the linux kernel source tree.

The former only needs to run once so hopefully it is acceptable. The latter can run async if called interactively. But they both have to be blocking because it is needed by the command that triggers it in the first place.

Hi. Thanks for your prompt reply and the great package.

For my usage it would be better to abort the tag searching and generate the tag file in background. However that might not be the best option for most of the users.

Do you think it might be possible to make it customizable somehow?

Currently I'm replacing counsel-gtags--generate-tags to achieve that. But that's far from ideal since that's an internal function:

   (defun counsel-gtags--generate-tags ()
     (if (not (yes-or-no-p "File GTAGS not found. Run 'gtags'? "))
         (error "Abort generating tag files.")
       (let* ((root (read-directory-name "Root Directory: "))
              (label (counsel-gtags--select-gtags-label))
              (bpr-process-directory root)
              (bpr-close-after-success t))
         (bpr-spawn (concat "gtags -q --gtagslabel=" label))
         (error "gtags is generating tags....")))))

Don't know what counsel-gtags does. But in ggtags you will be prompted for the directory and if you don't want to proceed simply press C-g. You only need to create the tags once.

Sorry. I'm evaluating counsel-gtags and I mixed up the packages.

 (defun ggtags-create-tags (root)
   (interactive "DRoot directory: ")
     (let* ((label (if (yes-or-no-p "Use `ctags' backend? ")
                       "ctags" "default"))
            (bpr-process-directory root)
            (bpr-close-after-success t))
       (bpr-spawn (concat "gtags -q --gtagslabel=" label))
       (error "Gtags is generating tags")))

But it doesn't have the same issue as counsel-gtags--generate-tags since it's not internal.

If you are in a situation where you have to frequently run ggtags-create-tags it might be worth looking into it first. Otherwise it is good to use advice to modify the behaviour of ggtags-create-tags to suit your needs better.

Thanks.