syohex / emacs-counsel-gtags

GNU Global with ivy completion
62 stars 20 forks source link

counsel-gtags-dwim: Automatically select only candidate #13

Closed fabacino closed 7 years ago

fabacino commented 7 years ago

If there is only a single candidate, we jump directly to its definition or reference.

This only affects counsel-gtags-dwim and does not change the behaviour of counsel-gtags-find-definition, counsel-gtags-find-reference and counsel-gtags-find-symbol. The reason for this is that point might not be on the symbol you want to search for when calling counsel-gtags-find-definition, which could lead to an unintentional jump. To avoid this you would have to make sure that point is not an a symbol before calling counsel-gtags-find-definition which would be rather annoying. The same reasoning applies to counsel-gtags-find-reference and counsel-gtags-find-symbol. On the other hand, when calling counsel-gtags-dwim, the user is obviously interested in the definition or reference at point, therefore the jump is always intentional. I hope this makes sense.

This fixes issue #7

syohex commented 7 years ago

Thanks for PR. I have cherry-picked.