GNU bug report logs - #11919
24.1; term-emulate-term does not process bash's Ctrl-Z signal of directory name when an AnSi message is present

Previous Next

Package: emacs;

Reported by: Michael Hoffman <b3i4old02 <at> sneakemail.com>

Date: Thu, 12 Jul 2012 00:52:01 UTC

Severity: normal

Found in version 24.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Hoffman <hoffman <at> cantab.net>
To: "Eli Zaretskii eliz-at-gnu.org |gmane3-hoffman|" <0wdp3p2xrt <at> sneakemail.com>
Cc: 11919 <at> debbugs.gnu.org, Michael Hoffman <gmane3-hoffman <at> snkmail.com>
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 14:24:28 -0500
[Message part 1 (text/plain, inline)]
On Mon, Jan 23, 2017 at 1:18 PM, Eli Zaretskii eliz-at-gnu.org
|gmane3-hoffman| <0wdp3p2xrt <at> sneakemail.com> wrote:

> > From: "Michael Hoffman" <gmane3-hoffman <at> snkmail.com>
> > Date: Mon, 23 Jan 2017 12:54:10 -0500
> >
> > I have located the original commit that added the `handled-ansi-message`
> > behavior:
> > https://github.com/emacs-mirror/emacs/commit/59be5828de98814
> b8aa32718bf2b6196db085db1
> >
> > Eli Zaretskii added it to "Let term-handle-ansi-terminal-messages
> > override what Bash says about its current directory."
>
> I was just committing someone else's patch in that case.
>

Please accept my apologies.


> See these messages in the archives for the reason why that change was
> done:
>
>   https://lists.gnu.org/archive/html/emacs-pretest-bug/2005-11
> /msg00020.html
>   https://lists.gnu.org/archive/html/emacs-pretest-bug/2005-11
> /msg00103.html
>   https://lists.gnu.org/archive/html/emacs-pretest-bug/2005-12
> /msg00089.html
>
> If you can propose changes that solve this issue without
> re-introducing that one, please do.
>

The below patch eliminates the garbage printing while maintaining the
behavior added in 2005 of having `handled-ansi-message` preventing any
updates to `default-directory` based on a \032 escape.

mhoffman <at> mhoffman2 ~/share/emacs/25.1/lisp
$ diff -u <(zcat term.el.gz) term.el
--- /dev/fd/63  2017-01-23 14:13:55.948963291 -0500
+++ term.el     2017-01-23 14:11:43.903830242 -0500
@@ -2869,15 +2869,16 @@
                         ((eq char ?\017))     ; Shift In - ignored
                         ((eq char ?\^G) ;; (terminfo: bel)
                          (beep t))
-                        ((and (eq char ?\032)
-                               (not handled-ansi-message))
+                        ((eq char ?\032)
                          (let ((end (string-match "\r?$" str i)))
                            (if end
-                               (funcall term-command-hook
-                                        (decode-coding-string
-                                         (prog1 (substring str (1+ i) end)
-                                           (setq i (match-end 0)))
-                                         locale-coding-system))
+                                (progn
+                                  (unless handled-ansi-message
+                                    (funcall term-command-hook
+                                             (decode-coding-string
+                                              (substring str (1+ i) end)
+                                              locale-coding-system)))
+                                  (setq i (match-end 0)))
                              (setq term-terminal-parameter (substring str
i))
                              (setq term-terminal-state 4)
                              (setq i str-length))))

====
ChangeLog:

2017-01-23  Michael Hoffman  <emacs-hoffman <at> sneakemail.com>

  * term.el (term-emulate-terminal): fix bug#11919:
  do not display ?\032 escape codes even when `handled-ansi-message` is true
[Message part 2 (text/html, inline)]

This bug report was last modified 8 years and 113 days ago.

Previous Next


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