GNU logs - #33092, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#33092: 26.1; Re-running shell wipes font-lock from xterm-color
Resent-From: Allen Li <darkfeline@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 19 Oct 2018 07:18:02 +0000
Resent-Message-ID: <handler.33092.B.153993343826744 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 33092
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 33092 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.153993343826744
          (code B ref -1); Fri, 19 Oct 2018 07:18:02 +0000
Received: (at submit) by debbugs.gnu.org; 19 Oct 2018 07:17:18 +0000
Received: from localhost ([127.0.0.1]:58056 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gDP26-0006xI-F6
	for submit <at> debbugs.gnu.org; Fri, 19 Oct 2018 03:17:18 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43874)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <darkfeline@HIDDEN>) id 1gDP25-0006x4-7d
 for submit <at> debbugs.gnu.org; Fri, 19 Oct 2018 03:17:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <darkfeline@HIDDEN>) id 1gDP1y-0001Up-32
 for submit <at> debbugs.gnu.org; Fri, 19 Oct 2018 03:17:11 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:47001)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <darkfeline@HIDDEN>)
 id 1gDP1v-0001SP-8g
 for submit <at> debbugs.gnu.org; Fri, 19 Oct 2018 03:17:08 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:53463)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <darkfeline@HIDDEN>) id 1gDP1u-0007jo-A7
 for bug-gnu-emacs@HIDDEN; Fri, 19 Oct 2018 03:17:07 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <darkfeline@HIDDEN>) id 1gDP1r-0001OQ-Li
 for bug-gnu-emacs@HIDDEN; Fri, 19 Oct 2018 03:17:04 -0400
Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:55379)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <darkfeline@HIDDEN>)
 id 1gDP1r-0001Lb-7L
 for bug-gnu-emacs@HIDDEN; Fri, 19 Oct 2018 03:17:03 -0400
Received: by mail-wm1-x32b.google.com with SMTP id 206-v6so2547371wmb.5
 for <bug-gnu-emacs@HIDDEN>; Fri, 19 Oct 2018 00:17:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=felesatra-moe.20150623.gappssmtp.com; s=20150623;
 h=mime-version:from:date:message-id:subject:to;
 bh=KeymhNhCyoGzxpEezH4+Yx9OGvSy587lube8SaGkqk8=;
 b=Zg90YazCWOYRBD6YIwfLd3BLxYimLTDRw6CdwTKgih2+WtWS2sV/d+PoIum1QGap+7
 boew7ThnuHu0tXD+I7n7MgHKsK/CpoIKgGaPb0h1U5SHtMN6Zk07seJgOXeVjC4D90Yy
 sbCvWbynMbrwR71W6IndfoAx4ZVz7eufXV+NZ2UiWQChqihfB0UNydZE6Pae/dKL2g/G
 Ex2kDFPOr8oBR8El0wO31NvApI9CQMJG+4wpX1IMGdApwfuTiffeTaMtpgMZu9mnViTV
 qUYZEpwZswcSlzCTYjXqn5UHwGITPoD+CWBBzgxaY4CpT+ZzQu48M5RBVgCY1lOY1cY7
 /9RQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=KeymhNhCyoGzxpEezH4+Yx9OGvSy587lube8SaGkqk8=;
 b=Lstiivq6OASwnWFUPwvTGaVNZAu8zH5xIsNNcpaWCHObpyHD8KsAV5n2Bjn09Uov+X
 17tVX/1ycSEVd0SleaC9G+6Ukdw0wb3zoz+Ox76ZtwOHxJF4USxanv267dqRz+45Yo1U
 BTmbvSEu+XqFQ2DrFT0CWBO38Q09U/MxfE2hvWEVhSnzlZkzvk5CQvBOFkEUXdMIK7qf
 J+Z4bzCkpT9KkvdXx8ka5H3OWXzvbpV6F2U/xAKy2aLncWQKqtd3GVHIpswTD302PVoi
 r6JA9bRWr26fxiH/cU7jaqtdPZ/SoK4i0kAzIdaEdhLE7k24jh2QRPJTKC9W5aDf2KL9
 QMMg==
X-Gm-Message-State: ABuFfog4m170wduSY3UhoEGVbnNBQ6PZhbUkj5vl0TJfh5v+VbNNx/1W
 Ewb0skMiI0+lVIDsLJ0FVS6uAAUTEyUwPDS3GjJVe+VfyNE=
X-Google-Smtp-Source: ACcGV63HzK2IM4xMy9PVVqmAhxYlVxQ6uLdYF20MgiQ9DWn2tBEu5hk65q0EIQE2u89fBRWLtE/w3MKirerPLTXYyCE=
X-Received: by 2002:a1c:2bc3:: with SMTP id
 r186-v6mr3729707wmr.51.1539933420997; 
 Fri, 19 Oct 2018 00:17:00 -0700 (PDT)
MIME-Version: 1.0
From: Allen Li <darkfeline@HIDDEN>
Date: Fri, 19 Oct 2018 00:16:48 -0700
Message-ID: <CADbSrJwFuELWfZHNiSyPKWDMsBZRt3UaZT4m7rmKL+zdeNbnoQ@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Where to begin?

The problem I am having is that when there is already a *shell* buffer
without a running process, re-running the `shell' command will reuse the
buffer and wipe the font-lock color added by xterm-color.el, a
third-party package.

I'm reporting this here because it seems like Emacs could be improved in
some way to avoid this class of problem.

What causes this is as follows:

The `shell' command will call `make-comint-in-buffer' and `shell-mode'.

`shell-mode' will then call `comint-mode' as a derived mode.

