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: patch for optional inhibit of delete-other-windows(IDE feature) Date: Sat, 26 Apr 2008 00:35:15 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1209163173 4253 80.91.229.12 (25 Apr 2008 22:39:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Apr 2008 22:39:33 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 26 00:40:08 2008 connect(): Connection refused 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 1JpWaO-0006Np-4N for ged-emacs-devel@m.gmane.org; Sat, 26 Apr 2008 00:40:08 +0200 Original-Received: from localhost ([127.0.0.1]:57324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JpWZi-0006Xm-31 for ged-emacs-devel@m.gmane.org; Fri, 25 Apr 2008 18:39:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JpWZc-0006VL-BM for emacs-devel@gnu.org; Fri, 25 Apr 2008 18:39:20 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JpWZa-0006T1-UA for emacs-devel@gnu.org; Fri, 25 Apr 2008 18:39:20 -0400 Original-Received: from [199.232.76.173] (port=39166 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JpWZa-0006Sd-Lu for emacs-devel@gnu.org; Fri, 25 Apr 2008 18:39:18 -0400 Original-Received: from iwfs.imcode.com ([82.115.149.64] 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 1JpWZa-0003Ji-6E for emacs-devel@gnu.org; Fri, 25 Apr 2008 18:39:18 -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 m3PMdCx3010661 for ; Sat, 26 Apr 2008 00:39:13 +0200 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:95955 Archived-At: As discussed in the IDE threads, it would be desirable to be able to optionally change certain window operations. This patch makes it possible to disable delete-other-windows for a window. Its only lightly tested, and I offer it here mostly to discuss the interface. To test: - make several windows - (set-window-operation-behaviour-flags (window-at 0 0) '(delete-other-windows t)) The topmost window now wont go away even if you do c-x 1 in the other windows. If the windows plist window-operation-behaviour-flags delete-other-windows is t, the window is not electable for deletion when delete-other-windows is run. I chose this interface mostly for ease of implementation, but I think its ok in other regards as well. Next task is to do the same for other-window. === modified file 'src/window.c' --- src/window.c 2008-04-03 02:15:43 +0000 +++ src/window.c 2008-04-25 22:10:09 +0000 @@ -55,6 +55,7 @@ Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; Lisp_Object Qscroll_up, Qscroll_down; +Lisp_Object Qdelete_other_windows; Lisp_Object Qwindow_size_fixed; extern Lisp_Object Qleft_margin, Qright_margin; @@ -275,6 +276,7 @@ p->frame = Qnil; p->display_table = Qnil; p->dedicated = Qnil; + p->window_operation_behaviour_flags = Qnil; p->pseudo_window_p = 0; bzero (&p->cursor, sizeof (p->cursor)); bzero (&p->last_cursor, sizeof (p->last_cursor)); @@ -1325,6 +1327,32 @@ return w->dedicated; } +DEFUN ("window-operation-behaviour-flags", Fwindow_operation_behaviour_flags, Swindow_operation_behaviour_flags, + 1, 1, 0, + doc: /* Return WINDOW's window_operation_behaviour_flags. + returns nil or a plist where keys are + window operations, values flags that might modify the operation behaviour'. */) + (window) + Lisp_Object window; +{ + return decode_window (window)->window_operation_behaviour_flags; +} + + +DEFUN ("set-window-operation-behaviour-flags", Fset_window_operation_behaviour_flags, + Sset_window_operation_behaviour_flags, 2, 2, 0, + doc: /* set window operation flags */) + (window, arg) + Lisp_Object window, arg; +{ + register struct window *w = decode_window (window); + + w->window_operation_behaviour_flags = arg; + + return w->window_operation_behaviour_flags; +} + + DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, 0, 1, 0, doc: /* Return the display-table that WINDOW is using. @@ -2209,7 +2237,10 @@ break; case DELETE_OTHER_WINDOWS: - if (!EQ (window, obj)) + // + if ((!EQ (window, obj)) && //obj is not the current window + //current window doesnt have delete_other_windows disabled (t inhibits) + (NILP(Fplist_get (w->window_operation_behaviour_flags, Qdelete_other_windows)))) Fdelete_window (window); break; @@ -7398,6 +7429,10 @@ void syms_of_window () { + + Qdelete_other_windows = intern ("delete-other-windows"); + staticpro (&Qdelete_other_windows); + Qscroll_up = intern ("scroll-up"); staticpro (&Qscroll_up); @@ -7714,6 +7749,9 @@ defsubr (&Sset_window_vscroll); defsubr (&Scompare_window_configurations); defsubr (&Swindow_list); + defsubr (&Swindow_operation_behaviour_flags); + defsubr (&Sset_window_operation_behaviour_flags); + } void === modified file 'src/window.h' --- src/window.h 2008-01-29 02:05:10 +0000 +++ src/window.h 2008-04-25 15:53:53 +0000 @@ -229,6 +229,9 @@ enlarged. */ Lisp_Object orig_total_lines, orig_top_line; + /* a plist with flags that modifies behaviour of certain window operations*/ + Lisp_Object window_operation_behaviour_flags; + /* 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