From: Dan Schmidt Date: 2002-12-21T10:37:25+09:00 Subject: Python-style indentation for Ruby, in 8 lines of Emacs Lisp! I like Ruby a lot, but I really dislike seeing the following in the middle of my code all the time: end end end I'm not offended nearly so much by some other languages' } } } because there's much less clutter and my eye isn't fooled into saying 'Ooh, a word, it must be important!' (For the same reason, I use _ instead of self when I write Python code.) Anyway, it occured to me that there might be an easy way to get 90% of what I want, just by making the keyword 'end' be almost invisible. With this change, Ruby code looks just like Python (whose style I like, and if you don't, just stop reading here instead of expressing your disapproval), except with a few more blank-with-subliminal-text lines. Here's how I did it. 1. Put the following code in your .emacs or wherever: (defface font-lock-subliminal-face '((t :inherit default :foreground "#eee")) "Font Lock mode face used for subliminal text." :group 'font-lock-highlighting-faces) (defvar font-lock-subliminal-face 'font-lock-subliminal-face "Face name to use for things that should be barely visible.") 2. In ruby-mode.el, add the marked two lines at the beginning of the definition of ruby-font-lock-keywords: (defvar ruby-font-lock-keywords (list + '("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(end\\)\\b\\([^_]\\|$\\)" + 2 font-lock-subliminal-face) (cons (concat "\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(" (mapconcat 'identity '("alias" "and" "begin" Use M-x customize-face if you don't like the color choice. This simple change increased the comprehensibility of Ruby code by a large amount for me. Your mileage will undoubtedly vary, but if you think you might like it, give it a shot. Dan -- http://www.dfan.org