`comint-mode' will call `kill-all-local-variables'.

`comint-mode' also adds `font-lock-defontify' to
`change-major-mode-hook'.  Since we're already in `shell-mode' derived
from `comint-mode', switching "back" to `shell-mode' wipes font-lock.

I can work around this pretty easily in my personal config, by removing
`font-lock-defontify' from `change-major-mode-hook' with a well-placed
advice, but the current behavior doesn't seem comfortable to me.

First, if we're reusing the buffer, do we have to switch to `shell-mode'
again?  The advantage is that it clears out some buffer state, so it's
kind of like running a "fresh" `shell'.

But the existing output in the buffer isn't cleared (although it is
defontified as I found out to my dismay).  The `default-directory' isn't
reset either; normally running `shell' starts the shell with the
`default-directory' of the buffer of your current window, but not if it
reuses a *shell* buffer.

So the current behavior of `shell', if it reuses the *shell* buffer, is
to do a half-hearted reset of the buffer state.  As a user this is very
hard to understand and I certainly would not have understood it had I
not taken Edebug to the problem.

`shell' should either fully reset the buffer or touch as little as
possible.  The reset option is indistinguishable from killing the existing
*shell* buffer and creating a new one.  Therefore, if we are going to
reuse the buffer, I think the desired intent would be to touch as little
as possible, in which case we want to avoid the `shell-mode'
reset if we are reusing the *shell* buffer.

In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-07-05 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.12001000

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 MODULES THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Allen Li <darkfeline@HIDDEN>
Subject: bug#33092: Acknowledgement (26.1; Re-running shell wipes
 font-lock from xterm-color)
Message-ID: <handler.33092.B.153993343826744.ack <at> debbugs.gnu.org>
References: <CADbSrJwFuELWfZHNiSyPKWDMsBZRt3UaZT4m7rmKL+zdeNbnoQ@HIDDEN>
X-Gnu-PR-Message: ack 33092
X-Gnu-PR-Package: emacs
Reply-To: 33092 <at> debbugs.gnu.org
Date: Fri, 19 Oct 2018 07:18:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 33092 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
33092: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D33092
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#33092: 26.1; Re-running shell wipes font-lock from xterm-color
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 30 Oct 2019 19:19:01 +0000
Resent-Message-ID: <handler.33092.B33092.157246310019650 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 33092
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Allen Li <darkfeline@HIDDEN>
Cc: 33092 <at> debbugs.gnu.org, "Richard M. Stallman" <rms@HIDDEN>
Received: via spool by 33092-submit <at> debbugs.gnu.org id=B33092.157246310019650
          (code B ref 33092); Wed, 30 Oct 2019 19:19:01 +0000
Received: (at 33092) by debbugs.gnu.org; 30 Oct 2019 19:18:20 +0000
Received: from localhost ([127.0.0.1]:51486 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iPtU4-00056r-9N
	for submit <at> debbugs.gnu.org; Wed, 30 Oct 2019 15:18:20 -0400
Received: from quimby.gnus.org ([80.91.231.51]:33222)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1iPtU2-00056j-38
 for 33092 <at> debbugs.gnu.org; Wed, 30 Oct 2019 15:18:18 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.89) (envelope-from <larsi@HIDDEN>)
 id 1iPtTx-0002UI-S1; Wed, 30 Oct 2019 20:18:16 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <CADbSrJwFuELWfZHNiSyPKWDMsBZRt3UaZT4m7rmKL+zdeNbnoQ@HIDDEN>
Date: Wed, 30 Oct 2019 20:18:13 +0100
In-Reply-To: <CADbSrJwFuELWfZHNiSyPKWDMsBZRt3UaZT4m7rmKL+zdeNbnoQ@HIDDEN>
 (Allen Li's message of "Fri, 19 Oct 2018 00:16:48 -0700")
Message-ID: <87wocmoxe2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Allen Li <darkfeline@HIDDEN> writes: > The `shell'
 command will call `make-comint-in-buffer' and `shell-mode'. > > `shell-mode'
 will then call `comint-mode' as a derived mode. > > `comint-mode' will call
 `kill-all-local-variables'. > > ` [...] 
 Content analysis details:   (-1.2 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
 0.1 URIBL_SBL_A Contains URL's A record listed in the Spamhaus SBL
 blocklist [URIs: felesatra.moe]
 1.6 URIBL_SBL Contains an URL's NS IP listed in the Spamhaus SBL
 blocklist [URIs: felesatra.moe]
X-Spam-Score: 0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

Allen Li <darkfeline@HIDDEN> writes:

> The `shell' command will call `make-comint-in-buffer' and `shell-mode'.
>
> `shell-mode' will then call `comint-mode' as a derived mode.
>
> `comint-mode' will call `kill-all-local-variables'.
>
> `comint-mode' also adds `font-lock-defontify' to
> `change-major-mode-hook'.  Since we're already in `shell-mode' derived
> from `comint-mode', switching "back" to `shell-mode' wipes font-lock.
>
> I can work around this pretty easily in my personal config, by removing
> `font-lock-defontify' from `change-major-mode-hook' with a well-placed
> advice, but the current behavior doesn't seem comfortable to me.

Yes, that seems odd.  Unfortunately the commit log for this just says:

commit 3dd4c1c5af3cdf77ba98b7255ec4034051107c6f
Author: Richard M. Stallman <rms@HIDDEN>
Date:   Tue Sep 10 16:44:58 2002 +0000

    (comint-mode): Add font-lock-defontify to change-major-mode-hook.

So I have no idea what this was supposed to fix.  Richard, do you
remember, by any chance?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.