emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115436: * lisp/progmodes/ruby-mode.el (ruby-forward


From: Dmitry Gutov
Subject: [Emacs-diffs] trunk r115436: * lisp/progmodes/ruby-mode.el (ruby-forward-string): Document.
Date: Mon, 09 Dec 2013 03:43:52 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115436
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16079
author: Cameron Desautels <address@hidden>
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Mon 2013-12-09 05:43:34 +0200
message:
  * lisp/progmodes/ruby-mode.el (ruby-forward-string): Document.
  Handle caret-delimited strings.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/ruby-mode.el    
rubymode.el-20091113204419-o5vbwnq5f7feedwu-8804
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-12-09 03:27:21 +0000
+++ b/lisp/ChangeLog    2013-12-09 03:43:34 +0000
@@ -1,3 +1,8 @@
+2013-12-09  Cameron Desautels  <address@hidden>  (tiny change)
+
+       * progmodes/ruby-mode.el (ruby-forward-string): Document.  Handle
+       caret-delimited strings (Bug#16079).
+
 2013-12-09  Dmitry Gutov  <address@hidden>
 
        * progmodes/ruby-mode.el (ruby-accurate-end-of-block): When

=== modified file 'lisp/progmodes/ruby-mode.el'
--- a/lisp/progmodes/ruby-mode.el       2013-12-09 03:27:21 +0000
+++ b/lisp/progmodes/ruby-mode.el       2013-12-09 03:43:34 +0000
@@ -795,11 +795,28 @@
                   (t nil)))))))))
 
 (defun ruby-forward-string (term &optional end no-error expand)
-  "TODO: document."
+  "Move forward across one balanced pair of string delimiters.
+Skips escaped delimiters. If EXPAND is non-nil, also ignores
+delimiters in interpolated strings.
+
+TERM should be a string containing either a single, self-matching
+delimiter (e.g. \"/\"), or a pair of matching delimiters with the
+close delimiter first (e.g. \"][\").
+
+When non-nil, search is bounded by position END.
+
+Throws an error if a balanced match is not found, unless NO-ERROR
+is non-nil, in which case nil will be returned.
+
+This command assumes the character after point is an opening
+delimiter."
   (let ((n 1) (c (string-to-char term))
-        (re (if expand
-                (concat "[^\\]\\(\\\\\\\\\\)*\\([" term "]\\|\\(#{\\)\\)")
-              (concat "[^\\]\\(\\\\\\\\\\)*[" term "]"))))
+        (re (concat "[^\\]\\(\\\\\\\\\\)*\\("
+                    (if (string= term "^") ;[^] is not a valid regexp
+                        "\\^"
+                      (concat "[" term "]"))
+                    (when expand "\\|\\(#{\\)")
+                    "\\)")))
     (while (and (re-search-forward re end no-error)
                 (if (match-beginning 3)
                     (ruby-forward-string "}{" end no-error nil)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]