Manoj Rao bio photo

Manoj Rao

Your Average Common Man

Email Twitter Github

For years, I have been battling hard to find an optimal setup on my Emacs. Finally, after sufficient patience I think I have found a tags setup that is not too crufty to navigate. I have visited rtags home page for long enough, I even watched the famous cmake-ide evangelist’s video but never really figured out how to get my Emacs to behave with rtags.

Now, what I am doing requires to navigate a large C++ codebase like nobody’s business and things were getting serious. So, I decided to spend the weekend looking closely into this.

At first, I wanted everything to work out of the box then I realized this was a pipe dream so I started the rdm server from terminal and ran the indexer from command line too (Gross!)

However, after enough digging and sifting through the following links here I have a working out of the box rtags/cmake-ide setup. I’m sharing the final output here. I am running Emacs 26.1 compiled from source.


Rtags jump

tl;dr: The complete code to get rtags working out of the box

First clone the rtags repo inside your ~/.emacs.d directory and build the repo based on the instructions provided in the rtags home page

(require 'rtags)
(add-hook 'c-mode-hook 'rtags-start-process-unless-running)
(add-hook 'c++-mode-hook 'rtags-start-process-unless-running)

(use-package rtags
  :ensure t
  :hook (c++-mode . rtags-start-process-unless-running)
  :config (setq rtags-completions-enabled t
		rtags-path "/home/manoj/.emacs.d/rtags/src/rtags.el"
		rtags-rc-binary-name "/home/manoj/.emacs.d/rtags/bin/rc"
		rtags-use-helm t
		rtags-rdm-binary-name "/home/manoj/.emacs.d/rtags/bin/rdm")
  :bind (("C-c E" . rtags-find-symbol)
  	 ("C-c e" . rtags-find-symbol-at-point)
  	 ("C-c O" . rtags-find-references)
  	 ("C-c o" . rtags-find-references-at-point)
  	 ("C-c s" . rtags-find-file)
  	 ("C-c v" . rtags-find-virtuals-at-point)
  	 ("C-c F" . rtags-fixit)
  	 ("C-c f" . rtags-location-stack-forward)
  	 ("C-c b" . rtags-location-stack-back)
  	 ("C-c n" . rtags-next-match)
  	 ("C-c p" . rtags-previous-match)
  	 ("C-c P" . rtags-preprocess-file)
  	 ("C-c R" . rtags-rename-symbol)
  	 ("C-c x" . rtags-show-rtags-buffer)
  	 ("C-c T" . rtags-print-symbol-info)
  	 ("C-c t" . rtags-symbol-type)
  	 ("C-c I" . rtags-include-file)
  	 ("C-c i" . rtags-get-include-file-for-symbol)))

(setq rtags-display-result-backend 'helm)



Happy New Year! See you more often in 2020!

My Podcast!

If you like topics such as this then please consider subscribing to my podcast. I talk to some of the stalwarts in tech and ask them what their favorite productivity hacks are:

Available on iTunes Podcast

Visit Void Star Podcast’s page on iTunes Podcast Portal. Please Click ‘Subscribe’, leave a comment.

Get it iTunes

Available on Google Play Music

Visit Void Star Podcast’s page on Google Play Music. Please Click ‘Subscribe’ and leave a comment.

Listen on Google Play Music
Available on Stitcher

Visit Void Star Podcast’s page on Sticher. Please Click ‘Subscribe’ and leave a comment.

Listen to Stitcher

Your app not listed here? Not an issue..

You should be able to search for ‘VoidStar Podcast’ on your favorite app. Most apps use one of the above sources for listing podcasts. This was tested on Podcast Addict (where you can also specify the search engine) and RatPoison on Android.