diff options
| author | Stefan Monnier | 2007-09-21 06:58:51 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-09-21 06:58:51 +0000 |
| commit | d2bb65982c9fc5781f3346432951b250360686f5 (patch) | |
| tree | 3f28e232a7664b4fdbf64b5eae751d3b04334063 /src | |
| parent | d037d5016819bf00d84fafdfd228729949ba645f (diff) | |
| download | emacs-d2bb65982c9fc5781f3346432951b250360686f5.tar.gz emacs-d2bb65982c9fc5781f3346432951b250360686f5.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/callproc.c | 105 |
2 files changed, 53 insertions, 66 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6b6e4927ba1..1c303f806ce 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,11 +1,16 @@ | |||
| 1 | 2007-09-21 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * callproc.c (child_setup, getenv_internal): Use the frame's `display' | ||
| 4 | parameter rather than Qdisplay_environment_variable. If all else | ||
| 5 | fails, look for DISPLAY in initial-environment. | ||
| 6 | |||
| 1 | 2007-09-21 Glenn Morris <rgm@gnu.org> | 7 | 2007-09-21 Glenn Morris <rgm@gnu.org> |
| 2 | 8 | ||
| 3 | * Makefile.in (emacstool): Remove target. | 9 | * Makefile.in (emacstool): Remove target. |
| 4 | 10 | ||
| 5 | 2007-09-21 Markus Triska <markus.triska@gmx.at> | 11 | 2007-09-21 Markus Triska <markus.triska@gmx.at> |
| 6 | 12 | ||
| 7 | * xterm.c (x_delete_display): Compile session management | 13 | * xterm.c (x_delete_display): Compile session management conditionally. |
| 8 | conditionally. | ||
| 9 | 14 | ||
| 10 | 2007-09-20 Stefan Monnier <monnier@iro.umontreal.ca> | 15 | 2007-09-20 Stefan Monnier <monnier@iro.umontreal.ca> |
| 11 | 16 | ||
| @@ -13,7 +18,7 @@ | |||
| 13 | (getenv_internal): Use it. | 18 | (getenv_internal): Use it. |
| 14 | (Fgetenv_internal): Use it. Accept an env-list as optional arg. | 19 | (Fgetenv_internal): Use it. Accept an env-list as optional arg. |
| 15 | 20 | ||
| 16 | * terminal.c (get_terminal): Don't accept integers to represent terminals. | 21 | * terminal.c (get_terminal): Don't accept ints to represent terminals. |
| 17 | (Fterminal_name, Fterminal_parameters, Fterminal_parameter) | 22 | (Fterminal_name, Fterminal_parameters, Fterminal_parameter) |
| 18 | (Fset_terminal_parameter): Work with dead terminals as well. | 23 | (Fset_terminal_parameter): Work with dead terminals as well. |
| 19 | (Fmodify_terminal_parameters): Remove. | 24 | (Fmodify_terminal_parameters): Remove. |
| @@ -32,7 +37,8 @@ | |||
| 32 | 37 | ||
| 33 | * alloc.c (enum mem_type): New member for `terminal' objects. | 38 | * alloc.c (enum mem_type): New member for `terminal' objects. |
| 34 | (allocate_terminal): New function. | 39 | (allocate_terminal): New function. |
| 35 | (mark_maybe_pointer, valid_lisp_object_p, mark_object): Handle terminals. | 40 | (mark_maybe_pointer, valid_lisp_object_p, mark_object): |
| 41 | Handle terminals. | ||
| 36 | (mark_terminal): New fun. | 42 | (mark_terminal): New fun. |
| 37 | (mark_terminals): Move from terminal.c. | 43 | (mark_terminals): Move from terminal.c. |
| 38 | 44 | ||
diff --git a/src/callproc.c b/src/callproc.c index fafbfbffe91..0fa0c3a8662 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -141,6 +141,8 @@ int synch_process_retcode; | |||
| 141 | /* Nonzero if this is termination due to exit. */ | 141 | /* Nonzero if this is termination due to exit. */ |
| 142 | static int call_process_exited; | 142 | static int call_process_exited; |
| 143 | 143 | ||
| 144 | EXFUN (Fgetenv_internal, 2); | ||
| 145 | |||
| 144 | #ifndef VMS /* VMS version is in vmsproc.c. */ | 146 | #ifndef VMS /* VMS version is in vmsproc.c. */ |
| 145 | 147 | ||
| 146 | static Lisp_Object | 148 | static Lisp_Object |
| @@ -1326,29 +1328,36 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) | |||
| 1326 | register char **new_env; | 1328 | register char **new_env; |
| 1327 | char **p, **q; | 1329 | char **p, **q; |
| 1328 | register int new_length; | 1330 | register int new_length; |
| 1329 | Lisp_Object local = selected_frame; /* get_frame_param (XFRAME (Fframe_with_environment (selected_frame)), */ | 1331 | Lisp_Object display = Qnil; |
| 1330 | /* Qenvironment); */ | ||
| 1331 | |||
| 1332 | Lisp_Object display; | ||
| 1333 | 1332 | ||
| 1334 | new_length = 0; | 1333 | new_length = 0; |
| 1335 | 1334 | ||
| 1336 | for (tem = Vprocess_environment; | 1335 | for (tem = Vprocess_environment; |
| 1337 | CONSP (tem) && STRINGP (XCAR (tem)); | 1336 | CONSP (tem) && STRINGP (XCAR (tem)); |
| 1338 | tem = XCDR (tem)) | 1337 | tem = XCDR (tem)) |
| 1339 | new_length++; | 1338 | { |
| 1340 | 1339 | if (strncmp (SDATA (XCAR (tem)), "DISPLAY", 7) == 0 | |
| 1341 | #if 0 | 1340 | && (SDATA (XCAR (tem)) [7] == '\0' |
| 1342 | for (tem = local; | 1341 | || SDATA (XCAR (tem)) [7] == '=')) |
| 1343 | CONSP (tem) && STRINGP (XCAR (tem)); | 1342 | /* DISPLAY is specified in process-environment. */ |
| 1344 | tem = XCDR (tem)) | 1343 | display = Qt; |
| 1345 | new_length++; | 1344 | new_length++; |
| 1346 | #endif | 1345 | } |
| 1347 | 1346 | ||
| 1348 | /* Add DISPLAY from the frame local values. */ | 1347 | /* If not provided yet, use the frame's DISPLAY. */ |
| 1349 | display = get_frame_param (XFRAME (local), Qdisplay_environment_variable); | 1348 | if (NILP (display)) |
| 1350 | if (! NILP (display)) | 1349 | { |
| 1351 | new_length++; | 1350 | Lisp_Object tmp = Fframe_parameter (selected_frame, Qdisplay); |
| 1351 | if (!STRINGP (tmp) && CONSP (Vinitial_environment)) | ||
| 1352 | /* If still not found, Look for DISPLAY in Vinitial_environment. */ | ||
| 1353 | tmp = Fgetenv_internal (build_string ("DISPLAY"), | ||
| 1354 | Vinitial_environment); | ||
| 1355 | if (STRINGP (tmp)) | ||
| 1356 | { | ||
| 1357 | display = tmp; | ||
| 1358 | new_length++; | ||
| 1359 | } | ||
| 1360 | } | ||
| 1352 | 1361 | ||
| 1353 | /* new_length + 2 to include PWD and terminating 0. */ | 1362 | /* new_length + 2 to include PWD and terminating 0. */ |
| 1354 | env = new_env = (char **) alloca ((new_length + 2) * sizeof (char *)); | 1363 | env = new_env = (char **) alloca ((new_length + 2) * sizeof (char *)); |
| @@ -1370,20 +1379,8 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) | |||
| 1370 | for (tem = Vprocess_environment; | 1379 | for (tem = Vprocess_environment; |
| 1371 | CONSP (tem) && STRINGP (XCAR (tem)); | 1380 | CONSP (tem) && STRINGP (XCAR (tem)); |
| 1372 | tem = XCDR (tem)) | 1381 | tem = XCDR (tem)) |
| 1373 | { | ||
| 1374 | if (strcmp (SDATA (XCAR (tem)), "DISPLAY") != 0) | ||
| 1375 | new_env = add_env (env, new_env, SDATA (XCAR (tem))); | ||
| 1376 | } | ||
| 1377 | |||
| 1378 | |||
| 1379 | #if 0 | ||
| 1380 | /* Local part of environment. */ | ||
| 1381 | for (tem = local; | ||
| 1382 | CONSP (tem) && STRINGP (XCAR (tem)); | ||
| 1383 | tem = XCDR (tem)) | ||
| 1384 | new_env = add_env (env, new_env, SDATA (XCAR (tem))); | 1382 | new_env = add_env (env, new_env, SDATA (XCAR (tem))); |
| 1385 | #endif | 1383 | |
| 1386 | |||
| 1387 | *new_env = 0; | 1384 | *new_env = 0; |
| 1388 | 1385 | ||
| 1389 | /* Remove variable names without values. */ | 1386 | /* Remove variable names without values. */ |
| @@ -1558,44 +1555,28 @@ getenv_internal (var, varlen, value, valuelen, frame) | |||
| 1558 | int *valuelen; | 1555 | int *valuelen; |
| 1559 | Lisp_Object frame; | 1556 | Lisp_Object frame; |
| 1560 | { | 1557 | { |
| 1561 | Lisp_Object display; | 1558 | /* Try to find VAR in Vprocess_environment first. */ |
| 1562 | 1559 | if (getenv_internal_1 (var, varlen, value, valuelen, | |
| 1563 | /* FIXME: weird behavior. */ | 1560 | Vprocess_environment)) |
| 1564 | 1561 | return *value ? 1 : 0; | |
| 1565 | if (NILP (frame)) | ||
| 1566 | { | ||
| 1567 | /* Try to find VAR in Vprocess_environment first. */ | ||
| 1568 | if (getenv_internal_1 (var, varlen, value, valuelen, | ||
| 1569 | Vprocess_environment)) | ||
| 1570 | return value ? 1 : 0; | ||
| 1571 | else | ||
| 1572 | frame = selected_frame; | ||
| 1573 | } | ||
| 1574 | 1562 | ||
| 1575 | /* For DISPLAY first try to get the values from the frame. */ | 1563 | /* For DISPLAY try to get the values from the frame or the initial env. */ |
| 1576 | display = get_frame_param (XFRAME (frame), Qdisplay_environment_variable); | ||
| 1577 | if (strcmp (var, "DISPLAY") == 0) | 1564 | if (strcmp (var, "DISPLAY") == 0) |
| 1578 | if (! NILP (display)) | 1565 | { |
| 1579 | { | 1566 | Lisp_Object display |
| 1567 | = Fframe_parameter (NILP (frame) ? selected_frame : frame, Qdisplay); | ||
| 1568 | if (STRINGP (display)) | ||
| 1569 | { | ||
| 1580 | *value = (char *) SDATA (display); | 1570 | *value = (char *) SDATA (display); |
| 1581 | *valuelen = SBYTES (display); | 1571 | *valuelen = SBYTES (display); |
| 1582 | return 1; | 1572 | return 1; |
| 1583 | } | 1573 | } |
| 1584 | 1574 | /* If still not found, Look for DISPLAY in Vinitial_environment. */ | |
| 1585 | /* Try to find VAR in Vprocess_environment. */ | 1575 | if (getenv_internal_1 (var, varlen, value, valuelen, |
| 1586 | if (getenv_internal_1 (var, varlen, value, valuelen, | 1576 | Vinitial_environment)) |
| 1587 | Vprocess_environment)) | 1577 | return *value ? 1 : 0; |
| 1588 | return value ? 1 : 0; | 1578 | } |
| 1589 | |||
| 1590 | #if 0 | ||
| 1591 | /* Find the environment in which to search the variable. */ | ||
| 1592 | CHECK_FRAME (frame); | ||
| 1593 | frame = Fframe_with_environment (frame); | ||
| 1594 | 1579 | ||
| 1595 | if (getenv_internal_1 (var, varlen, value, valuelen, | ||
| 1596 | get_frame_param (XFRAME (frame), Qenvironment))) | ||
| 1597 | return value ? 1 : 0; | ||
| 1598 | #endif | ||
| 1599 | return 0; | 1580 | return 0; |
| 1600 | } | 1581 | } |
| 1601 | 1582 | ||
| @@ -1629,7 +1610,7 @@ will simply look up the variable in that frame's environment. */) | |||
| 1629 | return Qnil; | 1610 | return Qnil; |
| 1630 | } | 1611 | } |
| 1631 | else if (getenv_internal (SDATA (variable), SBYTES (variable), | 1612 | else if (getenv_internal (SDATA (variable), SBYTES (variable), |
| 1632 | &value, &valuelen, env)) | 1613 | &value, &valuelen, env)) |
| 1633 | return make_string (value, valuelen); | 1614 | return make_string (value, valuelen); |
| 1634 | else | 1615 | else |
| 1635 | return Qnil; | 1616 | return Qnil; |