New Category: Emacs

| | Comments (0)

I'm an emacs freak. I've been an emacs freak for... forever... no, since 1991. Anyhow, I've been continually evolving my emacs setup (under revision control) since 1996 and am always looking for things to increase my productivity without being too heavyweight. I'll share what I can here. I'll start with one of my new favorites:

(define-key isearch-mode-map (kbd "C-o")
  (lambda ()
    (interactive)
    (let ((case-fold-search isearch-case-fold-search))
      (occur (if isearch-regexp isearch-string
               (regexp-quote isearch-string))))))

This adds an extra keybinding to interactive search (C-s) that runs occur on the current search string/regexp, immediately showing all hits in the entire buffer. I use it all the time now. Example:

C-M-s ^ *\(class\|module\|def\) C-o

quickly gives me an index of the entire file:

24 matches for "^ *\(class\|module\|def\)" in buffer: autotest.rb
     57:class Autotest
     61:  def self.run
     67:  def initialize
     77:  def run
     ... and so on ...

and C-s somemethodiamrefactoring C-o

immediately shows me all the call points of the method I'm planning to refactor.

[edit: from http://www.emacswiki.org/cgi-bin/wiki/OccurFromIsearch ]

Leave a comment

About this Entry

This page contains a single entry by zenspider published on February 26, 2007 6:29 PM.

heckle version 1.3.0 has been released! was the previous entry in this blog.

Control your emacs frames programatically is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.32-en