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.
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
(require 'rtags) (cmake-ide-setup) (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!
Bring Your Own Cause
If you think any info here has remotely helped you consider dropping a penny for this cause, just click me . You can visit https://www.bbc.com/news/world-asia-india-52672764 Unfortunately, there are plenty of sad things happening all over the world, if you have a different cause or charity you'd rather support please do. And if you did make a donation, please drop a note to me (annotated) or leave a comment here (anonymous is OK!) and I will use that as motivation to write more useful content here.
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.