Mercurial > emacs
changeset 84740:275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
parameter rather than Qdisplay_environment_variable. If all else
fails, look for DISPLAY in initial-environment.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 21 Sep 2007 06:58:51 +0000 |
parents | ed643c57fe39 |
children | e903d611edc5 |
files | src/ChangeLog src/callproc.c |
diffstat | 2 files changed, 53 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Fri Sep 21 05:24:06 2007 +0000 +++ b/src/ChangeLog Fri Sep 21 06:58:51 2007 +0000 @@ -1,11 +1,16 @@ +2007-09-21 Stefan Monnier <monnier@iro.umontreal.ca> + + * callproc.c (child_setup, getenv_internal): Use the frame's `display' + parameter rather than Qdisplay_environment_variable. If all else + fails, look for DISPLAY in initial-environment. + 2007-09-21 Glenn Morris <rgm@gnu.org> * Makefile.in (emacstool): Remove target. 2007-09-21 Markus Triska <markus.triska@gmx.at> - * xterm.c (x_delete_display): Compile session management - conditionally. + * xterm.c (x_delete_display): Compile session management conditionally. 2007-09-20 Stefan Monnier <monnier@iro.umontreal.ca> @@ -13,7 +18,7 @@ (getenv_internal): Use it. (Fgetenv_internal): Use it. Accept an env-list as optional arg. - * terminal.c (get_terminal): Don't accept integers to represent terminals. + * terminal.c (get_terminal): Don't accept ints to represent terminals. (Fterminal_name, Fterminal_parameters, Fterminal_parameter) (Fset_terminal_parameter): Work with dead terminals as well. (Fmodify_terminal_parameters): Remove. @@ -32,7 +37,8 @@ * alloc.c (enum mem_type): New member for `terminal' objects. (allocate_terminal): New function. - (mark_maybe_pointer, valid_lisp_object_p, mark_object): Handle terminals. + (mark_maybe_pointer, valid_lisp_object_p, mark_object): + Handle terminals. (mark_terminal): New fun. (mark_terminals): Move from terminal.c.
--- a/src/callproc.c Fri Sep 21 05:24:06 2007 +0000 +++ b/src/callproc.c Fri Sep 21 06:58:51 2007 +0000 @@ -141,6 +141,8 @@ /* Nonzero if this is termination due to exit. */ static int call_process_exited; +EXFUN (Fgetenv_internal, 2); + #ifndef VMS /* VMS version is in vmsproc.c. */ static Lisp_Object @@ -1326,29 +1328,36 @@ register char **new_env; char **p, **q; register int new_length; - Lisp_Object local = selected_frame; /* get_frame_param (XFRAME (Fframe_with_environment (selected_frame)), */ -/* Qenvironment); */ - - Lisp_Object display; + Lisp_Object display = Qnil; new_length = 0; for (tem = Vprocess_environment; CONSP (tem) && STRINGP (XCAR (tem)); tem = XCDR (tem)) - new_length++; + { + if (strncmp (SDATA (XCAR (tem)), "DISPLAY", 7) == 0 + && (SDATA (XCAR (tem)) [7] == '\0' + || SDATA (XCAR (tem)) [7] == '=')) + /* DISPLAY is specified in process-environment. */ + display = Qt; + new_length++; + } -#if 0 - for (tem = local; - CONSP (tem) && STRINGP (XCAR (tem)); - tem = XCDR (tem)) - new_length++; -#endif - - /* Add DISPLAY from the frame local values. */ - display = get_frame_param (XFRAME (local), Qdisplay_environment_variable); - if (! NILP (display)) - new_length++; + /* If not provided yet, use the frame's DISPLAY. */ + if (NILP (display)) + { + Lisp_Object tmp = Fframe_parameter (selected_frame, Qdisplay); + if (!STRINGP (tmp) && CONSP (Vinitial_environment)) + /* If still not found, Look for DISPLAY in Vinitial_environment. */ + tmp = Fgetenv_internal (build_string ("DISPLAY"), + Vinitial_environment); + if (STRINGP (tmp)) + { + display = tmp; + new_length++; + } + } /* new_length + 2 to include PWD and terminating 0. */ env = new_env = (char **) alloca ((new_length + 2) * sizeof (char *)); @@ -1370,20 +1379,8 @@ for (tem = Vprocess_environment; CONSP (tem) && STRINGP (XCAR (tem)); tem = XCDR (tem)) - { - if (strcmp (SDATA (XCAR (tem)), "DISPLAY") != 0) - new_env = add_env (env, new_env, SDATA (XCAR (tem))); - } + new_env = add_env (env, new_env, SDATA (XCAR (tem))); - -#if 0 - /* Local part of environment. */ - for (tem = local; - CONSP (tem) && STRINGP (XCAR (tem)); - tem = XCDR (tem)) - new_env = add_env (env, new_env, SDATA (XCAR (tem))); -#endif - *new_env = 0; /* Remove variable names without values. */ @@ -1558,44 +1555,28 @@ int *valuelen; Lisp_Object frame; { - Lisp_Object display; + /* Try to find VAR in Vprocess_environment first. */ + if (getenv_internal_1 (var, varlen, value, valuelen, + Vprocess_environment)) + return *value ? 1 : 0; - /* FIXME: weird behavior. */ - - if (NILP (frame)) + /* For DISPLAY try to get the values from the frame or the initial env. */ + if (strcmp (var, "DISPLAY") == 0) { - /* Try to find VAR in Vprocess_environment first. */ - if (getenv_internal_1 (var, varlen, value, valuelen, - Vprocess_environment)) - return value ? 1 : 0; - else - frame = selected_frame; - } - - /* For DISPLAY first try to get the values from the frame. */ - display = get_frame_param (XFRAME (frame), Qdisplay_environment_variable); - if (strcmp (var, "DISPLAY") == 0) - if (! NILP (display)) - { + Lisp_Object display + = Fframe_parameter (NILP (frame) ? selected_frame : frame, Qdisplay); + if (STRINGP (display)) + { *value = (char *) SDATA (display); *valuelen = SBYTES (display); return 1; - } - - /* Try to find VAR in Vprocess_environment. */ - if (getenv_internal_1 (var, varlen, value, valuelen, - Vprocess_environment)) - return value ? 1 : 0; + } + /* If still not found, Look for DISPLAY in Vinitial_environment. */ + if (getenv_internal_1 (var, varlen, value, valuelen, + Vinitial_environment)) + return *value ? 1 : 0; + } -#if 0 - /* Find the environment in which to search the variable. */ - CHECK_FRAME (frame); - frame = Fframe_with_environment (frame); - - if (getenv_internal_1 (var, varlen, value, valuelen, - get_frame_param (XFRAME (frame), Qenvironment))) - return value ? 1 : 0; -#endif return 0; } @@ -1629,7 +1610,7 @@ return Qnil; } else if (getenv_internal (SDATA (variable), SBYTES (variable), - &value, &valuelen, env)) + &value, &valuelen, env)) return make_string (value, valuelen); else return Qnil;