From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sahithi Yarlagadda Subject: Re: Next steps Date: Sat, 30 Jun 2018 04:21:11 +0530 Message-ID: <7769bf50-f0bd-8698-d40b-20fbcd005b2a@swecha.net> References: <8ea5d026-fab9-7b12-198e-610ad7743cb2@swecha.net> <02e1a59a-ebc1-dfce-e1d6-22e97e742214@swecha.net> <874lifypeb.fsf@elephly.net> <648f81fc-0607-2c3b-f9a3-ca3b29cd637b@swecha.net> <87bmck22uz.fsf@elephly.net> <8736xv1xvq.fsf@elephly.net> <64dfaf0c-3bcf-7b76-5831-b1c41d3f5563@swecha.net> <877en4ccut.fsf@elephly.net> <2b03fcec-c2d8-0604-156c-70fe7643a6cb@swecha.net> <87zhzzbqn6.fsf@elephly.net> <8f509759-c798-a150-bf5a-9b13cd07ac5b@swecha.net> <87lgbibir5.fsf@elephly.net> <564233bd-9511-7f84-3350-6a3a905534a8@swecha.net> <87r2l767sg.fsf@elephly.net> <874lhwtn5a.fsf@elephly.net> <204a32d1-f216-dedd-2234-cd05e3d406a9@swecha.net> <4b5ce9b0-a2d1-30e3-489b-a0028d227c5c@swecha.net> <87k1qmmx0m.fsf@elephly.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------F76834BC35D9FCB40F135157" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZ2FH-0003ra-Q6 for guix-devel@gnu.org; Fri, 29 Jun 2018 18:52:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fZ2FE-00066q-LD for guix-devel@gnu.org; Fri, 29 Jun 2018 18:52:03 -0400 In-Reply-To: <87k1qmmx0m.fsf@elephly.net> Content-Language: en-US List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ricardo Wurmus Cc: guix-devel This is a multi-part message in MIME format. --------------F76834BC35D9FCB40F135157 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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>#### 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 --------------F76834BC35D9FCB40F135157 Content-Type: text/x-patch; name="0001-guix-Adding-Spinner-to-replace-the-Build-Messages.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename*0="0001-guix-Adding-Spinner-to-replace-the-Build-Messages.patch" >From 9ff3dcf3a1f3b1b395659d956c15f07b5b028e38 Mon Sep 17 00:00:00 2001 From: Sahithi Yarlagadda 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 --------------F76834BC35D9FCB40F135157--