diff options
| author | Mattias EngdegÄrd | 2019-09-29 16:59:58 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2019-09-29 17:08:43 +0200 |
| commit | 2fa33eb6ee20e48a4c6488bb0d55b3c1c9a1f721 (patch) | |
| tree | d58330914fcf182f48d8a926874b3a08d5adf316 | |
| parent | 9d7fae5ab198f7f33ebb3e791475b4e1a0082f61 (diff) | |
| download | emacs-2fa33eb6ee20e48a4c6488bb0d55b3c1c9a1f721.tar.gz emacs-2fa33eb6ee20e48a4c6488bb0d55b3c1c9a1f721.zip | |
Add `rx-submatch-n' for compatibility (bug#37517)
It was an internal symbol in the old `rx' implementation, used in old
versions of the `flycheck' package.
* lisp/emacs-lisp/rx.el (rx-submatch-n): Alias of `rx-to-string'.
* test/lisp/emacs-lisp/rx-tests.el (rx-compat): Test it.
| -rw-r--r-- | lisp/emacs-lisp/rx.el | 3 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/rx-tests.el | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index a192ed1ad27..45fec796cc3 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el | |||
| @@ -1254,6 +1254,9 @@ following constructs: | |||
| 1254 | `(app (match-string ,i) ,name)) | 1254 | `(app (match-string ,i) ,name)) |
| 1255 | (reverse rx--pcase-vars)))))) | 1255 | (reverse rx--pcase-vars)))))) |
| 1256 | 1256 | ||
| 1257 | ;; Obsolete internal symbol, used in old versions of the `flycheck' package. | ||
| 1258 | (define-obsolete-function-alias 'rx-submatch-n 'rx-to-string "27.1") | ||
| 1259 | |||
| 1257 | (provide 'rx) | 1260 | (provide 'rx) |
| 1258 | 1261 | ||
| 1259 | ;;; rx.el ends here | 1262 | ;;; rx.el ends here |
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el index 11de4771dea..76dcf419428 100644 --- a/test/lisp/emacs-lisp/rx-tests.el +++ b/test/lisp/emacs-lisp/rx-tests.el | |||
| @@ -416,5 +416,8 @@ | |||
| 416 | (should (equal (rx-to-string '(seq (delta a b c) (* (epsilon d e))) t) | 416 | (should (equal (rx-to-string '(seq (delta a b c) (* (epsilon d e))) t) |
| 417 | "\\(?:<(delta a b c)>\\)\\(?:<(epsilon d e)>\\)*")))) | 417 | "\\(?:<(delta a b c)>\\)\\(?:<(epsilon d e)>\\)*")))) |
| 418 | 418 | ||
| 419 | (ert-deftest rx-compat () | ||
| 420 | "Test old symbol retained for compatibility (bug#37517)." | ||
| 421 | (should (equal (rx-submatch-n '(group-n 3 (+ nonl) eol)) "\\(?3:.+$\\)"))) | ||
| 419 | 422 | ||
| 420 | (provide 'rx-tests) | 423 | (provide 'rx-tests) |