summaryrefslogtreecommitdiff
path: root/src/frame.c
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2005-12-29 04:31:04 +0000
committerKaroly Lorentey <lorentey@elte.hu>2005-12-29 04:31:04 +0000
commitda8e8fc14f3166ec596e34f43fbfea866d1176df (patch)
tree9c31affcb4b837cac4793f10acbafc562bfd08e4 /src/frame.c
parent86f5ca04d94ad551d3aa726e15281e75ef0189ed (diff)
downloademacs-da8e8fc14f3166ec596e34f43fbfea866d1176df.tar.gz
emacs-da8e8fc14f3166ec596e34f43fbfea866d1176df.tar.bz2
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.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;
Lisp_Object Qtty_color_mode;
Lisp_Object Qtty, Qtty_type;
Lisp_Object Qwindow_system;
+Lisp_Object Qenvironment;
Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
@@ -1473,6 +1474,24 @@ The functions are run with one arg, the frame to be deleted. */)
if (EQ (f->minibuffer_window, echo_area_window))
echo_area_window = sf->minibuffer_window;
+ /* Don't allow other frames to refer to a deleted frame in their
+ 'environment parameter. */
+ {
+ Lisp_Object tail, frame1;
+ Lisp_Object env = get_frame_param (XFRAME (frame), Qenvironment);
+ FOR_EACH_FRAME (tail, frame1)
+ {
+ if (EQ (frame, frame1) || !FRAME_LIVE_P (XFRAME (frame1)))
+ continue;
+ if (EQ (frame, get_frame_param (XFRAME (frame1), Qenvironment)))
+ {
+ store_frame_param (XFRAME (frame1), Qenvironment, env);
+ if (!FRAMEP (env))
+ env = frame1;
+ }
+ }
+ }
+
/* Clear any X selections for this frame. */
#ifdef HAVE_X_WINDOWS
if (FRAME_X_P (f))
@@ -2577,6 +2596,43 @@ enabled such bindings for that variable with `make-variable-frame-local'. */)
return unbind_to (count, Qnil);
}
+
+DEFUN ("frame-with-environment", Fframe_with_environment, Sframe_with_environment, 0, 1, 0,
+ doc: /* Return the frame that has the environment variable list for FRAME.
+
+The frame-local environment variable list is normally shared between
+frames that were created in the same Emacsclient session. The
+environment list is stored in a single frame's 'environment parameter;
+the other frames' 'environment parameter is set to this frame. This
+function follows to chain of 'environment references to reach the
+frame that stores the actual local environment list, and returns that
+frame. */)
+ (frame)
+ Lisp_Object frame;
+{
+ Lisp_Object hare, tortoise;
+
+ if (NILP (frame))
+ frame = selected_frame;
+ CHECK_FRAME (frame);
+
+ hare = tortoise = get_frame_param (XFRAME (frame), Qenvironment);
+ while (!NILP (hare) && FRAMEP (hare))
+ {
+ frame = hare;
+ hare = get_frame_param (XFRAME (hare), Qenvironment);
+ if (NILP (hare) || !FRAMEP (hare))
+ break;
+ frame = hare;
+ hare = get_frame_param (XFRAME (hare), Qenvironment);
+ tortoise = get_frame_param (XFRAME (tortoise), Qenvironment);
+ if (EQ (hare, tortoise))
+ error ("Cyclic frame-local environment indirection");
+ }
+
+ return frame;
+}
+
DEFUN ("frame-char-height", Fframe_char_height, Sframe_char_height,
0, 1, 0,
@@ -4232,6 +4288,8 @@ syms_of_frame ()
staticpro (&Qtty_type);
Qwindow_system = intern ("window-system");
staticpro (&Qwindow_system);
+ Qenvironment = intern ("environment");
+ staticpro (&Qenvironment);
Qface_set_after_frame_default = intern ("face-set-after-frame-default");
staticpro (&Qface_set_after_frame_default);
@@ -4416,6 +4474,7 @@ This variable is local to the current terminal and cannot be buffer-local. */);
defsubr (&Sframe_parameters);
defsubr (&Sframe_parameter);
defsubr (&Smodify_frame_parameters);
+ defsubr (&Sframe_with_environment);
defsubr (&Sframe_char_height);
defsubr (&Sframe_char_width);
defsubr (&Sframe_pixel_height);