guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/08: build: emacs-utils: Add an option to select scoping for batch eva


From: guix-commits
Subject: 01/08: build: emacs-utils: Add an option to select scoping for batch eval.
Date: Sun, 22 Mar 2020 21:45:14 -0400 (EDT)

apteryx pushed a commit to branch master
in repository guix.

commit afc6b1c0b635e3268795c0f766be408c5e9858e7
Author: Maxim Cournoyer <address@hidden>
AuthorDate: Sun Mar 22 10:42:44 2020 -0400

    build: emacs-utils: Add an option to select scoping for batch eval.
    
    In Emacs 27, --eval now evaluates using lexical scoping.  This change adds 
an
    option to select dynamic scoping, by using a workaround proposed in
    <https://bugs.gnu.org/39823>.
    
    * guix/build/emacs-utils.scm (emacs-batch-eval): Add a DYNAMIC? keyword
    argument.  Wrap the EXPR with a call to EVAL that makes use of the argument
    to select the scoping mode.
    (emacs-generate-autoloads): Use it.
---
 guix/build/emacs-utils.scm | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index ab64e37..5f7ba71 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014, 2018 Mark H Weaver <address@hidden>
 ;;; Copyright © 2014 Alex Kost <address@hidden>
-;;; Copyright © 2018 Maxim Cournoyer <address@hidden>
+;;; Copyright © 2018, 2020 Maxim Cournoyer <address@hidden>
 ;;; Copyright © 2019 Leo Prikler <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -21,6 +21,7 @@
 
 (define-module (guix build emacs-utils)
   #:use-module (guix build utils)
+  #:use-module (ice-9 format)
   #:export (%emacs
             emacs-batch-eval
             emacs-batch-edit-file
@@ -47,10 +48,12 @@
       expr
       (format #f "~s" expr)))
 
-(define (emacs-batch-eval expr)
-  "Run Emacs in batch mode, and execute the elisp code EXPR."
+(define* (emacs-batch-eval expr #:key dynamic?)
+  "Run Emacs in batch mode, and execute the Elisp code EXPR.  If DYNAMIC? is
+true, evaluate using dynamic scoping."
   (invoke (%emacs) "--quick" "--batch"
-          (string-append "--eval=" (expr->string expr))))
+          (format #f "--eval=(eval '~a ~:[t~;nil~])"
+                  (expr->string expr) dynamic?)))
 
 (define (emacs-batch-edit-file file expr)
   "Load FILE in Emacs using batch mode, and execute the elisp code EXPR."
@@ -70,7 +73,7 @@
          (expr `(let ((backup-inhibited t)
                       (generated-autoload-file ,file))
                   (update-directory-autoloads ,directory))))
-    (emacs-batch-eval expr)))
+    (emacs-batch-eval expr #:dynamic? #t)))
 
 (define* (emacs-byte-compile-directory dir)
   "Byte compile all files in DIR and its sub-directories."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]