branch: externals/cm-mode
commit 81863c2e16e2ddc6e1616d5585836e46ceee6401
Author: Joost Kremers <[email protected]>
Commit: Joost Kremers <[email protected]>

    Fix markup regexes and use them in cm-substitution-string.
    
    cm-addition-regexp, cm-deletion-regexp, cm-substitution-regexp,
    cm-comment-regexp, cm-highlight-regexp: changed.
    (cm-substitution-string): changed.
---
 cm-mode.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/cm-mode.el b/cm-mode.el
index d68f0f97ac..568055c473 100644
--- a/cm-mode.el
+++ b/cm-mode.el
@@ -105,19 +105,19 @@ The value is actually a list consisting of the text and a 
flag
 indicating whether the deletion was done with the backspace
 key.")
 
-(defvar cm-addition-regexp 
"\\(?:{\\+\\+\\([[:ascii:]]\\|[[:nonascii:]]\\)*?\\+\\+}\\)"
+(defvar cm-addition-regexp 
"\\(?:{\\+\\+\\(\\(?:[[:ascii:]]\\|[[:nonascii:]]\\)*?\\)\\+\\+}\\)"
   "CriticMarkup addition regexp.")
 
-(defvar cm-deletion-regexp "\\(?:{--\\([[:ascii:]]\\|[[:nonascii:]]\\)*?--}\\)"
+(defvar cm-deletion-regexp 
"\\(?:{--\\(\\(?:[[:ascii:]]\\|[[:nonascii:]]\\)*?\\)--}\\)"
   "CriticMarkup deletion regexp.")
 
-(defvar cm-substitution-regexp 
"\\(?:{~~\\([[:ascii:]]\\|[[:nonascii:]]\\)*?~>\\([[:ascii:]]\\|[[:nonascii:]]\\)*?~~}\\)"
+(defvar cm-substitution-regexp 
"\\(?:{~~\\(\\(?:[[:ascii:]]\\|[[:nonascii:]]\\)*?\\)~>\\(\\(?:[[:ascii:]]\\|[[:nonascii:]]\\)*?\\)~~}\\)"
   "CriticMarkup substitution regexp.")
 
-(defvar cm-comment-regexp "\\(?:{>>\\([[:ascii:]]\\|[[:nonascii:]]\\)*?<<}\\)"
+(defvar cm-comment-regexp 
"\\(?:{>>\\(\\(?:[[:ascii:]]\\|[[:nonascii:]]\\)*?\\)<<}\\)"
   "CriticMarkup comment regexp.")
 
-(defvar cm-highlight-regexp 
"\\(?:{==\\([[:ascii:]]\\|[[:nonascii:]]\\)*?==}\\)"
+(defvar cm-highlight-regexp 
"\\(?:{==\\(\\(?:[[:ascii:]]\\|[[:nonascii:]]\\)*?\\)==}\\)"
   "CriticMarkup highlight regexp.")
 
 (defvar cm-current-markup-overlay nil
@@ -802,22 +802,22 @@ substitutions, `d' for comments and highlights."
      ((eq type 'cm-addition)
       (if (not action)
           ""
-        (string-match 
"{\\+\\+\\(\\([[:ascii:]]\\|[[:nonascii:]]\\)*?\\)\\+\\+}" text)
+        (string-match cm-addition-regexp text)
         (match-string 1 text)))
      ((eq type 'cm-deletion)
       (if action
           ""
-        (string-match "{--\\(\\([[:ascii:]]\\|[[:nonascii:]]\\)*?\\)--}" text)
+        (string-match cm-deletion-regexp text)
         (match-string 1 text)))
      ((eq type 'cm-substitution)
-      (string-match 
"{~~\\(\\([[:ascii:]]\\|[[:nonascii:]]\\)*?\\)~>\\(\\([[:ascii:]]\\|[[:nonascii:]]\\)*?\\)~~}"
 text)
+      (string-match cm-substitution-regexp text)
       (match-string (if action 2 1) text))
      ((and (eq type 'cm-comment)
            (eq action ?d))
       "")
      ((and (eq type 'cm-highlight)
            (eq action ?d))
-      (string-match "{==\\(\\([[:ascii:]]\\|[[:nonascii:]]\\)*?\\)==}" text)
+      (string-match cm-highlight-regexp text)
       (match-string 1 text)))))
 
 (defun cm-accept/reject-all-changes ()

Reply via email to