summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/ruby-style.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/misc/ruby-style.el b/misc/ruby-style.el
index b99e71b35c..0fe4a83089 100644
--- a/misc/ruby-style.el
+++ b/misc/ruby-style.el
@@ -7,6 +7,14 @@
;;; $Author$
;;; created at: Thu Apr 26 13:54:01 JST 2007
;;;
+;;; sets ruby style if it seems like a source of ruby.
+;;;
+;;; (require 'ruby-style)
+;;; (add-hook 'c-mode-hook 'ruby-style-c-mode)
+;;; (add-hook 'c++-mode-hook 'ruby-style-c-mode)
+;;;
+;;; uses ruby style always.
+;;; (setq-default c-file-style "ruby")
(defconst ruby-style-revision "$Revision$"
"Ruby style revision string.")
@@ -56,7 +64,7 @@
(defun ruby-style-c-mode ()
(interactive)
- (if (or (string-match "/ruby\\>" (buffer-file-name))
+ (if (or (let ((name (buffer-file-name))) (and name (string-match "/ruby\\>" name)))
(save-excursion
(goto-char (point-min))
(let ((head (progn (forward-line 100) (point)))