I've been using Emacs for development for a few months now and am pretty happy with it.

I use the Rinari mode to provide some help when I'm working on Rails projects. Once I'm finished for the day (or changing to another project, I used to use the kill-some-buffers command and go through them one by one.

Here's some elisp that I've written and put in my .emacs file that just kills all buffers that link to files that are in the current rinari-root. It's probably not perfect, but it seems to work most of the time.

;; some rinari helpers
(defun kill-buffers-in-subdir (subdir buffer)
  "Kills the given buffer if it is linked to a file in the current rinari project."
  (if (buffer-in-subdir-p subdir buffer)
     (kill-buffer buffer)))

(defun buffer-in-subdir-p (subdir buffer) 
  "Returns true if buffer belongs to the current rinari project"
  (and (buffer-file-name buffer)
       (string-match subdir (buffer-file-name buffer))))

(defun kill-all-rinari-buffers ()
  "Kills all buffers linked to the current rinari project"
  (interactive)
  (let ((path (rinari-root)))
    (if path
	(dolist (buffer (buffer-list))
	  (kill-buffers-in-subdir path buffer)))))
blog comments powered by Disqus