bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: emacs Shell mode vs AC_CHECK_PROG(EMACS, ...)


From: Paul Eggert
Subject: Re: emacs Shell mode vs AC_CHECK_PROG(EMACS, ...)
Date: Mon, 11 Sep 2006 10:42:51 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

<Don.Bashford@stjude.org> writes:

> I like to do my builds of almost anything from source under emacs Shell
> mode.  But emacs Shell mode sets the environment variable EMACS to
> "t".  This causes the output of autoconf's AC_CHECK_PROG(EMACS, ...)
> to set EMACS="t", with the result that in any Makefile generated from
> EMACS = @EMACS@ in Makefile.in end up with the makefile variable EMACS
> set to "t".
>
> One example where this is a problem is the current (Sept 10) CVS
> version of gnuplot.
>
> It's not clear to me who should change: autoconf, emacs, developers
> using emacs as a built tool, or users like me.  If it's one of the
> latter two, a warning would be nice.  Perhaps the simplest solution
> would be for emacs Shell to either not set EMACS or set it to "emacs".
>
> emacs version: 21.3.1
> autoconf version: 2.60
> m4 version: 1.4.6
> system: fedora core 1 gnu/linux

Thanks for your bug report.  Other people have run into this problem
as well, but I don't know of any fix for it yet.  I like the simple
solution you suggested, but I think it'd be slightly better if EMACS
is set to Emacs's absolute file name, as that is less likely to cause
confusion later.  Here is a proposed patch to CVS Emacs to implement
this.

2006-09-11  Paul Eggert  <eggert@cs.ucla.edu>

        * make-dist (EMACS): Exit and fail if the EMACS environment
        variable is set to something other than an absolute file name.
        * etc/NEWS: In terminal-oriented subshells, the EMACS environment
        variable now defaults to Emacs's absolute file name, instead of
        to "t".
        * etc/PROBLEMS: Adjust tcsh advice for this.
        * lisp/comint.el (comint-exec-1): Set EMACS to the full name of Emacs,
        not to "t".
        * lisp/progmodes/compile.el (compilation-start): Likewise.
        * man/faq.texi (Escape sequences in shell output): EMACS is now set
        to Emacs's absolute file name, not to "t".
        (^M in the shell buffer): Likewise.
        * man/misc.texi (Interactive Shell): Likewise.

