From: nobu.nakada@... Date: 2000-03-05T19:36:54+09:00 Subject: [ruby-dev:9370] [PATCH] ruby-mode.el なかだです。 この間 MatchData#begin とか使ったらインデントがみょーな感じなっ たのと、=begin RD ... =end もコメントとみなして欲しいなってのでパッ チです。あと yield と最後に改行が無いときにもハイライトするように してみました。 Sun Mar 5 18:49:06 2000 Nakada.Nobuyoshi * misc/ruby-mode.el (ruby-parse-region): not treat method `begin' and `end' as reserved words. * misc/ruby-mode.el (ruby-font-lock-docs): ignore after `=begin' and `=end'. * misc/ruby-mode.el (ruby-font-lock-keywords, hilit-set-mode-patterns): added `yield' to keywords. * misc/ruby-mode.el (ruby-font-lock-keywords, hilit-set-mode-patterns): matches keywords at end of buffer. --- misc/ruby-mode.el 2000/02/08 13:00:01 1.11 +++ misc/ruby-mode.el 2000/03/05 10:13:11 @@ -314,7 +314,9 @@ (if (or (and (not (bolp)) (progn (forward-char -1) - (eq ?_ (char-after (point))))) + (setq w (char-after (point))) + (or (eq ?_ w) + (eq ?. w)))) (progn (goto-char pnt) (setq w (char-after (point))) @@ -339,7 +341,9 @@ (or (bolp) (progn (forward-char -1) - (not (eq ?_ (char-after (point)))))) + (setq w (char-after (point))) + (not (or (eq ?_ w) + (eq ?. w))))) (goto-char pnt) (setq w (char-after (point))) (not (eq ?_ w)) @@ -622,12 +626,12 @@ (setq font-lock-keywords ruby-font-lock-keywords))) (defun ruby-font-lock-docs (limit) - (if (re-search-forward "^=begin\\s *$" limit t) + (if (re-search-forward "^=begin\\(\\s \\|$\\)" limit t) (let (beg) (beginning-of-line) (setq beg (point)) (forward-line 1) - (if (re-search-forward "^=end\\s *$" limit t) + (if (re-search-forward "^=end\\(\\s \\|$\\)" limit t) (progn (set-match-data (list beg (point))) t))))) @@ -672,12 +676,13 @@ "until" "when" "while" + "yield" ) "\\|") - "\\)\\>[^_]") + "\\)\\>\\([^_]\\|$\\)") 2) ;; variables - '("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\b[^_]" + '("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\b\\([^_]\\|$\\)" 2 font-lock-variable-name-face) ;; variables '("[$@].\\(\\w\\|_\\)*" @@ -708,8 +713,8 @@ ("^\\s *\\(require\\|load\\).*$" nil include) ("^\\s *\\(include\\|alias\\|undef\\).*$" nil decl) ("^\\s *\\<\\(class\\|def\\|module\\)\\>" "[)\n;]" defun) - ("[^_]\\<\\(begin\\|case\\|else\\|elsif\\|end\\|ensure\\|for\\|if\\|unless\\|rescue\\|then\\|when\\|while\\|until\\|do\\)\\>[^_]" 1 defun) - ("[^_]\\<\\(and\\|break\\|next\\|raise\\|fail\\|in\\|not\\|or\\|redo\\|retry\\|return\\|super\\|yield\\|catch\\|throw\\|self\\|nil\\)\\>[^_]" 1 keyword) + ("[^_]\\<\\(begin\\|case\\|else\\|elsif\\|end\\|ensure\\|for\\|if\\|unless\\|rescue\\|then\\|when\\|while\\|until\\|do\\|yield\\)\\>\\([^_]\\|$\\)" 1 defun) + ("[^_]\\<\\(and\\|break\\|next\\|raise\\|fail\\|in\\|not\\|or\\|redo\\|retry\\|return\\|super\\|yield\\|catch\\|throw\\|self\\|nil\\)\\>\\([^_]\\|$\\)" 1 keyword) ("\\$\\(.\\|\\sw+\\)" nil type) ("[$@].[a-zA-Z_0-9]*" nil struct) ("^__END__" nil label))))