all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* patch for optional inhibit of delete-other-windows(IDE feature)
@ 2008-04-25 22:35 joakim
  2008-04-26  1:25 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 61+ messages in thread
From: joakim @ 2008-04-25 22:35 UTC (permalink / raw)
  To: emacs-devel

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




^ permalink raw reply	[flat|nested] 61+ messages in thread

end of thread, other threads:[~2008-05-08 14:03 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <m37iela60f.fsf@verona.se>
     [not found] ` <84D8FEFE8D23E94E9C2A6F0C58EE07E3429A02@mucmail3.sdm.de>
2008-04-28 11:14   ` patch for optional inhibit of delete-other-windows(IDE feature) joakim
2008-04-28 11:50     ` klaus.berndl
2008-04-28 15:34       ` martin rudalics
2008-04-28 15:55         ` klaus.berndl
2008-04-28 15:58           ` klaus.berndl
2008-04-28 22:01           ` martin rudalics
2008-04-29  8:46             ` klaus.berndl
2008-04-29 13:30               ` martin rudalics
2008-04-29 14:27                 ` klaus.berndl
2008-04-29 15:47                   ` martin rudalics
2008-04-29 16:35             ` Richard M Stallman
2008-04-29 18:04               ` Re[2]: " Eric M. Ludlam
2008-04-29 18:27                 ` klaus.berndl
2008-04-29 19:04                   ` Eric M. Ludlam
2008-04-29 20:35                   ` Stefan Monnier
2008-04-29 21:28                     ` martin rudalics
2008-04-29 21:27                 ` martin rudalics
2008-04-29 23:08                   ` Eric M. Ludlam
2008-04-30  5:37                     ` martin rudalics
2008-04-30 11:55                       ` Re[2]: " Eric M. Ludlam
2008-04-30 13:43                         ` martin rudalics
2008-04-30 15:29                           ` Eric M. Ludlam
2008-04-30 15:38                         ` Robert J. Chassell
2008-04-29 21:27               ` martin rudalics
2008-04-30  3:26                 ` Stefan Monnier
2008-04-29 10:59       ` [ECB-list] patch for optional inhibit of Henry S. Thompson
2008-04-28 19:45     ` patch for optional inhibit of delete-other-windows(IDE feature) Richard M Stallman
2008-04-25 22:35 joakim
2008-04-26  1:25 ` Stefan Monnier
2008-04-26  6:56   ` joakim
2008-04-28  1:20     ` Stefan Monnier
2008-04-28 11:26       ` joakim
2008-04-28 11:41         ` Miles Bader
2008-04-28 11:55           ` joakim
2008-04-28 14:27         ` Stefan Monnier
2008-04-28 14:38           ` joakim
2008-04-28 15:04             ` klaus.berndl
2008-04-28 12:56     ` Jason Rumney
2008-04-30  8:09       ` klaus.berndl
2008-05-08 10:06   ` joakim
2008-05-08 14:03     ` Stefan Monnier
2008-04-26 14:49 ` Richard M Stallman
2008-04-28  1:21   ` Stefan Monnier
2008-04-29 11:05 ` joakim
2008-04-29 12:13   ` klaus.berndl
2008-04-29 13:31     ` martin rudalics
2008-04-29 13:47       ` klaus.berndl
2008-04-29 15:47         ` martin rudalics
2008-04-29 18:29           ` klaus.berndl
2008-04-29 20:31       ` Stefan Monnier
2008-04-29 23:16       ` Richard M Stallman
2008-04-29 23:16   ` Richard M Stallman
2008-04-30  5:57     ` joakim
2008-04-30  7:24       ` Stefan Monnier
2008-04-30  8:15         ` joakim
2008-04-30  9:34           ` Stefan Monnier
2008-04-30 10:47             ` klaus.berndl
2008-04-30 22:01           ` Richard M Stallman
2008-04-30 22:01       ` Richard M Stallman
2008-05-01  2:57         ` Miles Bader
2008-05-01 23:44           ` Richard M Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.