>>>>> In [ruby-dev : No.24634] >>>>> Daiki Ueno <ueno / unixuser.org> wrote: > ruby-mode 使用時に、次のようなコードの直後でインデントが狂うのが気になっ > ています。 > puts(<<-End) > ... > End > # <- ここで TAB > 手元では以下のパッチでしのいでいますが、よろしければ取り込んでいただけな > いでしょうか。 すみません。先程のパッチでは、次のような場合に対応していませんでした。 1.times{puts(<<-End)} ... End # <- ここで TAB 修正版を以下に添付いたします。 Index: ruby-mode.el =================================================================== RCS file: /src/ruby/misc/ruby-mode.el,v retrieving revision 1.83 diff -u -F^( -r1.83 ruby-mode.el --- ruby-mode.el 17 Aug 2004 09:02:39 -0000 1.83 +++ ruby-mode.el 29 Oct 2004 07:26:29 -0000 @@ -521,10 +521,23 @@ (defun ruby-parse-partial (&optional end (looking-at "<<\\(-\\)?\\(\\([\"'`]\\)\\([^\n]+?\\)\\3\\|\\sw+\\)")) (setq re (regexp-quote (or (match-string 4) (match-string 2)))) (if (match-beginning 1) (setq re (concat "\\s *" re))) - (if (re-search-forward (concat "^" re "$") end 'move) - (forward-line 1) - (setq in-string (match-end 0)) - (goto-char end))) + (let* ((id-end (goto-char (match-end 0))) + (line-end-position (save-excursion (end-of-line) (point))) + (state (list in-string nest depth pcol indent))) + ;; parse the rest of the line + (while (and (> line-end-position (point)) + (setq state (apply 'ruby-parse-partial + line-end-position state)))) + (setq in-string (car state) + nest (nth 1 state) + depth (nth 2 state) + pcol (nth 3 state) + indent (nth 4 state)) + ;; skip heredoc section + (if (re-search-forward (concat "^" re "$") end 'move) + (forward-line 1) + (setq in-string id-end) + (goto-char end)))) (t (goto-char pnt)))) ((looking-at "^__END__$") -- Daiki Ueno