From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joakim@verona.se Newsgroups: gmane.emacs.devel Subject: Re: Adding parameters to windows Date: Wed, 04 Jun 2008 13:01:54 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1212577693 10549 80.91.229.12 (4 Jun 2008 11:08:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 4 Jun 2008 11:08:13 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 04 13:08:55 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K3qrJ-0004Hy-FZ for ged-emacs-devel@m.gmane.org; Wed, 04 Jun 2008 13:08:49 +0200 Original-Received: from localhost ([127.0.0.1]:38955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K3qqX-00070L-1v for ged-emacs-devel@m.gmane.org; Wed, 04 Jun 2008 07:08:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K3qpJ-00066h-Mc for emacs-devel@gnu.org; Wed, 04 Jun 2008 07:06:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K3qpI-00066E-OO for emacs-devel@gnu.org; Wed, 04 Jun 2008 07:06:44 -0400 Original-Received: from [199.232.76.173] (port=47946 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K3qpI-000669-Ib for emacs-devel@gnu.org; Wed, 04 Jun 2008 07:06:44 -0400 Original-Received: from iwfs.imcode.com ([82.115.149.64]:35427 helo=gate.verona.se) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K3qpI-0002Jg-4K for emacs-devel@gnu.org; Wed, 04 Jun 2008 07:06:44 -0400 Original-Received: from chopper (IDENT:1005@localhost [127.0.0.1]) by gate.verona.se (8.13.4/8.11.4) with ESMTP id m54B6eeV026512; Wed, 4 Jun 2008 13:06:41 +0200 In-Reply-To: (Stefan Monnier's message of "Fri, 23 May 2008 15:47:17 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:98375 Archived-At: --=-=-= Stefan Monnier writes: > 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. I've tried to adress your concerns in the attached patch. A reworked ChangeLog entry: 2008-06-03 Joakim Verona * window.h (window_parameters): Declare * window.c: (Fwindow_parameters): New defun. (Fwindow_parameter): New defun. (Fset_window_parameter): New defun. (syms_of_window): Defsubr the new defuns. (make_window): initialize window_parameters to nil --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=winprop.diff === modified file 'src/window.c' --- src/window.c 2008-06-02 12:09:12 +0000 +++ src/window.c 2008-06-03 14:08:13 +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)); @@ -1324,6 +1325,51 @@ return w->dedicated; } +DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, + 1, 1, 0, + doc: /* Return the parameters-alist of window WINDOW. +It is a list of elements of the form (PARM . VALUE), where PARM is a symbol. +The meaningful PARMs 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 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); + 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 +7733,10 @@ defsubr (&Sset_window_vscroll); defsubr (&Scompare_window_configurations); defsubr (&Swindow_list); + defsubr (&Swindow_parameters); + defsubr (&Swindow_parameter); + defsubr (&Sset_window_parameter); + } void === modified file 'src/window.h' --- src/window.h 2008-05-15 09:24:57 +0000 +++ src/window.h 2008-06-03 13:35:47 +0000 @@ -228,6 +228,10 @@ enlarged. */ Lisp_Object orig_total_lines, orig_top_line; + /* an alist with parameteres that modifies behaviour of certain window operations. + */ + 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 --=-=-=--