unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* compile mode and $EMACS
@ 2013-08-10 16:47 Sebastian Wiesner
  2013-08-10 22:38 ` Xue Fuqiao
  2013-08-11 12:28 ` Pascal J. Bourguignon
  0 siblings, 2 replies; 6+ messages in thread
From: Sebastian Wiesner @ 2013-08-10 16:47 UTC (permalink / raw)
  To: emacs-devel

Hello,

I just discovered that compile mode adds "EMACS=t" to the process
environment (see "compilation-start").

What is this variable for?  How is it supposed to be interpreted by
the invoked program?  Which programs do actually use it?

Greetings



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compile mode and $EMACS
  2013-08-10 16:47 compile mode and $EMACS Sebastian Wiesner
@ 2013-08-10 22:38 ` Xue Fuqiao
  2013-08-11 10:39   ` Sebastian Wiesner
  2013-08-11 12:28 ` Pascal J. Bourguignon
  1 sibling, 1 reply; 6+ messages in thread
From: Xue Fuqiao @ 2013-08-10 22:38 UTC (permalink / raw)
  To: Sebastian Wiesner; +Cc: emacs-devel

On Sun, Aug 11, 2013 at 12:47 AM, Sebastian Wiesner <lunaryorn@gmail.com> wrote:
> Hello,
>
> I just discovered that compile mode adds "EMACS=t" to the process
> environment (see "compilation-start").
>
> What is this variable for?  How is it supposed to be interpreted by
> the invoked program?  Which programs do actually use it?

In (info "(emacs) Interactive Shell"):

     Emacs sets the environment variable `INSIDE_EMACS' in the subshell
  to `VERSION,comint', where VERSION is the Emacs version (e.g., `24.1').
  Programs can check this variable to determine whether they are running
  inside an Emacs subshell.  (It also sets the `EMACS' environment
  variable to `t', if that environment variable is not already defined.
  However, this environment variable is deprecated; programs that use it
  should switch to using `INSIDE_EMACS' instead.)

-- 
Best regards, Xue Fuqiao.
http://www.gnu.org/software/emacs/



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compile mode and $EMACS
  2013-08-10 22:38 ` Xue Fuqiao
@ 2013-08-11 10:39   ` Sebastian Wiesner
  0 siblings, 0 replies; 6+ messages in thread
From: Sebastian Wiesner @ 2013-08-11 10:39 UTC (permalink / raw)
  To: Xue Fuqiao; +Cc: emacs-devel

2013/8/11 Xue Fuqiao <xfq.free@gmail.com>:
> On Sun, Aug 11, 2013 at 12:47 AM, Sebastian Wiesner <lunaryorn@gmail.com> wrote:
>> Hello,
>>
>> I just discovered that compile mode adds "EMACS=t" to the process
>> environment (see "compilation-start").
>>
>> What is this variable for?  How is it supposed to be interpreted by
>> the invoked program?  Which programs do actually use it?
>
> In (info "(emacs) Interactive Shell"):

Thank you.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compile mode and $EMACS
  2013-08-10 16:47 compile mode and $EMACS Sebastian Wiesner
  2013-08-10 22:38 ` Xue Fuqiao
@ 2013-08-11 12:28 ` Pascal J. Bourguignon
  2013-08-11 12:42   ` Sebastian Wiesner
  1 sibling, 1 reply; 6+ messages in thread
From: Pascal J. Bourguignon @ 2013-08-11 12:28 UTC (permalink / raw)
  To: emacs-devel

Sebastian Wiesner <lunaryorn@gmail.com> writes:

> Hello,
>
> I just discovered that compile mode adds "EMACS=t" to the process
> environment (see "compilation-start").
>
> […] How is it supposed to be interpreted by the invoked program?  […]

Some compilers may have different error message output formats depending
on whether they're run INSIDE_EMACS or not.

For example, ant has the -e option to output emacs friendly formatted
error messages.

(Of course, emacs can also adapt itself to the various compiler error
message output formats, cf. C-h v compilation-error-regexp-alist)


-- 
__Pascal Bourguignon__
http://www.informatimago.com/




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compile mode and $EMACS
  2013-08-11 12:28 ` Pascal J. Bourguignon
@ 2013-08-11 12:42   ` Sebastian Wiesner
  2013-08-11 13:06     ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Wiesner @ 2013-08-11 12:42 UTC (permalink / raw)
  To: Pascal J. Bourguignon; +Cc: emacs-devel

2013/8/11 Pascal J. Bourguignon <pjb@informatimago.com>:
> Sebastian Wiesner <lunaryorn@gmail.com> writes:
>
>> Hello,
>>
>> I just discovered that compile mode adds "EMACS=t" to the process
>> environment (see "compilation-start").
>>
>> […] How is it supposed to be interpreted by the invoked program?  […]
>
> Some compilers may have different error message output formats depending
> on whether they're run INSIDE_EMACS or not.

Which ones?  Can you name *concrete* examples?

> For example, ant has the -e option to output emacs friendly formatted
> error messages.

Yes, uhm, that's an explicit option to enable Emacs-friendly
formatting.  Many tools have those.  But I see no $EMACS variable
involved here…



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compile mode and $EMACS
  2013-08-11 12:42   ` Sebastian Wiesner
@ 2013-08-11 13:06     ` Andreas Schwab
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2013-08-11 13:06 UTC (permalink / raw)
  To: Sebastian Wiesner; +Cc: Pascal J. Bourguignon, emacs-devel

Sebastian Wiesner <lunaryorn@gmail.com> writes:

> Which ones?  Can you name *concrete* examples?

bash:
  /*
   * M-x term -> TERM=eterm EMACS=22.1 (term:0.96)	(eterm)
   * M-x shell -> TERM=dumb EMACS=t			(no line editing)
   * M-x terminal -> TERM=emacs-em7955 EMACS=		(line editing)
   */
  if (interactive_shell)
    {
      char *term, *emacs;

      term = get_string_value ("TERM");
      emacs = get_string_value ("EMACS");

      /* Not sure any emacs terminal emulator sets TERM=emacs any more */
      no_line_editing |= term && (STREQ (term, "emacs"));
      no_line_editing |= emacs && emacs[0] == 't' && emacs[1] == '\0' && STREQ (term, "dumb");

      /* running_under_emacs == 2 for `eterm' */
      running_under_emacs = (emacs != 0) || (term && STREQN (term, "emacs", 5));
      running_under_emacs += term && STREQN (term, "eterm", 5) && emacs && strstr (emacs, "term");

      if (running_under_emacs)
	gnu_error_format = 1;
    }

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-08-11 13:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-10 16:47 compile mode and $EMACS Sebastian Wiesner
2013-08-10 22:38 ` Xue Fuqiao
2013-08-11 10:39   ` Sebastian Wiesner
2013-08-11 12:28 ` Pascal J. Bourguignon
2013-08-11 12:42   ` Sebastian Wiesner
2013-08-11 13:06     ` Andreas Schwab

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).