Hi
>> a spinning animation. For each line the animation could be advanced by >> one (so it will spin really fast). >> >> Danny previously suggested this implementation: >> >> https://lists.gnu.org/archive/html/guix-patches/2017-07/msg00068.html I have tried the Spinner code and it worked fine for me https://paste.debian.net/1031385/ I used usleep so that I could to see the characters spinning with a little delay to understand the code. I tried to use the same for ui.scm, the i replaced str with spinner-port in handle-string code. I got the following 15fb4d0>#<output: file 15fb4d0>#<output: file 15fb4d0>#<output: file 15fb4d0>#<output: file 15fb4d0> I understood that i am working on a softport and unable to figure out how to pass the string without invoking the display/write. I took a lot of time and failed. Here comes the actual part, Later i discussed with #ArneBab in #guile who helped be finish the code. I felt that invoking the spinner each time a string is triggered would be sufficient and it doesnt matter whatever might be the string apart from the expressions which are colorized, so went on to write the code which i am submitting as a patch. For this i had to try a lot of new syntaxes. Now the spinner is working fine, build messages are colored and the whole build process looks understandable to the user. Actually im a bit excited!!!! to see the spinner code working and the build output. Just wanted to share that to the community. Please review the patch and push it to wip-sahithi if the progress is correct. > Have fun! > > -- > Ricardo > > -- Regards Sahithi
>From 9ff3dcf3a1f3b1b395659d956c15f07b5b028e38 Mon Sep 17 00:00:00 2001 From: Sahithi Yarlagadda <s...@swecha.net> Date: Sat, 30 Jun 2018 03:58:47 +0530 Subject: [PATCH] guix: Adding Spinner to replace the Build Messages. * guix/ui.scm (handle-string): Calling the Spinner except for colored messages. (spin-str): New variable. --- guix/ui.scm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/guix/ui.scm b/guix/ui.scm index 88e5fa6b7..2bacffbf1 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -1662,8 +1662,9 @@ unmodified input string." (colorize-string (match:substring m 5) 'RED)))) ;; Didnât match with any expression, returns back unmodified string. - str))) - (display message (current-error-port)))) + (spin-str) + ))) + (display (string-append (string #\backspace) message) (current-error-port)))) (define colorful-build-output-port (make-soft-port @@ -1677,5 +1678,12 @@ unmodified input string." (lambda () (display "@" (current-error-port)))) "rw")) +(define spin-str + (let ((chars (string->list "\\|/-")) + (index -1)) + (lambda () (set! index (modulo (+ index 1) + (length chars))) + (list->string (list #\backspace(list-ref chars index) ))))) + ;;; ui.scm ends here -- 2.17.1