branch: externals/xr
commit 1ed4caf4b5ffe9c8db9065c5fd1015567b36eab3
Author: Mattias EngdegĂ„rd <[email protected]>
Commit: Mattias EngdegĂ„rd <[email protected]>

    Eliminate the empty string in sequences
    
    Now we translate `.\(?:\)` to `nonl` instead of `(seq nonl "")`.
---
 xr-test.el | 2 ++
 xr.el      | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/xr-test.el b/xr-test.el
index bc2eeebfb9..07dd301674 100644
--- a/xr-test.el
+++ b/xr-test.el
@@ -96,6 +96,8 @@
                        symbol-start symbol-end eol)))
   (should (equal (xr-test--error (xr "\\_a"))
                  '(xr-parse-error "Invalid \\_ sequence" 0 2)))
+  (should (equal (xr "^\\(?:\\(?:\\)\\(?:\\)\\).$")
+                 '(seq bol nonl eol)))
   )
 
 (ert-deftest xr-syntax ()
diff --git a/xr.el b/xr.el
index b7846f789e..e834acaae6 100644
--- a/xr.el
+++ b/xr.el
@@ -390,7 +390,8 @@ adjacent strings. SEQUENCE is used destructively."
             (rest (cdr sequence)))
         (setq sequence
               (cond ((stringp elem)
-                     (push elem strings)
+                     (unless (equal elem "")
+                       (push elem strings))
                      rest)
                     ((eq (car-safe elem) 'seq)
                      (nconc (nreverse (cdr elem)) rest))

Reply via email to