Categories
Emacs Programming Technology Tutorial

Power Programming with Tags

Source tagging is a powerful source code navigation system that rivals modern IDEs. If you're using Emacs, Vim, or TextMate, you can use ctags for fast code navigation. Here are the steps to set it up.

Step 1: Install ctags

For Mac:

$ sudo port install ctags

Step 2: Create a Tag File

Navigate to your project and generate tags:

$ cd /Users/username/Workspace/rails-project
$ ctags -e -a --Ruby-kinds=+f -o TAGS -R app/ lib/ config/

You can add this to your crontab to regenerate tags automatically (e.g., daily at 11:30am).

Step 3: Using Tags in Your Editor

Emacs

M-.     Follow a tag
M-*     Jump back to source

Vim

Add this to your ~/.vimrc:

set tags=TAGS;/

Then use these commands:

C-]         Go to definition
C-T         Jump back from definition
C-W C-]     Open definition in horizontal split

TextMate

TextMate can also use ctags files. Configure it to read the TAGS file in your project root. WordPress ID: 1024

By Shishir Sharma

Shishir Sharma is a Software Engineering Leader, husband, and father based in Ottawa, Canada. A hacker and biker at heart, and has built a career as a visionary mentor and relentless problem solver.

With a leadership pedigree that includes LinkedIn, Shopify, and Zoom, Shishir excels at scaling high-impact teams and systems. He possesses a native-level mastery of JavaScript, Ruby, Python, PHP, and C/C++, moving seamlessly between modern web stacks and low-level architecture.

A dedicated member of the tech community, he serves as a moderator at LUG-Jaipur. When he’s not leading engineering teams or exploring new technologies, you’ll find him on the open road on his bike, catching an action movie, or immersed in high-stakes FPS games.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.