From: Juri Linkov Date: Wed, 21 Apr 2010 01:36:18 +0000 (+0300) Subject: Implement `emacsclient --create-tab'. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dedc6e3911bb081a8df6ba7e0e9ce218ee144049;p=emacs.git Implement `emacsclient --create-tab'. --- diff --git a/README.TABS b/README.TABS index a61143999a9..fe3f74aabe0 100644 --- a/README.TABS +++ b/README.TABS @@ -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. + diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 1e7ec7d9678..8135e9c3c00 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -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 "); diff --git a/lisp/server.el b/lisp/server.el index d36b99cc5b6..fd6d5fe9a69 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -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)