This entry inaugurates my new emacs category, which I’ve already stocked with some old emacs-related posts. (Emacs is the infinitely extensible text editor with a soft spot in its heart for elisp.)
The emacs extension of the day is tabbar.el. I was feeling jealous of cool new Mac text editors like TextMate with their drawers and their clickable tab-like buttons. How I wished that emacs had a pop-out drawer, or at the very least, tabs.
So I googled for tabbed emacs, and found the magic elisp file at EMHACKS. (Download it from the tabbar files section.) In just a few short moments, I had tabs!
Although it is documented, tabbar has no handy start-up guide for beginners. With the help of Zhou Chen’s Emacs Tools page, I figured out that I needed to add
(require 'tabbar)
(tabbar-mode)
to my .emacs file just to get the tab bar to show up.
Next, I wanted to do a keybinding to get emacs to switch tabs with command-shift-left-arrow and command-shift-right-arrow, the way Safari and iTerm do. With the help of the emacs function keys info node, I found the right combination for my .emacs file:
(global-set-key [A-S-left] 'tabbar-backward)
(global-set-key [A-S-right] 'tabbar-forward)
[The above may depend on (setq mac-command-key-is-meta nil). If you don’t have that setting, then try M-S-left and M-S-right instead.] You can also assign ‘tabbar-backward-group and ‘tabbar-forward-group the same way, but ‘tabbar-backward and ‘tabbar-forward will scroll through groups as well so I didn’t bother.
I didn’t like the way tabbar assigned my buffers to groups, so I wrote my own version of the tabbar-buffer-groups function and put it in my .emacs file, too.
(more…)