Skip to content

Instantly share code, notes, and snippets.

@vmi
Created June 28, 2012 03:04
Show Gist options
  • Save vmi/3008607 to your computer and use it in GitHub Desktop.
Save vmi/3008607 to your computer and use it in GitHub Desktop.
change buffer name for chef
;;; Chef's cookbooks has too many "default.rb".
;;; This hook is for detecting each "default.rb".
(defun chef-rename-buffer ()
(let ((fn (buffer-file-name)))
(and (stringp fn)
(string-match "/cookbooks/\\(.+\\)" fn)
(rename-buffer (match-string 1 fn) t))))
(add-hook 'find-file-hook
'chef-rename-buffer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment