Hi, At Mon, 21 Jan 2002 08:31:53 +0900, Michael Witrant <mike / lepton.fr> wrote: > I'm having trouble with emacs' ruby-mode. > > The following "foo" is correctly indented: > puts %{ { } } > foo > > While this one isn't: > puts %{ #{ } } > foo The patch may fix it. > I often use the second one to dynamically produce Ruby code and I would > like it indented like static code. Most of the time it works, but in > this case ruby-mode probably see #{ as a comment instead of a command > substitution. The cause was that %{ after a word wasn't counted a beginning of string literal. Therefore #{ was counted a comment outside of string. And %w!...! was missing.
Index: ruby-mode.el =================================================================== RCS file: /cvs/ruby/src/ruby/misc/ruby-mode.el,v retrieving revision 1.43 diff -u -2 -p -r1.43 ruby-mode.el --- ruby-mode.el 2002/01/18 14:24:01 1.43 +++ ruby-mode.el 2002/01/21 20:49:58 @@ -253,7 +253,8 @@ The variable ruby-indent-level controls (goto-char (match-end 0)) (looking-at "\\>")) + ((eq option 'expr-arg) + (looking-at "[a-zA-Z][a-zA-z0-9_]* +%[Qqrxw]?\\Sw")) (t - (and (not (eq option 'expr-arg)) - (looking-at "[a-zA-Z][a-zA-z0-9_]* +/[^ \t]")))))))))) + (looking-at "[a-zA-Z][a-zA-z0-9_]* +/[^ \t]"))))))))) (defun ruby-forward-string (term &optional end no-error expand) @@ -754,5 +755,5 @@ An end of a defun is found by moving for (6 (7 . ?/))) ;; %Q!...! - ("\\(^\\|[[\\s <+(,=]\\)%[xrqQ]?\\([^a-zA-Z0-9 \n]\\)[^\n\\\\]*\\(\\\\.[^\n\\\\]*\\)*\\(\\2\\)" + ("\\(^\\|[[\\s <+(,=]\\)%[xrwqQ]?\\([^a-zA-Z0-9<({[ \n]\\)[^\n\\\\]*\\(\\\\.[^\n\\\\]*\\)*\\(\\2\\)" (2 (7 . nil)) (4 (7 . nil)))
-- Nobu Nakada