all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Morgan Smith <Morgan.J.Smith@outlook.com>,
	Lars Ingebrigtsen <larsi@gnus.org>
Cc: Utkarsh Singh <utkarsh190601@gmail.com>, 45380@debbugs.gnu.org
Subject: bug#45380: 28.0.50; Error in coloured output in Emacs 28.05(AUR package: emacs-git)
Date: Mon, 25 Oct 2021 14:27:15 +0200	[thread overview]
Message-ID: <87cznte1cs.fsf@miha-pc> (raw)
In-Reply-To: <BYAPR05MB402397C1BC7E18388552774EC5839@BYAPR05MB4023.namprd05.prod.outlook.com>


[-- Attachment #1.1: Type: text/plain, Size: 881 bytes --]

Morgan Smith <Morgan.J.Smith@outlook.com> writes:

> Ya I sent a bug report (46332) about this exact same thing happening. 
> And then you fixed it so that it happened much less often. I didn't 
> notice until like a day after we closed that issue. My guess is that 
> there are two unrelated bugs that exhibit the exact same behavior and 
> you already fixed one.

I read that bug report and looked into this. As you said, there were two
bugs exhibiting similar behaviour. One was in ansi-color, fixed by Lars
in that bug report. The other bug, not yet fixed, is with esh-mode.el.
It uses 'insert-before-markers' to insert process output, pushing
forward the marker used by ansi-color.

A reliable reproducer is to open eshell and execute

  sh -c "printf 'NORMAL \033[32m'; sleep 1; printf 'GREEN \033[m\n'"

Please find the attached patch which fixes this.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Avoid-insert-before-markers-in-eshell.patch --]
[-- Type: text/x-patch, Size: 1810 bytes --]

From 3cda385ffd292ade869abf7e39cbb45ca10349fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miha=20Rihtar=C5=A1i=C4=8D?= <miha@kamnitnik.top>
Date: Mon, 25 Oct 2021 14:09:30 +0200
Subject: [PATCH] Avoid insert-before-markers in eshell

* lisp/eshell/esh-mode.el (eshell-mode): Make window point advance on
insertion.
(eshell-output-filter): Don't use insert-before-markers.
---
 lisp/eshell/esh-mode.el | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 579b01f4d1..2b5a4647e0 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -315,6 +315,8 @@ eshell-mode
   (setq-local bookmark-make-record-function #'eshell-bookmark-make-record)
   (setq local-abbrev-table eshell-mode-abbrev-table)
 
+  (setq-local window-point-insertion-type t)
+
   (setq-local list-buffers-directory (expand-file-name default-directory))
 
   ;; always set the tab width to 8 in Eshell buffers, since external
@@ -696,13 +698,10 @@ eshell-output-filter
                   (setq oend (+ oend nchars)))
               ;; Let the ansi-color overlay hooks run.
               (let ((inhibit-modification-hooks nil))
-                (insert-before-markers string))
+                (insert string))
               (if (= (window-start) (point))
                   (set-window-start (selected-window)
                                     (- (point) nchars)))
-              (if (= (point) eshell-last-input-end)
-                  (set-marker eshell-last-input-end
-                              (- eshell-last-input-end nchars)))
               (set-marker eshell-last-output-start ostart)
               (set-marker eshell-last-output-end (point))
               (force-mode-line-update))
-- 
2.33.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

  reply	other threads:[~2021-10-25 12:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23  4:09 bug#45380: 28.0.50; Error in coloured output in Emacs 28.05(AUR package: emacs-git) Utkarsh Singh
2020-12-23 15:39 ` Eli Zaretskii
2021-01-23 23:09 ` Lars Ingebrigtsen
     [not found]   ` <877do2n3ux.fsf@gmail.com>
2021-01-25 23:45     ` Lars Ingebrigtsen
2021-10-25  0:44       ` Morgan Smith
2021-10-25  0:48         ` Lars Ingebrigtsen
2021-10-25  0:55           ` Morgan Smith
2021-10-25 12:27             ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-10-25 13:25               ` Lars Ingebrigtsen

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=87cznte1cs.fsf@miha-pc \
    --to=bug-gnu-emacs@gnu.org \
    --cc=45380@debbugs.gnu.org \
    --cc=Morgan.J.Smith@outlook.com \
    --cc=larsi@gnus.org \
    --cc=miha@kamnitnik.top \
    --cc=utkarsh190601@gmail.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/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.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.