From 87475f4af21daf8a09f08e359a22c33e0173f3ee Mon Sep 17 00:00:00 2001 From: Mattias EngdegÄrd Date: Sun, 4 Dec 2022 15:20:49 +0100 Subject: Fix pcase rx patterns using rx-let bindings (bug#59814) Reported by Daniel Pittman. * lisp/emacs-lisp/rx.el (rx): Move binding of rx--local-definitions... (rx--to-expr): ...here. * test/lisp/emacs-lisp/rx-tests.el (rx-let-pcase): New test. --- lisp/emacs-lisp/rx.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index ec51146484a..f2a0dc54832 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -1152,7 +1152,12 @@ For extending the `rx' notation in FORM, use `rx-define' or `rx-let-eval'." (defun rx--to-expr (form) "Translate the rx-expression FORM to a Lisp expression yielding a regexp." - (let* ((rx--delayed-evaluation t) + (let* ((rx--local-definitions + ;; Retrieve local definitions from the macroexpansion environment. + ;; (It's unclear whether the previous value of `rx--local-definitions' + ;; should be included, and if so, in which order.) + (cdr (assq :rx-locals macroexpand-all-environment))) + (rx--delayed-evaluation t) (elems (car (rx--translate form))) (args nil)) ;; Merge adjacent strings. @@ -1282,12 +1287,7 @@ Additional constructs can be defined using `rx-define' and `rx-let', which see. \(fn REGEXPS...)" - ;; Retrieve local definitions from the macroexpansion environment. - ;; (It's unclear whether the previous value of `rx--local-definitions' - ;; should be included, and if so, in which order.) - (let ((rx--local-definitions - (cdr (assq :rx-locals macroexpand-all-environment)))) - (rx--to-expr (cons 'seq regexps)))) + (rx--to-expr (cons 'seq regexps))) (defun rx--make-binding (name tail) "Make a definitions entry out of TAIL. -- cgit v1.2.3 From 3e349ee1198c7fc5187975c3e52e805a44f5b84b Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 11 Dec 2022 19:00:01 +0100 Subject: Fix error message when installing non-existent package * lisp/emacs-lisp/package.el (package-compute-transaction): Don't add trailing dash to package name in non-existent package error. (Bug#59923) --- lisp/emacs-lisp/package.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index a9fd8c741e8..4d33311cb74 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1949,8 +1949,10 @@ SEEN is used internally to detect infinite recursion." (if (eq next-pkg 'emacs) (error "This package requires Emacs version %s" (package-version-join next-version)) - (error "Package `%s-%s' is unavailable" - next-pkg (package-version-join next-version)))))) + (error (if (not next-version) + (format "Package `%s' is unavailable" next-pkg) + (format "Package `%s' (version %s) is unavailable" + next-pkg (package-version-join next-version)))))))) (setq packages (package-compute-transaction (cons found packages) (package-desc-reqs found) -- cgit v1.2.3