]> git.eshelyaron.com Git - emacs.git/commitdiff
Ongoing...
authorJan Djärv <jan.h.d@swipnet.se>
Tue, 23 Mar 2010 09:33:13 +0000 (10:33 +0100)
committerJan Djärv <jan.h.d@swipnet.se>
Tue, 23 Mar 2010 09:33:13 +0000 (10:33 +0100)
lisp/native-tabs.el
src/gtkutil.c
src/window.c

index 25a59fffeb606b1caa9d18a3b8dcadf7a67085cc..443931f38600f7824809392f52cbea34b168a6ec 100644 (file)
@@ -1,4 +1,39 @@
-;; -*- lisp-interaction-mode -*-
+;;; native-tabs.el --- Support tabs in frames
+
+;; Copyright (C) 2010 Free Software Foundation, Inc.
+
+;; Author: Jan Djärv <jan.h.d@swipnet.se>
+;; Maintainer: FSF
+;; Keywords: tabs
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This file provides the lisp part of Gtk+ native tabs.
+
+;;; Code:
+
+;;; Customizable variables
+
+(declare-function tab-new "xfns.c" ())
+(declare-function tab-delete "xfns.c" ())
+(declare-function tab-delete-other "xfns.c" ())
+(declare-function tab-next "xfns.c" ())
+(declare-function tab-previous "xfns.c" ())
 
 (defun handle-tab-event (event)
   "Handle tab-changed-event to change tabs on the frame in EVENT."
                                        (current-window-configuration))))))
     (set-frame-parameter frame 'tab-config configs)
     (if new-config
-       (set-window-configuration (cdr new-config)))))
+       (set-window-configuration (cdr new-config))
+      (delete-other-windows))))
+
+(defun find-file-new-tab (filename &optional wildcards)
+  "Edit file FILENAME, in a new tab.
+
+Like \\[find-file] (which see), but creates a new tab.
+
+Interactively, the default if you just type RET is the current directory,
+but the visited file name is available through the minibuffer history:
+type M-n to pull it into the minibuffer.
+
+Interactively, or if WILDCARDS is non-nil in a call from Lisp,
+expand wildcards (if any) and visit multiple files."
+  (interactive
+   (find-file-read-args "Find file in new tab: "
+                        (confirm-nonexistent-file-or-buffer)))
+  (let ((value (find-file-noselect filename nil nil wildcards)))
+    (tab-new)
+    (delete-other-windows)
+    (if (listp value)
+       (progn
+         (setq value (nreverse value))
+         (cons (switch-to-buffer (car value))
+               (mapcar 'switch-to-buffer (cdr value))))
+      (switch-to-buffer value))))
 
 (if (featurep 'tabs)
     (progn
       (define-key special-event-map [tab-changed-event]
        'handle-tab-event)
+      (global-set-key "\C-x7\C-f" 'find-file-new-tab)
       (global-set-key "\C-x70" 'tab-delete)
       (global-set-key "\C-x71" 'tab-delete-other)
       (global-set-key "\C-x72" 'tab-new)
+      (global-set-key "\C-x7f" 'find-file-new-tab)
+      (global-set-key "\C-x7o" 'tab-next)
       (global-set-key "\C-x7n" 'tab-next)
       (global-set-key "\C-x7p" 'tab-previous)))
 
index e2d6292f06b855d8228fb5e80b8943db77e33fa9..956826be336fcc9f77b09be81c22e1bc74a00e4c 100644 (file)
@@ -627,7 +627,7 @@ xg_frame_resized (f, pixelwidth, pixelheight)
       FRAME_PIXEL_HEIGHT (f) = pixelheight;
 
       xg_clear_under_internal_border (f);
-      change_frame_size (f, rows, columns, 0, 1, 0);
+      change_frame_size (f, rows, columns, 0, 0, 1);
       SET_FRAME_GARBAGED (f);
       cancel_mouse_face (f);
     }
@@ -780,21 +780,19 @@ xg_check_show_tabs (FRAME_PTR f,
         FRAME_TABS_HEIGHT (f) = 0;
       x_wm_set_size_hint (f, 0, 0);
 
-      /* Try to minimize resize, when adding the tabs, subtract some text
-         lines, when removing tabs, add text lines.  Some resize will be
-         made when tab height isn't a multiple of the line height.  */
+      /* Try to minimize resize, when adding/removing the tabs, add some text
+         lines.  Some resize will be made when tab height isn't a multiple of
+         the line height.  */
       
       if (oldheight > 0 && FRAME_LINE_HEIGHT (f) > 0)
         {
           row_add = oldheight/FRAME_LINE_HEIGHT (f);
           if (row_add * FRAME_LINE_HEIGHT (f) != oldheight)
-            ++row_add;
+            --row_add;
         }
       else if (FRAME_TABS_HEIGHT (f) > 0 && FRAME_LINE_HEIGHT (f) > 0)
         {
           row_add = -(FRAME_TABS_HEIGHT (f)/FRAME_LINE_HEIGHT (f));
-          if (row_add * FRAME_LINE_HEIGHT (f) != FRAME_TABS_HEIGHT (f))
-              --row_add;
         }
 
       xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f) + row_add);
index 64a97437939b927a963b0596a680edd23d17fd8d..797cde4ca735ae94ac1d9292a491e8a0d6623124 100644 (file)
@@ -5978,6 +5978,35 @@ DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_config
   return XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame;
 }
 
+DEFUN ("change-window-configuration-frame", Fchange_window_configuration_frame,
+       Schange_window_configuration_frame, 2, 2, 0,
+       doc: /* Change the frame that CONFIG, a window-configuration object, is about.  */)
+     (config, frame)
+     Lisp_Object config, frame;
+{
+  register struct save_window_data *data;
+  struct Lisp_Vector *saved_windows;
+  Lisp_Object oldframe;
+  int k;
+  FRAME_PTR f;
+
+  CHECK_WINDOW_CONFIGURATION (config);
+
+  data = (struct save_window_data *) XVECTOR (config);
+  saved_windows = XVECTOR (data->saved_windows);
+  oldframe = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame;
+  f = XFRAME (oldframe);
+  FRAME_TERMINAL (f)->condemn_scroll_bars_hook (f);
+  FRAME_TERMINAL (f)->judge_scroll_bars_hook (f);
+  
+  for (k = 0; k < saved_windows->size; k++)
+    {
+      struct window *w = XWINDOW (SAVED_WINDOW_N (saved_windows, k)->window);
+      w->vertical_scroll_bar = Qnil;
+      w->frame = frame;
+    }
+}
+
 DEFUN ("set-window-configuration", Fset_window_configuration,
        Sset_window_configuration, 1, 1, 0,
        doc: /* Set the configuration of windows and buffers as specified by CONFIGURATION.
@@ -7346,6 +7375,7 @@ frame to be redrawn only if it is a tty frame.  */);
   defsubr (&Smove_to_window_line);
   defsubr (&Swindow_configuration_p);
   defsubr (&Swindow_configuration_frame);
+  defsubr (&Schange_window_configuration_frame);
   defsubr (&Sset_window_configuration);
   defsubr (&Scurrent_window_configuration);
   defsubr (&Ssave_window_excursion);