diff options
author | Andreas Rottmann <a.rottmann@gmx.at> | 2011-06-25 11:05:48 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2011-06-25 11:05:48 -0700 |
commit | 18a4ce5ea1b06bd077e87fd1ac8966b19b10ee8c (patch) | |
tree | 3a84ffb4fba8030f72c58f07dbbabe1d3eb67a36 | |
parent | 919bbce05b7757431247a771efd3943eab251eb2 (diff) |
Allow emacsclient to set parameters of new graphical frames (bug#5864)
* lib-src/emacsclient.c (longopts, decode_options, main): Add frame-parameters.
* lisp/server.el (server-create-window-system-frame): Add parameters arg.
(server-process-filter): Doc fix. Handle frame-parameters.
* doc/emacs/misc.texi (emacsclient Options): Mention --frame-parameters.
* doc/man/emacsclient.1: Mention --frame-parameters.
* etc/NEWS: Mention this.
-rw-r--r-- | doc/emacs/ChangeLog | 4 | ||||
-rw-r--r-- | doc/emacs/misc.texi | 5 | ||||
-rw-r--r-- | doc/man/ChangeLog | 4 | ||||
-rw-r--r-- | doc/man/emacsclient.1 | 3 | ||||
-rw-r--r-- | etc/NEWS | 4 | ||||
-rw-r--r-- | lib-src/ChangeLog | 4 | ||||
-rw-r--r-- | lib-src/emacsclient.c | 16 | ||||
-rw-r--r-- | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/server.el | 20 |
9 files changed, 62 insertions, 3 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 8853eb099d..ab0abcd43d 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,7 @@ +2011-06-25 Andreas Rottmann <a.rottmann@gmx.at> + + * misc.texi (emacsclient Options): Mention --frame-parameters. + 2011-06-09 Glenn Morris <rgm@gnu.org> * custom.texi (Specifying File Variables): diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 290e5dc53b..f83ac38469 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1623,6 +1623,11 @@ text-only terminal frame (@pxref{Frames}). If you omit a filename argument while supplying the @samp{-c} option, the new frame displays the @samp{*scratch*} buffer (@pxref{Buffers}). +@item -F +@itemx --frame-parameters=@var{alist} +Set the parameters for a newly-created graphical frame +(@pxref{Frame Parameters}). + @item -d @var{display} @itemx --display=@var{display} Tell Emacs to open the given files on the X display @var{display} diff --git a/doc/man/ChangeLog b/doc/man/ChangeLog index 06ff578200..88f70e410c 100644 --- a/doc/man/ChangeLog +++ b/doc/man/ChangeLog @@ -1,3 +1,7 @@ +2011-06-25 Andreas Rottmann <a.rottmann@gmx.at> + + * emacsclient.1: Mention --frame-parameters. + 2011-03-07 Chong Yidong <cyd@stupidchicken.com> * Version 23.3 released. diff --git a/doc/man/emacsclient.1 b/doc/man/emacsclient.1 index cae4d76634..4843053666 100644 --- a/doc/man/emacsclient.1 +++ b/doc/man/emacsclient.1 @@ -58,6 +58,9 @@ daemon mode and emacsclient will try to connect to it. .B -c, \-\-create-frame create a new frame instead of trying to use the current Emacs frame .TP +.B \-F, \-\-frame-parameters=ALIST +set the parameters of a newly-created frame. +.TP .B \-d, \-\-display=DISPLAY tell the server to display the files on the given display. .TP @@ -84,6 +84,10 @@ client frame in parent X window ID, via XEmbed. This works like the +++ *** New emacsclient argument -q/--quiet suppresses some status messages. ++++ +*** New emacsclient argument --frame-parameters can be used to set the +frame parameters of a newly-created graphical frame. + *** If emacsclient shuts down as a result of Emacs signalling an error, its exit status is 1. diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index ec123e8503..99ec98d62b 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,7 @@ +2011-06-25 Andreas Rottmann <a.rottmann@gmx.at> + + * emacsclient.c (longopts, decode_options, main): Add frame-parameters. + 2011-06-10 Paul Eggert <eggert@cs.ucla.edu> * movemail.c: Fix race condition and related bugs (Bug#8836). diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index c334fb6a19..56535a0299 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -160,6 +160,10 @@ const char *server_file = NULL; /* PID of the Emacs server process. */ int emacs_pid = 0; +/* If non-NULL, a string that should form a frame parameter alist to + be used for the new frame */ +const char *frame_parameters = NULL; + static void print_help_and_exit (void) NO_RETURN; static void fail (void) NO_RETURN; @@ -175,6 +179,7 @@ struct option longopts[] = { "nw", no_argument, NULL, 't' }, { "create-frame", no_argument, NULL, 'c' }, { "alternate-editor", required_argument, NULL, 'a' }, + { "frame-parameters", required_argument, NULL, 'F' }, #ifndef NO_SOCKETS_IN_FILE_SYSTEM { "socket-name", required_argument, NULL, 's' }, #endif @@ -599,6 +604,10 @@ decode_options (int argc, char **argv) print_help_and_exit (); break; + case 'F': + frame_parameters = optarg; + break; + default: message (TRUE, "Try `%s --help' for more information\n", progname); exit (EXIT_FAILURE); @@ -1630,6 +1639,13 @@ main (int argc, char **argv) send_to_emacs (emacs_socket, " "); } + if (frame_parameters && !current_frame) + { + send_to_emacs (emacs_socket, "-frame-parameters "); + quote_argument (emacs_socket, frame_parameters); + send_to_emacs (emacs_socket, " "); + } + /* If using the current frame, send tty information to Emacs anyway. In daemon mode, Emacs may need to occupy this tty if no other frame is available. */ diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4fec617954..bccbe9340b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-06-25 Andreas Rottmann <a.rottmann@gmx.at> + + * server.el (server-create-window-system-frame): Add parameters arg. + (server-process-filter): Doc fix. Handle frame-parameters. + 2011-06-25 Juanma Barranquero <lekktu@gmail.com> Fix bug#8730, bug#8781. diff --git a/lisp/server.el b/lisp/server.el index 04d35695c5..42da7a210c 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -736,7 +736,8 @@ Server mode runs a process that accepts commands from the frame)) -(defun server-create-window-system-frame (display nowait proc parent-id) +(defun server-create-window-system-frame (display nowait proc parent-id + &optional parameters) (add-to-list 'frame-inherited-parameters 'client) (if (not (fboundp 'make-frame-on-display)) (progn @@ -751,7 +752,8 @@ Server mode runs a process that accepts commands from the ;; killing emacs on that frame. (let* ((params `((client . ,(if nowait 'nowait proc)) ;; This is a leftover, see above. - (environment . ,(process-get proc 'env)))) + (environment . ,(process-get proc 'env)) + ,@parameters)) (display (or display (frame-parameter nil 'display) (getenv "DISPLAY") @@ -832,6 +834,9 @@ The following commands are accepted by the server: `-current-frame' Forbid the creation of new frames. +`-frame-parameters ALIST' + Set the parameters of the created frame. + `-nowait' Request that the next frame created should not be associated with this client. @@ -940,6 +945,7 @@ The following commands are accepted by the client: commands dir use-current-frame + frame-parameters ;parameters for newly created frame tty-name ; nil, `window-system', or the tty name. tty-type ; string. files @@ -960,6 +966,13 @@ The following commands are accepted by the client: ;; -current-frame: Don't create frames. (`"-current-frame" (setq use-current-frame t)) + ;; -frame-parameters: Set frame parameters + (`"-frame-parameters" + (let ((alist (pop args-left))) + (if coding-system + (setq alist (decode-coding-string alist coding-system))) + (setq frame-parameters (car (read-from-string alist))))) + ;; -display DISPLAY: ;; Open X frames on the given display instead of the default. (`"-display" @@ -1075,7 +1088,8 @@ The following commands are accepted by the client: (if display (server-select-display display))) ((eq tty-name 'window-system) (server-create-window-system-frame display nowait proc - parent-id)) + parent-id + frame-parameters)) ;; When resuming on a tty, tty-name is nil. (tty-name (server-create-tty-frame tty-name tty-type proc)))) |