changeset 95547:f646247886e0

(Fwindow_parameters, Fwindow_parameter, Fset_window_parameter): New defuns. (syms_of_window): Defsubr the new defuns. (make_window): Initialize window_parameters to nil.
author Juanma Barranquero <lekktu@gmail.com>
date Wed, 04 Jun 2008 20:50:27 +0000
parents 760199ff7ae2
children b57bae733df3
files src/window.c
diffstat 1 files changed, 52 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/window.c	Wed Jun 04 16:20:04 2008 +0000
+++ b/src/window.c	Wed Jun 04 20:50:27 2008 +0000
@@ -273,6 +273,7 @@
   p->frame = Qnil;
   p->display_table = Qnil;
   p->dedicated = Qnil;
+  p->window_parameters = Qnil;
   p->pseudo_window_p = 0;
   bzero (&p->cursor, sizeof (p->cursor));
   bzero (&p->last_cursor, sizeof (p->last_cursor));
@@ -1313,7 +1314,7 @@
 If it is dedicated, Emacs will not automatically change
 which buffer appears in it.
 The second argument is the new value for the dedication flag;
-non-nil means yes. */)
+non-nil means yes.  */)
      (window, arg)
      Lisp_Object window, arg;
 {
@@ -1324,6 +1325,52 @@
   return w->dedicated;
 }
 
+DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
+       0, 1, 0,
+       doc: /* Return the parameters-alist of window WINDOW.
+It is a list of elements of the form (PARAMETER . VALUE).
+The meaningful PARAMETERs depend on the kind of window.
+If WINDOW is omitted, return information on the currently selected window.  */)
+     (window)
+     Lisp_Object window;
+{
+  if (NILP (window))
+    window = selected_window;
+  return decode_window (window)->window_parameters;
+}
+
+DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter,
+       2, 2, 0,
+       doc:  /* Return WINDOW's value for parameter PARAMETER.
+If WINDOW is nil, describe the currently selected window.  */)
+     (window, parameter)
+     Lisp_Object window, parameter;
+{
+  if (NILP (window))
+    window = selected_window;
+  return Fassq (parameter, decode_window (window)->window_parameters);
+}
+
+
+DEFUN ("set-window-parameter", Fset_window_parameter,
+       Sset_window_parameter, 3, 3, 0,
+       doc: /* Set window parameter PARAMETER to VALUE on WINDOW.
+Return the parameters-alist of WINDOW.  */)
+     (window, parameter, value)
+     Lisp_Object window, parameter, value;
+{
+  register struct window *w = decode_window (window);
+  Lisp_Object old_alist_elt;
+
+  old_alist_elt = Fassq (parameter, w->window_parameters);
+  if (EQ (old_alist_elt, Qnil))
+    w->window_parameters = Fcons (Fcons (parameter, value), w->window_parameters);
+  else
+    Fsetcdr (old_alist_elt, value);
+  return w->window_parameters;
+}
+
+
 DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table,
        0, 1, 0,
        doc: /* Return the display-table that WINDOW is using.
@@ -7687,6 +7734,10 @@
   defsubr (&Sset_window_vscroll);
   defsubr (&Scompare_window_configurations);
   defsubr (&Swindow_list);
+  defsubr (&Swindow_parameters);
+  defsubr (&Swindow_parameter);
+  defsubr (&Sset_window_parameter);
+
 }
 
 void