These days I’m working to become proficient in Emacs (I’ve recently switched from Vim, as Greg mentioned on his blog). With that comes all kinds of things like org-mode, yasnippet, and lots of keyboard combinations.
A part of this current effort I’m learning Emacs Lisp right now. There’s probably a better way to do block comment cycling in Ruby, but this was good practice on writing some simple elisp functions.
(defun ruby-comment-region () "In Ruby, comment out the current region with =begin/=end statements." (interactive) (save-excursion (goto-char (point)) (insert "=end") (goto-char (mark)) (insert "=begin\n"))) (defun ruby-uncomment-region () "In Ruby, uncomment the current region -- remove =begin/=end statements." (interactive) (save-excursion (if (re-search-backward "^=begin") (replace-match "")) (if (re-search-forward "^=end") (replace-match ""))))