brendan/emacs.d — comment on commit 2a17c4b26b3f446847d247a2e58a2187b8a39778
File: enabled/tab-width-switch.el line 32
By jpr5:

Or how about this:

;; Cycle through these widths, buffer-locally. List of 2 is effectively a toggle.
(setq-default tab-widths '(2 4 8))

(defun cycle-tab-width ()
"Cycle through tab widths"
(interactive)
(make-variable-buffer-local 'tab-widths)
(setq tab-width (pop tab-widths))
(nconc tab-widths (list tab-width))
(setq ruby-indent-level tab-width)
(message "Tab-width set to %d." tab-width)
(redraw-display))