[PATCH] ui: Switch precedence for extensions.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ricardo Wurmus
  • zimoun
Owner
unassigned
Submitted by
zimoun
Severity
normal
Z
Z
zimoun wrote on 16 Jan 2021 01:57
(address . guix-patches@gnu.org)(name . zimoun)(address . zimon.toutoune@gmail.com)
20210116005708.22610-1-zimon.toutoune@gmail.com
* guix/ui.scm (run-guix-command): Modify order that extensions are allowed to
override default commands.
---
guix/ui.scm | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

Toggle diff (36 lines)
diff --git a/guix/ui.scm b/guix/ui.scm
index bd504c68da..ad78d5cedd 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -2126,18 +2126,18 @@ found."
(define module
(catch 'misc-error
(lambda ()
- (resolve-interface `(guix scripts ,command)))
- (lambda _
;; Check if there is a matching extension.
+ (match (search-path (extension-directories)
+ (format #f "~a.scm" command))
+ (#f
+ (throw 'misc-error))
+ (file
+ (load file)
+ (resolve-interface `(guix extensions ,command)))))
+ (lambda _
(catch 'misc-error
(lambda ()
- (match (search-path (extension-directories)
- (format #f "~a.scm" command))
- (#f
- (throw 'misc-error))
- (file
- (load file)
- (resolve-interface `(guix extensions ,command)))))
+ (resolve-interface `(guix scripts ,command)))
(lambda _
(format (current-error-port)
(G_ "guix: ~a: command not found~%") command)

base-commit: 884f320e7ceb35cb8472510e47fc5f1944675d82
--
2.29.2
R
R
Ricardo Wurmus wrote on 28 Jan 2021 10:20
[PATCH] ui: Look up extensions before built-in commands.
(address . 45910@debbugs.gnu.org)
20210128092054.12811-1-rekado@elephly.net
From: zimoun <zimon.toutoune@gmail.com>

We can do without the extra throw here. What do you think of this
simpler variant?

* guix/ui.scm (run-guix-command): Modify order so that extensions are allowed
to override default commands.

Co-authored-by: Ricardo Wurmus <rekado@elephly.net>
---
guix/ui.scm | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)

Toggle diff (45 lines)
diff --git a/guix/ui.scm b/guix/ui.scm
index bd504c68da..45ae14f83c 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -2124,24 +2124,20 @@ Run COMMAND with ARGS.\n"))
"Run COMMAND with the given ARGS. Report an error when COMMAND is not
found."
(define module
- (catch 'misc-error
- (lambda ()
- (resolve-interface `(guix scripts ,command)))
- (lambda _
- ;; Check if there is a matching extension.
- (catch 'misc-error
- (lambda ()
- (match (search-path (extension-directories)
- (format #f "~a.scm" command))
- (#f
- (throw 'misc-error))
- (file
- (load file)
- (resolve-interface `(guix extensions ,command)))))
- (lambda _
- (format (current-error-port)
- (G_ "guix: ~a: command not found~%") command)
- (show-guix-usage))))))
+ ;; Check if there is a matching extension.
+ (match (search-path (extension-directories)
+ (format #f "~a.scm" command))
+ (#f
+ (catch 'misc-error
+ (lambda ()
+ (resolve-interface `(guix scripts ,command)))
+ (lambda _
+ (format (current-error-port)
+ (G_ "guix: ~a: command not found~%") command)
+ (show-guix-usage))))
+ (file
+ (load file)
+ (resolve-interface `(guix extensions ,command)))))
(let ((command-main (module-ref module
(symbol-append 'guix- command))))
--
2.29.2
Z
Z
zimoun wrote on 28 Jan 2021 17:26
(name . Ricardo Wurmus)(address . rekado@elephly.net)
86sg6lgh86.fsf@gmail.com
Hi Ricardo,

On Thu, 28 Jan 2021 at 10:20, Ricardo Wurmus <rekado@elephly.net> wrote:

Toggle quote (3 lines)
> We can do without the extra throw here. What do you think of this
> simpler variant?

Yeah that’s much better. :-)

Thanks,
simon
R
R
Ricardo Wurmus wrote on 28 Jan 2021 18:53
(name . zimoun)(address . zimon.toutoune@gmail.com)(address . 45910-done@debbugs.gnu.org)
87lfcdhrsz.fsf@elephly.net
Pushed!

--
Ricardo
Closed
?