Emacs: March 2007 Archives

toggle.el

| | Comments (0)

I just released toggle.el, allowing you to quickly open corresponding files via a dynamic mapping.

From the description:

This package provides the ability to quickly open a corresponding file for the current buffer by using a bi-directional mapping of regular expression pairs. You can select a mapping style from toggle-mapping-styles using the toggle-style function or set your default style via the toggle-mapping-style variable.

There are 3 different mapping styles in this version: zentest, rails, and ruby. Feel free to submit more and I'll incorporate them.

Example Mapping (ruby style):

blah.rb <-> test_blah.rb
lib/blah.rb <-> test/test_blah.rb

Get it (and other packages I'll release soon) via: http://www.emacswiki.org/cgi-bin/wiki/RyanDavis

autotest bindings

| | Comments (0)

I should add that I keep the previous autotest code in autotest.el and the following in my setup-modes.el (I have my emacs setup broken up):

(autoload 'autotest-switch "autotest" "doco" t)
(autoload 'autotest "autotest" "doco" t)
(add-hook 'ruby-mode-hook
          '(lambda ()
             (define-key ruby-mode-map (kbd "C-c C-a") 'autotest-switch))

This allows me to use C-c C-a to toggle back and forth between autotest and ruby files. I should also have it hooked in for grep buffers and other things, but I'll leave that as an exercise for the reader. :P

autotest for emacs

| | Comments (0)

I've been using this for a while now. It works pretty well for me, but I'm sure stuff could be ironed out and made a bit smoother/cleaner. Please provide any and all suggestions/patches as you see fit. This will be incorporated and eventually released with ZenTest once it feels good.

autotest.el behind the cut.

locate and spotlight

| | Comments (0)

locate and spotlight each have their pros and cons. I like both for different reasons, but recently I caught on to using mdfind (spotlight's command-line interface) to search for file-names only. It is still a little slower than locate (but not much) but always up to date:

(defun locate-make-mdfind-command-line (search-string)
  (list "mdfind" (concat "kMDItemDisplayName=*" search-string "*")))

(defun spotlight ()
  "Search for files by name using spotlight"
  (interactive)
  (let ((locate-command "mdfind")
        (locate-make-command-line 'locate-make-mdfind-command-line))
    (call-interactively 'locate nil)))

(defun spotlight-full ()
  "Search using spotlight"
  (interactive)
  (let ((locate-command "mdfind"))
    (call-interactively 'locate nil)))

If you're feeling adventurous, keep the first defun and set locate-command and locate-make-command-line via customize. I did that for a few weeks but I like the flexibility of having both available.