aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/progmodes/ruby-mode.el8
2 files changed, 9 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8034a748099..d303bc215d8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12013-12-22 Dmitry Gutov <dgutov@yandex.ru>
2
3 * progmodes/ruby-mode.el (ruby--electric-indent-p): Improve the
4 comments. Handle electric indent after typing `?' and `!'.
5
12013-12-22 Chong Yidong <cyd@gnu.org> 62013-12-22 Chong Yidong <cyd@gnu.org>
2 7
3 * faces.el (face-spec-recalc): If the theme specs are not 8 * 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 3308651b0e3..51117e59f78 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'."
779(defun ruby--electric-indent-p (char) 779(defun ruby--electric-indent-p (char)
780 (cond 780 (cond
781 ((memq char ruby--electric-indent-chars) 781 ((memq char ruby--electric-indent-chars)
782 ;; Outdent after typing a closing paren. 782 ;; Reindent after typing a char affecting indentation.
783 (ruby--at-indentation-p (1- (point)))) 783 (ruby--at-indentation-p (1- (point))))
784 ((memq (char-after) ruby--electric-indent-chars) 784 ((memq (char-after) ruby--electric-indent-chars)
785 ;; Reindent after inserting something before a closing paren. 785 ;; Reindent after inserting something in front of the above.
786 (ruby--at-indentation-p (1- (point)))) 786 (ruby--at-indentation-p (1- (point))))
787 ((or (memq (char-syntax char) '(?w ?_))) 787 ((or (and (>= char ?a) (<= char ?z)) (memq char '(?_ ?? ?! ?:)))
788 (let ((pt (point))) 788 (let ((pt (point)))
789 (save-excursion 789 (save-excursion
790 (skip-syntax-backward "w_") 790 (skip-chars-backward "[:alpha:]:_?!")
791 (and (ruby--at-indentation-p) 791 (and (ruby--at-indentation-p)
792 (looking-at (regexp-opt (cons "end" ruby-block-mid-keywords))) 792 (looking-at (regexp-opt (cons "end" ruby-block-mid-keywords)))
793 ;; Outdent after typing a keyword. 793 ;; Outdent after typing a keyword.