From: matz@... (Yukihiro Matsumoto) Date: 1997-09-02T10:05:20+09:00 Subject: [ruby-list:4030] Re: ruby-mode.el ... _end problem まつもと ゆきひろです In message "[ruby-list:4029] ruby-mode.el ... _end problem" on 97/09/02, Kikutani Makoto writes: |ruby-mode.el ですが、 |endの入った語を使うとインデンテーションがおかしくなりますね。 |これはしかたがないですか? ruby-1.1a5に入っているruby-mode.elでは直っているはずです. まだ取って来ていない人用にパッチを出しておきます. |# たれかjed用のruby-mode.sl書いてないかな? 前田さんが書いていたんじゃないかな? --- sample/ruby-mode.el~ Fri Aug 22 18:17:53 1997 +++ sample/ruby-mode.el Tue Sep 2 09:55:04 1997 @@ -34,3 +34,5 @@ (concat "[?$/%(){}#\"'`]\\|\\[\\|\\]\\|\\<\\(" - ruby-block-beg-re "\\|" ruby-block-end-re "\\)\\>") + ruby-block-beg-re + "\\|" ruby-block-end-re + "\\)\\>\\|^=begin") ) @@ -39,3 +41,3 @@ (concat "^[ \t]*\\(\\(" ruby-block-mid-re "\\)\\|\\(" - ruby-block-end-re "\\)\\>\\|\\}\\|\\]\\)") + ruby-block-end-re "\\)\\>[^_]\\|\\}\\|\\]\\)") ) @@ -192,3 +194,5 @@ (looking-at ruby-block-op-re) - (looking-at ruby-block-mid-re))))))) + (looking-at ruby-block-mid-re)) + (goto-char (match-end 0)) + (looking-at "[^_]")))))) @@ -286,9 +290,12 @@ ((looking-at ruby-block-end-re) - (if (and (not (bolp)) - (progn - (forward-char -1) - (eq ?_ (char-after (point)))) + (if (and (or (not (bolp)) + (progn + (forward-char -1) + (eq ?_ (char-after (point))))) (progn (goto-char pnt) - (eq ?_ (char-after (point))))) + (setq w (char-after (point))) + (or (eq ?_ w) + (eq ?! w) + (eq ?? w)))) nil @@ -303,3 +310,3 @@ (not (eq ?_ (char-after (point)))))) - (save-excursion + (progn (goto-char pnt) @@ -320,2 +327,7 @@ (goto-char pnt))) + ((looking-at "^=begin") + (if (re-search-forward "^=end" indent-point t) + (forward-line 1) + (setq in-string (match-end 0)) + (goto-char indent-point))) (t @@ -466,3 +478,3 @@ (interactive "p") - (and (re-search-forward (concat "^\\(" ruby-block-end-re "\\)\\b") + (and (re-search-forward (concat "^\\(" ruby-block-end-re "\\)\\b[^_]") nil 'move (or arg 1))