bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EMACS=t causes problems


From: Dan Grayson
Subject: EMACS=t causes problems
Date: Tue, 11 Nov 2003 06:45:09 -0600 (CST)

Bash 2.05b turns off line editing provided by readline/history if it
detects the environment variable "EMACS" has the value "t".  That
variable is set in a shell running in an emacs shell buffer.  The
problem is that it is inherited by every process started there.  If I
start xterm from such a shell buffer, than command line editing is
mysteriously broken.

The correct test is to see whether the environment variable "TERM" has
the value "emacs" -- and that test is already there, and so the extra
test causes only problems.

The change occurred between 2.05a and 2.05b, which only this
explanation in CWRU/changelog:

+                                   7/1
+                                   ---
+ shell.c
+       - turn off line editing if $EMACS is set to `t'


Amazingly, a fix for this bug was offered in 1991, and was presumably
applied! 

    From: Eirik Fuller (address@hidden)
    Subject: no_line_editing in emacs shell buffer
    This is the only article in this thread
                      View: Original Format
    Newsgroups: gnu.bash.bug
    Date: 1991-05-05 19:46:00 PST

    There must be at least one other person in the world who sometimes
    forgets that the correct spelling of "xterm" is "EMACS= xterm" while
    in an emacs shell buffer (right Bill? :-).  For that matter, there
    might even be someone else who has used bash in M-x terminal-emulator.

    I was a little disappointed to find that this hadn't been fixed
    already; do I remember wrong that this has been reported before?

    EMACS=t is not a good test for whether line editing should be enabled.


    *** shell.c~ Fri May  3 14:06:17 1991
    --- shell.c Sun May  5 22:26:12 1991
    ***************
    *** 431,439 ****
    --- 431,445 ----

        if (interactive)
          {
    + #ifdef SILLY
            char *emacs = (char *)getenv ("EMACS");
            if (emacs && (strcmp (emacs, "t") == 0))
       no_line_editing = 1;
    + #else
    +       char *term = (char *)getenv ("TERM");
    +       if (term && (strcmp (term, "emacs") == 0))
    +  no_line_editing = 1;
    + #endif
          }

        top_level_arg_index = arg_index;


The fix today is slightly different:
-----------------------------------------------------------------------------
diff -ur 
/capybara/encap/capybara/share/capybara/packages/bash/TMP/tmp/./bash-2.05b/shell.c
 ./bash-2.05b/shell.c
--- 
/capybara/encap/capybara/share/capybara/packages/bash/TMP/tmp/./bash-2.05b/shell.c
  2002-07-01 10:27:11.000000000 -0500
+++ ./bash-2.05b/shell.c        2003-11-11 06:15:00.000000000 -0600
@@ -522,7 +522,6 @@
       term = getenv ("EMACS");
       running_under_emacs = term ? ((strmatch ("*term*", term, 0) == 0) ? 2 : 
1)
                                 : 0;
-      no_line_editing |= term && term[0] == 't' && term[1] == '\0';
     }
 
   top_level_arg_index = arg_index;
-----------------------------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]