Emacs Ruby方法参数缩进

我想让emacs缩进ruby方法调用,如:

foo( :blah => 'bar', :shibby => 'baz' ) 

我能得到的最接近的是:

 foo( :blah => 'bar', :shibby => 'baz' ) 

这是使用ruby-deep-indent-paren,ruby-deep-indent-paren-style,ruby-deep-arglist全部设置为nil。

哈希缩进我喜欢的方式…如果我可以像哈希那样使方法调用缩进,我会很高兴。 有任何想法吗?

Dmitry Gutov使用建议发布了此修复程序 ,这似乎有效:

 (defadvice ruby-indent-line (after unindent-closing-paren activate) (let ((column (current-column)) indent offset) (save-excursion (back-to-indentation) (let ((state (syntax-ppss))) (setq offset (- column (current-column))) (when (and (eq (char-after) ?\)) (not (zerop (car state)))) (goto-char (cadr state)) (setq indent (current-indentation))))) (when indent (indent-line-to indent) (when (> offset 0) (forward-char offset))))) 

当前Emacs主干中的Ruby缩进(将作为24.4发布)就像你要求的那样没有任何额外的调整。

我相信有一个像Cc o这样的关键序列,你可以用光标按下关闭的paren,它会显示使用的变量,让你输入一个新值(如0或+)。 试试吧!