summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2013-06-22 03:14:38 +0400
committerDmitry Gutov <dgutov@yandex.ru>2013-06-22 03:14:38 +0400
commit5cf8176d5504a3d9152902a2877b5d76d0f27f1d (patch)
tree43f0b1d7df4936441d9d37790bde93c407346c5b
parent73eab938a0ff50e744a769c89816e621a11e0ac3 (diff)
downloademacs-5cf8176d5504a3d9152902a2877b5d76d0f27f1d.tar.gz
emacs-5cf8176d5504a3d9152902a2877b5d76d0f27f1d.tar.bz2
emacs-5cf8176d5504a3d9152902a2877b5d76d0f27f1d.zip
* lisp/progmodes/ruby-mode.el (auto-mode-alist): Consolidate different
entries into one regexp and add more *file-s.
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/progmodes/ruby-mode.el14
2 files changed, 11 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 64cb8574db3..966b70ea0bd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -3,6 +3,8 @@
* progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
keyword-like methods on Kernel and Module with
font-lock-builtin-face.
+ (auto-mode-alist): Consolidate different entries into one regexp
+ and add more *file-s.
2013-06-21 Stephen Berman <stephen.berman@gmx.net>
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index fe44647dcce..f827b447136 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -1867,11 +1867,15 @@ The variable `ruby-indent-level' controls the amount of indentation.
;;; Invoke ruby-mode when appropriate
;;;###autoload
-(add-to-list 'auto-mode-alist (cons (purecopy "\\.rb\\'") 'ruby-mode))
-;;;###autoload
-(add-to-list 'auto-mode-alist (cons (purecopy "Rakefile\\'") 'ruby-mode))
-;;;###autoload
-(add-to-list 'auto-mode-alist (cons (purecopy "\\.gemspec\\'") 'ruby-mode))
+(add-to-list 'auto-mode-alist
+ (cons (purecopy (concat "\\(?:\\."
+ (regexp-opt '("rb" "ru" "rake" "thor"
+ "jbuilder" "gemspec"))
+ "\\|/"
+ (regexp-opt '("Gemfile" "Rakefile"
+ "Capfile" "Thorfile"
+ "Vagrantfile"))
+ "\\)\\'")) 'ruby-mode))
;;;###autoload
(dolist (name (list "ruby" "rbx" "jruby" "ruby1.9" "ruby1.8"))