From: Dmitry Gutov Date: Sun, 22 Dec 2013 20:38:26 +0000 (+0200) Subject: * lisp/progmodes/ruby-mode.el (ruby--electric-indent-p): Improve the X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~240 X-Git-Url: https://code.delx.au/gnu-emacs/commitdiff_plain/1f87a56cc78b25d96fedd0f49a93cbe5b33dedec * lisp/progmodes/ruby-mode.el (ruby--electric-indent-p): Improve the comments. Handle electric indent after typing `?' and `!'. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8034a74809..d303bc215d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-12-22 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby--electric-indent-p): Improve the + comments. Handle electric indent after typing `?' and `!'. + 2013-12-22 Chong Yidong * faces.el (face-spec-recalc): If the theme specs are not diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 3308651b0e..51117e59f7 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -779,15 +779,15 @@ The style of the comment is controlled by `ruby-encoding-magic-comment-style'." (defun ruby--electric-indent-p (char) (cond ((memq char ruby--electric-indent-chars) - ;; Outdent after typing a closing paren. + ;; Reindent after typing a char affecting indentation. (ruby--at-indentation-p (1- (point)))) ((memq (char-after) ruby--electric-indent-chars) - ;; Reindent after inserting something before a closing paren. + ;; Reindent after inserting something in front of the above. (ruby--at-indentation-p (1- (point)))) - ((or (memq (char-syntax char) '(?w ?_))) + ((or (and (>= char ?a) (<= char ?z)) (memq char '(?_ ?? ?! ?:))) (let ((pt (point))) (save-excursion - (skip-syntax-backward "w_") + (skip-chars-backward "[:alpha:]:_?!") (and (ruby--at-indentation-p) (looking-at (regexp-opt (cons "end" ruby-block-mid-keywords))) ;; Outdent after typing a keyword.