aboutsummaryrefslogtreecommitdiffstats
path: root/src/frame.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c59
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;
111Lisp_Object Qtty_color_mode; 111Lisp_Object Qtty_color_mode;
112Lisp_Object Qtty, Qtty_type; 112Lisp_Object Qtty, Qtty_type;
113Lisp_Object Qwindow_system; 113Lisp_Object Qwindow_system;
114Lisp_Object Qenvironment;
114 115
115Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; 116Lisp_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
2600DEFUN ("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
2603The frame-local environment variable list is normally shared between
2604frames that were created in the same Emacsclient session. The
2605environment list is stored in a single frame's 'environment parameter;
2606the other frames' 'environment parameter is set to this frame. This
2607function follows to chain of 'environment references to reach the
2608frame that stores the actual local environment list, and returns that
2609frame. */)
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
2581DEFUN ("frame-char-height", Fframe_char_height, Sframe_char_height, 2637DEFUN ("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);