という訳で、最新版です。関数呼び出しの括弧の中に if があっても大丈夫なはずです。 (defvar ruby-elect-keyword '("def" "if" "class" "module" "unless" "case" "while" "do" "until" "for" "begin" "end")) (defvar ruby-elect-regex (mapconcat (lambda (x) (format "\\<%s\\>" x)) ruby-elect-keyword "\\|")) (defun ruby-elect-end () (interactive) (insert "d") (when (and (char-equal (char-before (1- (point))) ?n) (char-equal (char-before (- (point) 2