bug-guix
[Top][All Lists]
Advanced

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

bug#51454: Progress bar in Org source blocks


From: zimoun
Subject: bug#51454: Progress bar in Org source blocks
Date: Wed, 3 Nov 2021 15:14:01 +0100

Hi,

On Mon, 1 Nov 2021 at 03:03, <excalamus@tutanota.com> wrote:

> It looks like NO_COLOR removes colors as expected (which is great). However, 
> there are other characters which appear that are undesirable.  They are 
> characters which copy correctly in email, but don't work within org or it's 
> html export.  They render in Emacs as ^M^[[K and ^H.  Here's a kill-yank of a 
> session (removed some progress bars, but I'm sure you get the point):

I miss what you would like or what you are expecting.  And I do not
think it is an issue about Guix.  Instead, it is an issue about
dealing with outputs and Org-mode (Babel).  The results should be
formatted to be displayed correctly after being catched, for instance,
something along these lines:

--8<---------------cut here---------------start------------->8---
#+begin_src emacs-lisp :results none
  (defun color-region (start)
    (save-excursion
      (goto-char start)
      (when (looking-at org-babel-result-regexp)
        (let ((end (org-babel-result-end))
              (ansi-color-context-region nil))
          (ansi-color-apply-on-region beg end)))))

  (defun replace-region (start)
    (save-excursion
      (goto-char start)
      (when (looking-at org-babel-result-regexp)
        (let ((end (org-babel-result-end)))
          (while (re-search-forward " " end t)
            (replace-match "
  :"))))))

  (add-hook 'org-babel-after-execute-hook
            #'(lambda ()
                (let ((beg (org-babel-where-is-src-block-result nil nil)))
                  (when beg
                    (mapc (lambda (f) (apply f (list beg)))
                          (list 'color-region
                                'replace-region))))))
#+end_src

#+begin_src sh :results output
  echo -e "\e[31mSomething\e[0m"
#+end_src

#+RESULTS:
: -e Something

#+begin_src sh :results output :session test
  guix environment --ad-hoc hello -- hello
#+end_src

#+RESULTS:
: The following derivation will be built:
:    /gnu/store/wkhxrm33smq3mbc6f50fivyd1yc9kk6z-profile.drv
:
: 10.0 MB will be downloaded
: #################] 100.0%
: hello-2.10  51KiB                    907KiB/s 00:00
[##################] 100.0%
:
:building database for manual pages...
: [#########################################################################]
:100% 
[#########################################################################]
:100% 
[#########################################################################]
:
:building profile with 1 package...
:
:Hello, world!
:building database for manual pages...
: [#########################################################################]
:100% 
[#########################################################################]
:100% 
[#########################################################################]
:
:building profile with 1 package...
:
:Hello, world!
--8<---------------cut here---------------end--------------->8---


For example, this part,

--8<---------------cut here---------------start------------->8---
Updating channel 'guix' from Git repository at
'https://git.savannah.gnu.org/git/guix.git'...
[                                                      ] [Kreceiving
objects   2% [#                                                     ]
[Kreceiving objects   5% [##
         ] [Kreceiving objects   7% [Kindexing objects  95%
[####################################################   ] [Kindexing
objects  98% [#####################################################  ]
[KAuthenticating channel 'guix', commits 9edb3f6 to f3d5d57 (3 new
commits)...
--8<---------------cut here---------------end--------------->8---

is not managed by Guix but it comes from the dependency 'guile-git'
and even probably libgit,



Cheers,
simon





reply via email to

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