]> git.eshelyaron.com Git - emacs.git/commitdiff
Implement `emacsclient --create-tab'.
authorJuri Linkov <juri@jurta.org>
Wed, 21 Apr 2010 01:36:18 +0000 (04:36 +0300)
committerJuri Linkov <juri@jurta.org>
Wed, 21 Apr 2010 01:36:18 +0000 (04:36 +0300)
README.TABS
lib-src/emacsclient.c
lisp/server.el

index a61143999a9fe80aa128c7382e87ee9423d115a8..fe3f74aabe076003a62edf5979c54180a31a4b57 100644 (file)
@@ -43,4 +43,8 @@ Tab related functions:
 
 will open each file in a new tab.
 
+  emacsclient --create-tab
+
+creates a new tab on the current Emacs frame.
+
 \f
index 1e7ec7d9678b1b4f166184cfa9bffd9c5f207265..8135e9c3c00ce2c60d109bad4fb0863c7f44aa37 100644 (file)
@@ -135,6 +135,9 @@ int eval = 0;
 /* Nonzero means don't open a new frame.  Inverse of --create-frame.  */
 int current_frame = 1;
 
+/* Nonzero means open a new Emacs tab. */
+int create_tab = 0;
+
 /* The display on which Emacs should work.  --display.  */
 char *display = NULL;
 
@@ -165,6 +168,7 @@ struct option longopts[] =
   { "tty",     no_argument,       NULL, 't' },
   { "nw",      no_argument,       NULL, 't' },
   { "create-frame", no_argument,   NULL, 'c' },
+  { "create-tab", no_argument,     NULL, 'x' },
   { "alternate-editor", required_argument, NULL, 'a' },
 #ifndef NO_SOCKETS_IN_FILE_SYSTEM
   { "socket-name",     required_argument, NULL, 's' },
@@ -583,6 +587,10 @@ decode_options (argc, argv)
           current_frame = 0;
           break;
 
+        case 'x':
+          create_tab = 1;
+          break;
+
        case 'H':
          print_help_and_exit ();
          break;
@@ -653,6 +661,7 @@ The following OPTIONS are accepted:\n\
 -nw, -t, --tty                 Open a new Emacs frame on the current terminal\n\
 -c, --create-frame     Create a new frame instead of trying to\n\
                        use the current Emacs frame\n\
+-t, --create-tab       Create a new tab on the current Emacs frame\n\
 -e, --eval             Evaluate the FILE arguments as ELisp expressions\n\
 -n, --no-wait          Don't wait for the server to return\n\
 -d DISPLAY, --display=DISPLAY\n\
@@ -1613,6 +1622,9 @@ main (argc, argv)
   if (current_frame)
     send_to_emacs (emacs_socket, "-current-frame ");
 
+  if (create_tab)
+    send_to_emacs (emacs_socket, "-create-tab ");
+
   if (display)
     {
       send_to_emacs (emacs_socket, "-display ");
index d36b99cc5b6c4546e916e517acb9520ab9ad376b..fd6d5fe9a698546e1774eb415973cab6d5a109ef 100644 (file)
@@ -803,6 +803,9 @@ The following commands are accepted by the server:
 `-current-frame'
   Forbid the creation of new frames.
 
+`-create-tab'
+  Create a new tab on the current Emacs frame.
+
 `-nowait'
   Request that the next frame created should not be
   associated with this client.
@@ -904,6 +907,7 @@ The following commands are accepted by the client:
                commands
                dir
                use-current-frame
+               create-tab
                tty-name       ;nil, `window-system', or the tty name.
                tty-type             ;string.
                files
@@ -926,6 +930,9 @@ The following commands are accepted by the client:
                 ;; -current-frame:  Don't create frames.
                 ((equal "-current-frame" arg) (setq use-current-frame t))
 
+                ;; -create-tab:  Create a new tab.
+                ((equal "-create-tab" arg) (setq create-tab t))
+
                 ;; -display DISPLAY:
                 ;; Open X frames on the given display instead of the default.
                 ((and (equal "-display" arg) command-line-args-left)
@@ -1041,6 +1048,9 @@ The following commands are accepted by the client:
                   (tty-name
                    (server-create-tty-frame tty-name tty-type proc))))
 
+           (when create-tab
+             (select-tab (make-tab)))
+
             (process-put
              proc 'continuation
              (lexical-let ((proc proc)