diff options
| author | Karoly Lorentey | 2005-12-29 04:31:04 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-12-29 04:31:04 +0000 |
| commit | da8e8fc14f3166ec596e34f43fbfea866d1176df (patch) | |
| tree | 9c31affcb4b837cac4793f10acbafc562bfd08e4 /src/frame.c | |
| parent | 86f5ca04d94ad551d3aa726e15281e75ef0189ed (diff) | |
| download | emacs-da8e8fc14f3166ec596e34f43fbfea866d1176df.tar.gz emacs-da8e8fc14f3166ec596e34f43fbfea866d1176df.zip | |
Store local environment in frame (not terminal) parameters.
* src/callproc.c (child_setup, getenv_internal, Fgetenv_internal):
Store the local environment in a frame (not terminal) parameter.
Update doc strings.
(syms_of_callproc): Update doc strings.
(Qenvironment): Moved to frame.c.
* lisp/env.el (read-envvar-name, setenv, getenv, environment): Use frame
parameters to store the local environment, not terminal parameters.
* server.el (server-process-filter): Store the local environment in a
frame (not terminal) parameter. Do not try to decode environment
strings.
* lisp/frame.el (make-frame): Set up the 'environment frame parameter,
when needed.
* src/frame.c (Qenvironment): Move here from callproc.c.
(Fdelete_frame): Don't allow other frames to refer to a deleted frame
in their 'environment parameter.
(Fframe_with_environment): New function.
(syms_of_frame): Defsubr it. Initialize and staticpro Qenvironment.
* frame.h (Qenvironment): Declare.
* lisp.h (Fframe_with_environment): EXFUN it.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-467
Diffstat (limited to 'src/frame.c')
| -rw-r--r-- | src/frame.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/frame.c b/src/frame.c index c3140628cec..f0657975402 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -111,6 +111,7 @@ Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list; | |||
| 111 | Lisp_Object Qtty_color_mode; | 111 | Lisp_Object Qtty_color_mode; |
| 112 | Lisp_Object Qtty, Qtty_type; | 112 | Lisp_Object Qtty, Qtty_type; |
| 113 | Lisp_Object Qwindow_system; | 113 | Lisp_Object Qwindow_system; |
| 114 | Lisp_Object Qenvironment; | ||
| 114 | 115 | ||
| 115 | Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; | 116 | Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; |
| 116 | 117 | ||
| @@ -1473,6 +1474,24 @@ The functions are run with one arg, the frame to be deleted. */) | |||
| 1473 | if (EQ (f->minibuffer_window, echo_area_window)) | 1474 | if (EQ (f->minibuffer_window, echo_area_window)) |
| 1474 | echo_area_window = sf->minibuffer_window; | 1475 | echo_area_window = sf->minibuffer_window; |
| 1475 | 1476 | ||
| 1477 | /* Don't allow other frames to refer to a deleted frame in their | ||
| 1478 | 'environment parameter. */ | ||
| 1479 | { | ||
| 1480 | Lisp_Object tail, frame1; | ||
| 1481 | Lisp_Object env = get_frame_param (XFRAME (frame), Qenvironment); | ||
| 1482 | FOR_EACH_FRAME (tail, frame1) | ||
| 1483 | { | ||
| 1484 | if (EQ (frame, frame1) || !FRAME_LIVE_P (XFRAME (frame1))) | ||
| 1485 | continue; | ||
| 1486 | if (EQ (frame, get_frame_param (XFRAME (frame1), Qenvironment))) | ||
| 1487 | { | ||
| 1488 | store_frame_param (XFRAME (frame1), Qenvironment, env); | ||
| 1489 | if (!FRAMEP (env)) | ||
| 1490 | env = frame1; | ||
| 1491 | } | ||
| 1492 | } | ||
| 1493 | } | ||
| 1494 | |||
| 1476 | /* Clear any X selections for this frame. */ | 1495 | /* Clear any X selections for this frame. */ |
| 1477 | #ifdef HAVE_X_WINDOWS | 1496 | #ifdef HAVE_X_WINDOWS |
| 1478 | if (FRAME_X_P (f)) | 1497 | if (FRAME_X_P (f)) |
| @@ -2577,6 +2596,43 @@ enabled such bindings for that variable with `make-variable-frame-local'. */) | |||
| 2577 | 2596 | ||
| 2578 | return unbind_to (count, Qnil); | 2597 | return unbind_to (count, Qnil); |
| 2579 | } | 2598 | } |
| 2599 | |||
| 2600 | DEFUN ("frame-with-environment", Fframe_with_environment, Sframe_with_environment, 0, 1, 0, | ||
| 2601 | doc: /* Return the frame that has the environment variable list for FRAME. | ||
| 2602 | |||
| 2603 | The frame-local environment variable list is normally shared between | ||
| 2604 | frames that were created in the same Emacsclient session. The | ||
| 2605 | environment list is stored in a single frame's 'environment parameter; | ||
| 2606 | the other frames' 'environment parameter is set to this frame. This | ||
| 2607 | function follows to chain of 'environment references to reach the | ||
| 2608 | frame that stores the actual local environment list, and returns that | ||
| 2609 | frame. */) | ||
| 2610 | (frame) | ||
| 2611 | Lisp_Object frame; | ||
| 2612 | { | ||
| 2613 | Lisp_Object hare, tortoise; | ||
| 2614 | |||
| 2615 | if (NILP (frame)) | ||
| 2616 | frame = selected_frame; | ||
| 2617 | CHECK_FRAME (frame); | ||
| 2618 | |||
| 2619 | hare = tortoise = get_frame_param (XFRAME (frame), Qenvironment); | ||
| 2620 | while (!NILP (hare) && FRAMEP (hare)) | ||
| 2621 | { | ||
| 2622 | frame = hare; | ||
| 2623 | hare = get_frame_param (XFRAME (hare), Qenvironment); | ||
| 2624 | if (NILP (hare) || !FRAMEP (hare)) | ||
| 2625 | break; | ||
| 2626 | frame = hare; | ||
| 2627 | hare = get_frame_param (XFRAME (hare), Qenvironment); | ||
| 2628 | tortoise = get_frame_param (XFRAME (tortoise), Qenvironment); | ||
| 2629 | if (EQ (hare, tortoise)) | ||
| 2630 | error ("Cyclic frame-local environment indirection"); | ||
| 2631 | } | ||
| 2632 | |||
| 2633 | return frame; | ||
| 2634 | } | ||
| 2635 | |||
| 2580 | 2636 | ||
| 2581 | DEFUN ("frame-char-height", Fframe_char_height, Sframe_char_height, | 2637 | DEFUN ("frame-char-height", Fframe_char_height, Sframe_char_height, |
| 2582 | 0, 1, 0, | 2638 | 0, 1, 0, |
| @@ -4232,6 +4288,8 @@ syms_of_frame () | |||
| 4232 | staticpro (&Qtty_type); | 4288 | staticpro (&Qtty_type); |
| 4233 | Qwindow_system = intern ("window-system"); | 4289 | Qwindow_system = intern ("window-system"); |
| 4234 | staticpro (&Qwindow_system); | 4290 | staticpro (&Qwindow_system); |
| 4291 | Qenvironment = intern ("environment"); | ||
| 4292 | staticpro (&Qenvironment); | ||
| 4235 | 4293 | ||
| 4236 | Qface_set_after_frame_default = intern ("face-set-after-frame-default"); | 4294 | Qface_set_after_frame_default = intern ("face-set-after-frame-default"); |
| 4237 | staticpro (&Qface_set_after_frame_default); | 4295 | staticpro (&Qface_set_after_frame_default); |
| @@ -4416,6 +4474,7 @@ This variable is local to the current terminal and cannot be buffer-local. */); | |||
| 4416 | defsubr (&Sframe_parameters); | 4474 | defsubr (&Sframe_parameters); |
| 4417 | defsubr (&Sframe_parameter); | 4475 | defsubr (&Sframe_parameter); |
| 4418 | defsubr (&Smodify_frame_parameters); | 4476 | defsubr (&Smodify_frame_parameters); |
| 4477 | defsubr (&Sframe_with_environment); | ||
| 4419 | defsubr (&Sframe_char_height); | 4478 | defsubr (&Sframe_char_height); |
| 4420 | defsubr (&Sframe_char_width); | 4479 | defsubr (&Sframe_char_width); |
| 4421 | defsubr (&Sframe_pixel_height); | 4480 | defsubr (&Sframe_pixel_height); |