[bug#76686,emacs-team,00/45] Test emacs packages by default
Commit Message
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> Hi folks,
>
> this patch adds code – similar to what we have in other ecosystems – to
> make an educated guess on what test framework is used and use it. Newly
> packaged Emacs libraries should thus expect to be tested with tests
> needing to be explicitly disabled otherwise; just like in the rest of
> Guix.
>
> Cheers
Looks good to me just reading through them. Some of the test commands
looks a little complicated though with a lot of boiler plate (like
emacs-list-utils). Any thoughts on perhaps using a helper function like
the (untested) attached patch?
Comments
Am Sonntag, dem 02.03.2025 um 19:29 -0500 schrieb Morgan Smith:
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>
> > Hi folks,
> >
> > this patch adds code – similar to what we have in other ecosystems
> > – to make an educated guess on what test framework is used and use
> > it. Newly packaged Emacs libraries should thus expect to be tested
> > with tests needing to be explicitly disabled otherwise; just like
> > in the rest of Guix.
> >
> > Cheers
>
> Looks good to me just reading through them. Some of the test
> commands looks a little complicated though with a lot of boiler plate
> (like emacs-list-utils). Any thoughts on perhaps using a helper
> function like the (untested) attached patch?
Most packages shouldn't have too complicated test commands and I think
it's beneficial to have them in code verbatim. If a pattern gets
overused, we can still try to simplify it later.
Cheers
From 631833f951e52047a4b8ea3a5598ec0b377a67d4 Mon Sep 17 00:00:00 2001
Message-ID: <631833f951e52047a4b8ea3a5598ec0b377a67d4.1740961610.git.Morgan.J.Smith@outlook.com>
From: Morgan Smith <Morgan.J.Smith@outlook.com>
Date: Sun, 2 Mar 2025 19:18:44 -0500
Subject: [PATCH] guix: emacs-utils: Add new function
'emacs-batch-eval-command'.
* guix/build/emacs-utils.scm(emacs-batch-eval-command): New function.
(emacs-batch-eval): Define in terms of 'emacs-batch-eval-command'.
Change-Id: I27c10bc7a93be02385ad47cadd124379bcaaad52
---
guix/build/emacs-utils.scm | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
@@ -63,12 +63,22 @@ (define (expr->string expr)
expr
(format #f "~s" expr)))
+(define* (emacs-batch-eval-command expr #:key (load-directories '())
+ (load-files '()) dynamic?)
+ "Return a command to run Emacs in batch mode, and execute the Elisp code
+EXPR. If LOAD-DIRECTORIES is a list of directories, add them to the load path
+before running EXPR. If LOAD-FILES is a list of files, load them before
+running EXPR. DYNAMIC? is true, evaluate using dynamic scoping."
+ `("emacs" "--quick" "--batch"
+ ,@(map (lambda file) (string-append "--directory=" file) load-files)
+ ,@(map (lambda file) (string-append "--load=" file) load-files)
+ (format #f "--eval=(eval '~a ~:[t~;nil~])"
+ (expr->string expr) dynamic?)))
+
(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"
- (format #f "--eval=(eval '~a ~:[t~;nil~])"
- (expr->string expr) dynamic?)))
+ (invoke (%emacs) (cdr (emacs-batch-eval-command expr #:dynamic dynamic))))
(define (emacs-batch-edit-file file expr)
"Load FILE in Emacs using batch mode, and execute the elisp code EXPR."
--
2.48.1