I program extensively in Python, and instead of using fancy debuggers I just use lots of print statements to figure out what my program is doing. I've set it up so that a typical function looks like this:
def do_something(*args, **kwargs):
verbose = True
verbose and print("Entered do_something with args: {0} and kwargs: {1}".format(args, kwargs))
for a in args:
verbose and print("Looping with {0}".format(a))
...
The idea is that since all my "debugging statements" are all on one line, grepping them out is easy enough if/when the time comes. Also, the logic lets me turn certain debugging statements on and off for each function, allowing me to customize what I want to see output into the console.
Anyway, what's annoying me is that they clutter up the place. I want to focus more on the actual code than on my debugger statements when glancing through. Hence, I wonder if emacs is capable of doing some sort of macro that says:
"Change the font color of any line that begins with "verbose" to grey" With the caveat that "begins with" here really means "after ignoring the leading whitespace."
So is it possible to "de-highlight" those verbose statements? Or maybe a macro that fill hide any such one-liners?
I'm a newbie with emacs, so be explicit :) I use Aquamacs on Mac OS X 10.6 if that makes any difference.