]> git.eshelyaron.com Git - emacs.git/commitdiff
(reb-re-syntax): Add `rx' syntax.
authorJohn Paul Wallington <jpw@pobox.com>
Sat, 7 Aug 2004 12:03:54 +0000 (12:03 +0000)
committerJohn Paul Wallington <jpw@pobox.com>
Sat, 7 Aug 2004 12:03:54 +0000 (12:03 +0000)
(reb-lisp-mode): Require `rx' feature when `re-reb-syntax' is `rx'.
(reb-lisp-syntax-p, reb-change-syntax): `rx' is a Lisp syntax.
(reb-cook-regexp): Call `rx-to-string' when `re-reb-syntax' is `rx'.

lisp/ChangeLog
lisp/emacs-lisp/re-builder.el

index e12449df8e4348271903fc200ba674014f544384..eaaf7b35c3d097d07262ff14c0d35140118dd8f7 100644 (file)
@@ -1,3 +1,10 @@
+2004-08-07  John Paul Wallington  <jpw@gnu.org>
+
+       * emacs-lisp/re-builder.el (reb-re-syntax): Add `rx' syntax.
+       (reb-lisp-mode): Require `rx' feature when `re-reb-syntax' is `rx'.
+       (reb-lisp-syntax-p, reb-change-syntax): `rx' is a Lisp syntax.
+       (reb-cook-regexp): Call `rx-to-string' when `re-reb-syntax' is `rx'.
+
 2004-08-04  Kenichi Handa  <handa@m17n.org>
 
        * international/encoded-kb.el (encoded-kbd-setup-keymap): Fix
index c6112c4a105d767f03cc2385a4e01edff7da06aa..6eb1ffa2e54431483edc0d295df0062cb52e19a3 100644 (file)
@@ -135,6 +135,7 @@ Can either be `read', `string', `sregex' or `lisp-re'."
                 (const :tag "String syntax" string)
                 (const :tag "`sregex' syntax" sregex)
                 (const :tag "`lisp-re' syntax" lisp-re)
+                (const :tag "`rx' syntax" rx)
                 (value: string)))
 
 (defcustom reb-auto-match-limit 200
@@ -261,7 +262,9 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
   (cond ((eq reb-re-syntax 'lisp-re)   ; Pull in packages
         (require 'lisp-re))            ; as needed
        ((eq reb-re-syntax 'sregex)     ; sregex is not autoloaded
-        (require 'sregex)))            ; right now..
+        (require 'sregex))             ; right now..
+       ((eq reb-re-syntax 'rx)         ; rx-to-string is autoloaded
+        (require 'rx)))                ; require rx anyway
   (reb-mode-common))
 
 ;; Use the same "\C-c" keymap as `reb-mode' and use font-locking from
@@ -320,7 +323,7 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
 
 (defsubst reb-lisp-syntax-p ()
   "Return non-nil if RE Builder uses a Lisp syntax."
-  (memq reb-re-syntax '(lisp-re sregex)))
+  (memq reb-re-syntax '(lisp-re sregex rx)))
 
 (defmacro reb-target-binding (symbol)
   "Return binding for SYMBOL in the RE Builder target buffer."
@@ -466,10 +469,10 @@ Optional argument SYNTAX must be specified if called non-interactively."
    (list (intern
          (completing-read "Select syntax: "
                           (mapcar (lambda (el) (cons (symbol-name el) 1))
-                                  '(read string lisp-re sregex))
+                                  '(read string lisp-re sregex rx))
                           nil t (symbol-name reb-re-syntax)))))
 
-  (if (memq syntax '(read string lisp-re sregex))
+  (if (memq syntax '(read string lisp-re sregex rx))
       (let ((buffer (get-buffer reb-buffer)))
        (setq reb-re-syntax syntax)
        (if buffer
@@ -604,6 +607,8 @@ optional fourth argument FORCE is non-nil."
         (lre-compile-string (eval (car (read-from-string re)))))
        ((eq reb-re-syntax 'sregex)
         (apply 'sregex (eval (car (read-from-string re)))))
+       ((eq reb-re-syntax 'rx)
+        (rx-to-string (eval (car (read-from-string re)))))
        (t re)))
 
 (defun reb-update-regexp ()
@@ -670,7 +675,7 @@ If SUBEXP is non-nil mark only the corresponding sub-expressions."
                  (overlay-put overlay 'priority i)))
            (setq i (1+ i))))))
     (let ((count (if subexp submatches matches)))
-      (message"%s %smatch%s%s"
+      (message "%s %smatch%s%s"
               (if (= 0 count) "No" (int-to-string count))
               (if subexp "subexpression " "")
               (if (= 1 count) "" "es")