« | Main | »

June 12, 2009

Here's my wish for today...context-sensitive delimiters in emacs. That is, instead of typing the actual literal character, have emacs adapt it to the language you're using, and even the construct you're creating. Here's a concrete example:

Suppose, in Ruby, I'm going over an array, lst = [1,2,3,4], printing every item, I would do something like:
lst.each { |x| puts x }
But, say, now that I want to do something before I print it. So, without this emacs wet-dream, I would move the puts x to a new line, put the } below that, and since I think brackets are ugly I'd change the { to a do and the { to an end, like so:
  1. lst.each { |x| puts x }
    
  2. lst.each { |x| 
      puts x }
    
  3. lst.each { |x| 
      puts x 
    }
    
  4. lst.each do |x| 
      puts x 
    }
    
  5. lst.each do |x| 
      puts x 
    end
    
  6. Then insert whatever else
So, what I'm saying is that I'd like this in one step. I'd also like to be taller.



Posted by jeff at June 12, 2009 09:39 AM