aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDmitry Gutov2013-02-14 07:33:55 +0400
committerDmitry Gutov2013-02-14 07:33:55 +0400
commit53ca88c478b773f2b56084442c8d17e83577f52c (patch)
tree53c4a4346dd423000de81ed52bd14b2d104f5237 /lisp
parent6b26f14f789112bb929f65a8d44caeda11418432 (diff)
downloademacs-53ca88c478b773f2b56084442c8d17e83577f52c.tar.gz
emacs-53ca88c478b773f2b56084442c8d17e83577f52c.zip
* lisp/progmodes/ruby-mode.el (ruby-parse-partial): Don't increase
depth for unfinished percent literal. Not using it in the caller. (ruby-move-to-block): Jump over multiline literals of all types, ignoring code-looking contents inside them. * test/automated/ruby-mode-tests.el (ruby-move-to-block-skips-percent-literal): Add depth-affecting bits inside the examples. (ruby-move-to-block-skips-heredoc): New test.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/progmodes/ruby-mode.el18
2 files changed, 16 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index eb3f4f833f5..fd520361889 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12013-02-14 Dmitry Gutov <dgutov@yandex.ru>
2
3 * progmodes/ruby-mode.el (ruby-parse-partial): Don't increase
4 depth for unfinished percent literal. Not using it in the caller.
5 (ruby-move-to-block): Jump over multiline literals of all types,
6 ignoring code-looking contents inside them.
7
12013-02-13 Michael Albinus <michael.albinus@gmx.de> 82013-02-13 Michael Albinus <michael.albinus@gmx.de>
2 9
3 Use ControlMaster where applicable. (Bug#13677) 10 Use ControlMaster where applicable. (Bug#13677)
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index b1017bb6302..453d08fc47b 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -519,12 +519,6 @@ Can be one of `heredoc', `modifier', `expr-qstr', `expr-re'."
519 (concat "[^\\]\\(\\\\\\\\\\)*" w)) 519 (concat "[^\\]\\(\\\\\\\\\\)*" w))
520 end t))) 520 end t)))
521 (setq in-string (point)) 521 (setq in-string (point))
522 (when (eq (char-syntax (string-to-char w)) ?\()
523 ;; The rest of the literal, when parsed separately, will
524 ;; have the depth of -1. So in the rare case when this
525 ;; number is used despite the in-string status, the
526 ;; depths will balance.
527 (setq depth (1+ depth)))
528 (goto-char end))) 522 (goto-char end)))
529 (t 523 (t
530 (goto-char pnt)))) 524 (goto-char pnt))))
@@ -913,10 +907,16 @@ current block, a sibling block, or an outer block. Do that (abs N) times."
913 (re-search-forward "^=end\\>")) 907 (re-search-forward "^=end\\>"))
914 ((and backward (looking-at "^=end\\>")) 908 ((and backward (looking-at "^=end\\>"))
915 (re-search-backward "^=begin\\>")) 909 (re-search-backward "^=begin\\>"))
910 ;; Jump over a multiline literal.
911 ((ruby-in-ppss-context-p 'string)
912 (goto-char (nth 8 (syntax-ppss)))
913 (unless backward
914 (forward-sexp)
915 (when (bolp) (forward-char -1)))) ; After a heredoc.
916 (t 916 (t
917 (incf depth (or (nth 2 (ruby-parse-region (point) 917 (let ((state (ruby-parse-region (point) (line-end-position))))
918 (line-end-position))) 918 (unless (car state) ; Line ends with unfinished string.
919 0)) 919 (setq depth (+ (nth 2 state) depth))))
920 (cond 920 (cond
921 ;; Deeper indentation, we found a block. 921 ;; Deeper indentation, we found a block.
922 ;; FIXME: We can't recognize empty blocks this way. 922 ;; FIXME: We can't recognize empty blocks this way.