Index: make-dist
===================================================================
RCS file: /cvsroot/emacs/emacs/make-dist,v
retrieving revision 1.221
diff -p -c -b -w -r1.221 make-dist
*** make-dist   5 Jul 2006 06:42:27 -0000       1.221
--- make-dist   11 Sep 2006 17:33:22 -0000
*************** if [ ! -d src -o ! -f src/lisp.h -o ! -d
*** 120,127 ****
  fi
  
  ### Find where to run Emacs.
! ### (We don't accept EMACS=t as an answer, since that probably only means
! ### that the shell is running in an Emacs window.)
  if [ $update = yes ];
  then
    unset EMACS_UNIBYTE
--- 120,126 ----
  fi
  
  ### Find where to run Emacs.
! ### (Accept only absolute file names.)
  if [ $update = yes ];
  then
    unset EMACS_UNIBYTE
*************** then
*** 129,139 ****
    then
      EMACS=`pwd`/src/emacs
    else
!     if [ "x$EMACS" = "x" -o "x$EMACS" = "xt" ];
!     then
!       echo You must specify the EMACS environment variable 2>&1
        exit 1
!     fi
    fi
  fi
  
--- 128,142 ----
    then
      EMACS=`pwd`/src/emacs
    else
!     case $EMACS in
!       /*) ;;
!       *)
!       if [ ! -f "$EMACS" ]; then
!         echo "$0: You must specify the EMACS environment variable " \
!              "to an absolute file name." 2>&1
          exit 1
!       fi;;
!     esac
    fi
  fi
  
Index: etc/NEWS
===================================================================
RCS file: /cvsroot/emacs/emacs/etc/NEWS,v
retrieving revision 1.1393
diff -p -c -b -w -r1.1393 NEWS
*** etc/NEWS    10 Sep 2006 13:48:42 -0000      1.1393
--- etc/NEWS    11 Sep 2006 17:33:22 -0000
*************** otherwise behaves quite similarly to the
*** 1434,1439 ****
--- 1434,1443 ----
  `comint-use-prompt-regexp'.  The old name has been kept as an alias,
  but declared obsolete.
  
+ +++
+ *** The EMACS environment variable now defaults to Emacs's absolute
+ file name, instead of to "t".
+ 
  ** M-x Compile changes:
  
  ---
*************** it doesn't scroll the compilation output
*** 1490,1495 ****
--- 1494,1503 ----
  no arrow is displayed and a value of nil means display the message at the top
  of the window.
  
+ +++
+ *** The EMACS environment variable now defaults to Emacs's absolute
+ file name, instead of to "t".
+ 
  ** Occur mode changes:
  
  +++
Index: etc/PROBLEMS
===================================================================
RCS file: /cvsroot/emacs/emacs/etc/PROBLEMS,v
retrieving revision 1.196
diff -p -c -b -w -r1.196 PROBLEMS
*** etc/PROBLEMS        10 Sep 2006 12:28:28 -0000      1.196
--- etc/PROBLEMS        11 Sep 2006 17:33:23 -0000
*************** on the flag to output ^M at the end of e
*** 540,546 ****
  problem by adding this to your .cshrc file:
  
      if ($?EMACS) then
!         if ($EMACS == "t") then
              unset edit
              stty  -icrnl -onlcr -echo susp ^Z
          endif
--- 540,546 ----
  problem by adding this to your .cshrc file:
  
      if ($?EMACS) then
!         if ("$EMACS" =~ /*) then
              unset edit
              stty  -icrnl -onlcr -echo susp ^Z
          endif
Index: lisp/comint.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/comint.el,v
retrieving revision 1.346
diff -p -c -b -w -r1.346 comint.el
*** lisp/comint.el      2 Jun 2006 02:04:15 -0000       1.346
--- lisp/comint.el      11 Sep 2006 17:33:24 -0000
*************** buffer.  The hook `comint-exec-hook' is 
*** 765,771 ****
                    (format "COLUMNS=%d" (window-width)))
            (list "TERM=emacs"
                  (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))
!         (if (getenv "EMACS") nil (list "EMACS=t"))
          process-environment))
        (default-directory
          (if (file-accessible-directory-p default-directory)
--- 765,772 ----
                    (format "COLUMNS=%d" (window-width)))
            (list "TERM=emacs"
                  (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))
!         (unless (getenv "EMACS")
!           (list (concat "EMACS=" invocation-directory invocation-name)))
          process-environment))
        (default-directory
          (if (file-accessible-directory-p default-directory)
Index: lisp/progmodes/compile.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/compile.el,v
retrieving revision 1.405
diff -p -c -b -w -r1.405 compile.el
*** lisp/progmodes/compile.el   5 Sep 2006 14:53:24 -0000       1.405
--- lisp/progmodes/compile.el   11 Sep 2006 17:33:24 -0000
*************** Returns the compilation buffer created."
*** 1068,1074 ****
                              (window-width))))
              ;; Set the EMACS variable, but
              ;; don't override users' setting of $EMACS.
!             (unless (getenv "EMACS") '("EMACS=t"))
              (copy-sequence process-environment))))
        (set (make-local-variable 'compilation-arguments)
             (list command mode name-function highlight-regexp))
--- 1068,1075 ----
                              (window-width))))
              ;; Set the EMACS variable, but
              ;; don't override users' setting of $EMACS.
!             (unless (getenv "EMACS")
!               (list (concat "EMACS=" invocation-directory invocation-name)))
              (copy-sequence process-environment))))
        (set (make-local-variable 'compilation-arguments)
             (list command mode name-function highlight-regexp))
Index: man/faq.texi
===================================================================
RCS file: /cvsroot/emacs/emacs/man/faq.texi,v
retrieving revision 1.97
diff -p -c -r1.97 faq.texi
*** man/faq.texi        12 Aug 2006 14:13:31 -0000      1.97
--- man/faq.texi        11 Sep 2006 17:40:32 -0000
*************** shell init file.  You have two alternati
*** 2683,2689 ****
  @item
  Make the alias conditioned on the @code{EMACS} variable in the
  environment.  When Emacs runs a subsidiary shell, it exports the
! @code{EMACS} variable with the value @code{t} to that shell.  You can
  unalias @code{ls} when that happens, thus limiting the alias to your
  interactive sessions.
  
--- 2683,2690 ----
  @item
  Make the alias conditioned on the @code{EMACS} variable in the
  environment.  When Emacs runs a subsidiary shell, it exports the
! @code{EMACS} variable to that shell, with value equal to the absolute
! file name of Emacs.  You can
  unalias @code{ls} when that happens, thus limiting the alias to your
  interactive sessions.
  
*************** file:
*** 2753,2759 ****
  
  @example
  if ($?EMACS) then
!     if ("$EMACS" == t) then
          if ($?tcsh) unset edit
          stty nl
      endif
--- 2754,2760 ----
  
  @example
  if ($?EMACS) then
!     if ("$EMACS" =~ /*) then
          if ($?tcsh) unset edit
          stty nl
      endif
Index: man/misc.texi
===================================================================
RCS file: /cvsroot/emacs/emacs/man/misc.texi,v
retrieving revision 1.92
diff -p -c -b -w -r1.92 misc.texi
*** man/misc.texi       16 Aug 2006 05:14:31 -0000      1.92
--- man/misc.texi       11 Sep 2006 17:33:25 -0000
*************** Coding}.
*** 488,494 ****
  
  @cindex @env{EMACS} environment variable
    Unless the environment variable @env{EMACS} is already defined,
! Emacs defines it in the subshell, with value @code{t}.  A shell script
  can check this variable to determine whether it has been run from an
  Emacs subshell.
  
--- 488,495 ----
  
  @cindex @env{EMACS} environment variable
    Unless the environment variable @env{EMACS} is already defined,
! Emacs defines it in the subshell, with value equal to Emacs's absolute
! file name.  A shell script
  can check this variable to determine whether it has been run from an
  Emacs subshell.
  




reply via email to

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