all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: excalamus@tutanota.com
Cc: 51454 <51454@debbugs.gnu.org>
Subject: bug#51454: Progress bar in Org source blocks
Date: Wed, 3 Nov 2021 15:14:01 +0100	[thread overview]
Message-ID: <CAJ3okZ3jfQLaicFzEQd=ia+XYqS+HM1ZrO=QamMrcPdTHHpQhA@mail.gmail.com> (raw)
In-Reply-To: <MnOEBp9--3-2@tutanota.com>

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	other threads:[~2021-11-03 14:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28  2:10 bug#51454: Progress bar in Org source blocks excalamus--- via Bug reports for GNU Guix
2021-10-29 12:51 ` zimoun
2021-10-30  4:55   ` excalamus--- via Bug reports for GNU Guix
2021-10-30 16:43     ` zimoun
2021-11-01  2:03       ` excalamus--- via Bug reports for GNU Guix
2021-11-03 14:14         ` zimoun [this message]
2021-11-03 17:05           ` excalamus--- via Bug reports for GNU Guix
2021-11-03 17:52             ` zimoun
2021-11-04  0:43               ` excalamus--- via Bug reports for GNU Guix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ3okZ3jfQLaicFzEQd=ia+XYqS+HM1ZrO=QamMrcPdTHHpQhA@mail.gmail.com' \
    --to=zimon.toutoune@gmail.com \
    --cc=51454@debbugs.gnu.org \
    --cc=excalamus@tutanota.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.