comparison src/frame.c @ 83427:2afc49c9f0c0

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
author Karoly Lorentey <lorentey@elte.hu>
date Thu, 29 Dec 2005 04:31:04 +0000
parents 521d3f18b3d1
children 76396de7f50a
comparison
equal deleted inserted replaced
83426:7c7d1f1cb2e7 83427:2afc49c9f0c0
109 Lisp_Object Qleft_fringe, Qright_fringe; 109 Lisp_Object Qleft_fringe, Qright_fringe;
110 Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list; 110 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
117 Lisp_Object Qface_set_after_frame_default; 118 Lisp_Object Qface_set_after_frame_default;
118 119
1471 1472
1472 /* Don't let echo_area_window to remain on a deleted frame. */ 1473 /* Don't let echo_area_window to remain on a deleted frame. */
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))
1479 x_clear_frame_selections (f); 1498 x_clear_frame_selections (f);
1480 #endif 1499 #endif
2575 } 2594 }
2576 } 2595 }
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,
2583 doc: /* Height in pixels of a line in the font in frame FRAME. 2639 doc: /* Height in pixels of a line in the font in frame FRAME.
2584 If FRAME is omitted, the selected frame is used. 2640 If FRAME is omitted, the selected frame is used.
4230 staticpro (&Qtty); 4286 staticpro (&Qtty);
4231 Qtty_type = intern ("tty-type"); 4287 Qtty_type = intern ("tty-type");
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);
4238 4296
4239 Qfullwidth = intern ("fullwidth"); 4297 Qfullwidth = intern ("fullwidth");
4414 defsubr (&Sredirect_frame_focus); 4472 defsubr (&Sredirect_frame_focus);
4415 defsubr (&Sframe_focus); 4473 defsubr (&Sframe_focus);
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);
4422 defsubr (&Sframe_pixel_width); 4481 defsubr (&Sframe_pixel_width);
4423 defsubr (&Sset_frame_height); 4482 defsubr (&Sset_frame_height);