Emacs Ruby method parameter indentation

删除回忆录丶 提交于 2019-12-03 04:26:28
Luke Girvin

Dmitry Gutov has posted this fix, using advice, which seems to work:

(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)))))

Ruby indentation in the current Emacs trunk (to be released as 24.4) works like you're asking without any additional tweaks.

I believe there is a key sequence like C-c o, that you could press with the cursor on that closing paren that would show what variable is used and let you type in a new value (like 0 or +). Try that!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!