From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Michael Hoffman" Newsgroups: gmane.emacs.bugs Subject: bug#11919: 24.1; term-emulate-term does not process bash's Ctrl-Z signal of directory name when an AnSi message is present Date: Mon, 23 Jan 2017 12:54:10 -0500 Message-ID: <26119-1485194282-859484@sneakemail.com> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1485194689 5659 195.159.176.226 (23 Jan 2017 18:04:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 23 Jan 2017 18:04:49 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 To: 11919@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 23 19:04:44 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cViyY-0007dz-B9 for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Jan 2017 19:04:18 +0100 Original-Received: from localhost ([::1]:43625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cViyd-0006Zw-K1 for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Jan 2017 13:04:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cViyS-0006XB-6K for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2017 13:04:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cViyI-0002Sr-Mi for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2017 13:04:12 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41169) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cViyI-0002Sn-J7 for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2017 13:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cViyI-0004lV-B5 for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2017 13:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Michael Hoffman" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Jan 2017 18:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11919 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.148519462618293 (code B ref -1); Mon, 23 Jan 2017 18:04:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Jan 2017 18:03:46 +0000 Original-Received: from localhost ([127.0.0.1]:39368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cViy1-0004kz-Pc for submit@debbugs.gnu.org; Mon, 23 Jan 2017 13:03:46 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46767) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cVip0-0004Vj-8P for submit@debbugs.gnu.org; Mon, 23 Jan 2017 12:54:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cViot-0005Pl-TZ for submit@debbugs.gnu.org; Mon, 23 Jan 2017 12:54:21 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:50856) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cViot-0005Pe-QL for submit@debbugs.gnu.org; Mon, 23 Jan 2017 12:54:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVios-0003Y1-Gx for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2017 12:54:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cVion-0005No-N0 for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2017 12:54:18 -0500 Original-Received: from sneak2.sneakemail.com ([64.46.156.55]:34159) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVion-0005Nd-Hj for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2017 12:54:13 -0500 Original-Received: from 128.100.132.181 by sneak2.sneakemail.com with SMTP; 23 Jan 2017 17:58:03 -0000 Original-Received: (sneakemail censored 26119-1485194282-859484 #3); 23 Jan 2017 17:58:03 -0000 Original-Received: (sneakemail censored 26119-1485194282-859484 #2); 23 Jan 2017 17:58:03 -0000 Original-Received: (sneakemail censored 26119-1485194282-859484 #1); 23 Jan 2017 17:58:03 -0000 In-Reply-To: X-Mailer: Perl5 Mail::Internet v X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Mon, 23 Jan 2017 13:03:43 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128335 Archived-At: On 07/11/2012 08:45 PM, Michael Hoffman wrote: > 1) emacs -Q > 2) M-x ansi-term RET /bin/bash RET > 3) PS1='\033AnSiTu x\012$ ' RET > > From then on, every prompt will be preceded by a Ctrl-Z character and > the working directory. This is because recent versions of bash > try to figure out whether they are running under emacs, and if they > are, output Ctrl-Z and the working directory before the PS1 prompt. > term-emulate-terminal normally eliminates such garbage, but not when > it has also processed an AnSi message. The elimination only happens > when the following conditions are true: > > (and (eq char ?\032) > (not handled-ansi-message)) > > Suggested fix: eliminate the "(not handled-ansi-message)" form. I have located the original commit that added the `handled-ansi-message` behavior: https://github.com/emacs-mirror/emacs/commit/59be5828de98814b8aa32718bf2b6196db085db1 Eli Zaretskii added it to "Let term-handle-ansi-terminal-messages override what Bash says about its current directory." In order to keep this behavior but not print garbage to the buffer: I would suggest that perhaps the call to `term-command-hook` is what should be conditioned on `(not handled-ansi-message)` and not the rest of the code in this branch which seems to remove the garbage. Michael Hoffman