• Mattias Engdegård's avatar
    rx: Use longest match for all-string 'or' forms (bug#37659) · 5a21aaff
    Mattias Engdegård authored
    Revert to the Emacs 26 semantics that always gave the longest match
    for rx 'or' forms with only string arguments.  This guarantee was
    never well documented, but it is useful and people likely have come to
    rely on it.  For example, prior to this change,
    
     (rx (or ">" ">="))
    
    matched ">" even if the text contained ">=".
    
    * lisp/emacs-lisp/rx.el (rx--translate-or): Don't tell regexp-opt to
    preserve the matching order.
    * doc/lispref/searching.texi (Rx Constructs): Document the
    longest-match guarantee for all-string 'or' forms.
    * test/lisp/emacs-lisp/rx-tests.el (rx-or): Update test.
    5a21aaff
rx-tests.el 21.1 KB