[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding parameters to windows
From: |
Stefan Monnier |
Subject: |
Re: Adding parameters to windows |
Date: |
Fri, 23 May 2008 15:47:17 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Your patch needs a few tweaks, e.g. to adjust it to the coding
conventions:
- The docstring of window-parameters is poor.
E.g. the first line doesn't say anything. The second line is indented
in the source, which looks bad when you do C-h f window-parameters.
nil is an aliast as well, so there's no need to mention it explicitly.
- I'd prefer to have `window-parameter' rather than `window-parameters'.
- The docstring of set-window-parameter needs to start with a capital
letter and end with a "." and should mention its arguments.
Feel free to plagiarize set-frame-parameter.
- The comment for window_parameters refers to `pin' and `group'.
- See http://www.gnu.org/prep/standards/standards.html#Change-Logs for
the format to use in ChangeLogs:
- put together changes to a file.
- your changelog seems to say you've changed `DEFUN'.
- there's a missing space after colon in "(window:Added".
- And the "Added" should be "Add" of course.
Thank you very much for your help. BTW, could you point me to your
latest version of the pin&group patch?
Stefan
> === modified file 'src/window.c'
> --- src/window.c 2008-04-03 02:15:43 +0000
> +++ src/window.c 2008-04-29 09:40:34 +0000
> @@ -275,6 +278,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));
> @@ -1325,6 +1329,38 @@
> return w->dedicated;
> }
> +DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
> + 1, 1, 0,
> + doc: /* Return WINDOW's window-parameters.
> + returns nil or an alist where values affect window
> operations. */)
> + (window)
> + Lisp_Object window;
> +{
> + return decode_window (window)->window_parameters;
> +}
> +
> +
> +DEFUN ("set-window-parameter", Fset_window_parameter,
> + Sset_window_parameter, 3, 3, 0,
> + doc: /* set window parameters */)
> + (window, prop, val)
> + Lisp_Object window, prop, val;
> +{
> + register struct window *w = decode_window (window);
> + register Lisp_Object old_alist_elt;
> +
> + old_alist_elt = Fassq (prop, w->window_parameters);
> + if (EQ (old_alist_elt, Qnil))
> + w->window_parameters = Fcons (Fcons (prop, val), w->window_parameters);
> + else
> + Fsetcdr (old_alist_elt, val);
> +
> + //Fplist_put(w->window_parameters,key,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.
> @@ -7714,6 +7771,9 @@
> defsubr (&Sset_window_vscroll);
> defsubr (&Scompare_window_configurations);
> defsubr (&Swindow_list);
> + defsubr (&Swindow_parameters);
> + defsubr (&Sset_window_parameter);
> +
> }
> void
> === modified file 'src/window.h'
> --- src/window.h 2008-01-29 02:05:10 +0000
> +++ src/window.h 2008-04-29 10:04:07 +0000
> @@ -229,6 +229,11 @@
> enlarged. */
> Lisp_Object orig_total_lines, orig_top_line;
> + /* an alist with flags that modifies behaviour of certain window
> operations.
> + currently "pin" and "group" are special
> + */
> + Lisp_Object window_parameters;
> +
> /* No Lisp data may follow below this point without changing
> mark_object in alloc.c. The member current_matrix must be the
> first non-Lisp member. */
> --
> Joakim Verona