diff options
| author | Dmitry Gutov | 2013-12-22 22:38:26 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2013-12-22 22:38:26 +0200 |
| commit | 1f87a56cc78b25d96fedd0f49a93cbe5b33dedec (patch) | |
| tree | 21b0acccb9f19e41354ee6dc607e9f657800394c | |
| parent | 569c1c6ea15600c76df0e8532b91c439915fa127 (diff) | |
| download | emacs-1f87a56cc78b25d96fedd0f49a93cbe5b33dedec.tar.gz emacs-1f87a56cc78b25d96fedd0f49a93cbe5b33dedec.zip | |
* lisp/progmodes/ruby-mode.el (ruby--electric-indent-p): Improve the
comments. Handle electric indent after typing `?' and `!'.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 8 |
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 @@ | |||
| 1 | 2013-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 | |||
| 1 | 2013-12-22 Chong Yidong <cyd@gnu.org> | 6 | 2013-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. |