[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26339: [PATCH 09/18] scripts: system: Move save-load-path-excursion
From: |
Mathieu Othacehe |
Subject: |
bug#26339: [PATCH 09/18] scripts: system: Move save-load-path-excursion and save-environment-excursion macros to the top. |
Date: |
Sun, 2 Apr 2017 15:52:33 +0200 |
* guix/scripts/system.scm (save-load-path-excursion,
save-environment-excursion): Move definitions to the top of the file.
It allows to use them in the whole file.
---
guix/scripts/system.scm | 47 ++++++++++++++++++++++++-----------------------
1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 04274919e..2ad210207 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <address@hidden>
;;; Copyright © 2016 Alex Kost <address@hidden>
;;; Copyright © 2016 Chris Marusich <address@hidden>
+;;; Copyright © 2017 Mathieu Othacehe <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -77,6 +78,29 @@
;;; Installation.
;;;
+(define-syntax-rule (save-load-path-excursion body ...)
+ "Save the current values of '%load-path' and '%load-compiled-path', run
+BODY..., and restore them."
+ (let ((path %load-path)
+ (cpath %load-compiled-path))
+ (dynamic-wind
+ (const #t)
+ (lambda ()
+ body ...)
+ (lambda ()
+ (set! %load-path path)
+ (set! %load-compiled-path cpath)))))
+
+(define-syntax-rule (save-environment-excursion body ...)
+ "Save the current environment variables, run BODY..., and restore them."
+ (let ((env (environ)))
+ (dynamic-wind
+ (const #t)
+ (lambda ()
+ body ...)
+ (lambda ()
+ (environ env)))))
+
(define topologically-sorted*
(store-lift topologically-sorted))
@@ -201,29 +225,6 @@ the ownership of '~a' may be incorrect!~%")
;; The system profile.
(string-append %state-directory "/profiles/system"))
-(define-syntax-rule (save-environment-excursion body ...)
- "Save the current environment variables, run BODY..., and restore them."
- (let ((env (environ)))
- (dynamic-wind
- (const #t)
- (lambda ()
- body ...)
- (lambda ()
- (environ env)))))
-
-(define-syntax-rule (save-load-path-excursion body ...)
- "Save the current values of '%load-path' and '%load-compiled-path', run
-BODY..., and restore them."
- (let ((path %load-path)
- (cpath %load-compiled-path))
- (dynamic-wind
- (const #t)
- (lambda ()
- body ...)
- (lambda ()
- (set! %load-path path)
- (set! %load-compiled-path cpath)))))
-
(define-syntax-rule (with-shepherd-error-handling mbody ...)
"Catch and report Shepherd errors that arise when binding MBODY, a monadic
expression in %STORE-MONAD."
--
2.12.2
- bug#26339: [PATCH 06/18] vm: Reword grub.cfg to boot.cfg, (continued)
- bug#26339: [PATCH 06/18] vm: Reword grub.cfg to boot.cfg, Mathieu Othacehe, 2017/04/02
- bug#26339: [PATCH 10/18] system: Rename kernel->grub-label to kernel->boot-label., Mathieu Othacehe, 2017/04/02
- bug#26339: [PATCH 04/18] bootloader: Add install procedures and use them., Mathieu Othacehe, 2017/04/02
- bug#26339: [PATCH 04/18] bootloader: Add install procedures and use them., Danny Milosavljevic, 2017/04/15
- bug#26339: [PATCH 04/18] bootloader: Add install procedures and use them., Mathieu Othacehe, 2017/04/15
- bug#26339: [PATCH 04/18] bootloader: Add install procedures and use them., Danny Milosavljevic, 2017/04/16
- bug#26339: [PATCH 04/18] bootloader: Add install procedures and use them., Mathieu Othacehe, 2017/04/17
- bug#26339: [PATCH 04/18] bootloader: Add install procedures and use them., Ludovic Courtès, 2017/04/18
bug#26339: [PATCH 09/18] scripts: system: Move save-load-path-excursion and save-environment-excursion macros to the top.,
Mathieu Othacehe <=
- bug#26339: [PATCH 09/18] scripts: system: Move save-load-path-excursion and save-environment-excursion macros to the top., Danny Milosavljevic, 2017/04/15
- bug#26339: [PATCH 09/18] scripts: system: Move save-load-path-excursion and save-environment-excursion macros to the top., Mathieu Othacehe, 2017/04/15
- bug#26339: [PATCH 09/18] scripts: system: Move save-load-path-excursion and save-environment-excursion macros to the top., Danny Milosavljevic, 2017/04/15
- bug#26339: [PATCH 09/18] scripts: system: Move save-load-path-excursion and save-environment-excursion macros to the top., Mathieu Othacehe, 2017/04/15
- bug#26339: [PATCH 09/18] scripts: system: Move save-load-path-excursion and save-environment-excursion macros to the top., Danny Milosavljevic, 2017/04/15
bug#26339: [PATCH 13/18] scripts: system: Remove unused variables., Mathieu Othacehe, 2017/04/02
bug#26339: [PATCH 14/18] scripts: system: Rename grub? and install-grub? to bootloader? and install-bootloader?., Mathieu Othacehe, 2017/04/02
bug#26339: [PATCH 15/18] scripts: system: Adapt "reconfigure" to new bootloader API., Mathieu Othacehe, 2017/04/02
bug#26339: [PATCH 16/18] scripts: system: Adapt "init" to new bootloader API., Mathieu Othacehe, 2017/04/02