Created
December 3, 2011 14:20
-
-
Save dotemacs/1427240 to your computer and use it in GitHub Desktop.
Add multiple file extensions to major modes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Instead of this | |
| (add-to-list 'auto-mode-alist '("\\.rake$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("\\.gemspec$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("\\.ru$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("Capfile$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("Vagrantfile$" . ruby-mode)) | |
| ;; maybe try this: | |
| (defun add-to-mode (mode &rest files) | |
| (dolist (file files) | |
| (add-to-list 'auto-mode-alist | |
| (cons file mode)))) | |
| (add-to-mode 'ruby-mode | |
| "\\.rake$" | |
| "\\.gemspec$" | |
| "\\.ru$" | |
| "\\(Cap\\|Gem\\|Rake\\|Vagrant\\)file$" | |
| "^\\.irbrc$") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment