diff options
| author | Andreas Rottmann | 2011-06-25 11:05:48 -0700 |
|---|---|---|
| committer | Glenn Morris | 2011-06-25 11:05:48 -0700 |
| commit | 18a4ce5ea1b06bd077e87fd1ac8966b19b10ee8c (patch) | |
| tree | 3a84ffb4fba8030f72c58f07dbbabe1d3eb67a36 | |
| parent | 919bbce05b7757431247a771efd3943eab251eb2 (diff) | |
| download | emacs-18a4ce5ea1b06bd077e87fd1ac8966b19b10ee8c.tar.gz emacs-18a4ce5ea1b06bd077e87fd1ac8966b19b10ee8c.zip | |
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 8853eb099d6..ab0abcd43d3 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2011-06-25 Andreas Rottmann <a.rottmann@gmx.at> | ||
| 2 | |||
| 3 | * misc.texi (emacsclient Options): Mention --frame-parameters. | ||
| 4 | |||
| 1 | 2011-06-09 Glenn Morris <rgm@gnu.org> | 5 | 2011-06-09 Glenn Morris <rgm@gnu.org> |
| 2 | 6 | ||
| 3 | * custom.texi (Specifying File Variables): | 7 | * custom.texi (Specifying File Variables): |
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 290e5dc53bf..f83ac38469a 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 | |||
| 1623 | argument while supplying the @samp{-c} option, the new frame displays | 1623 | argument while supplying the @samp{-c} option, the new frame displays |
| 1624 | the @samp{*scratch*} buffer (@pxref{Buffers}). | 1624 | the @samp{*scratch*} buffer (@pxref{Buffers}). |
| 1625 | 1625 | ||
| 1626 | @item -F | ||
| 1627 | @itemx --frame-parameters=@var{alist} | ||
| 1628 | Set the parameters for a newly-created graphical frame | ||
| 1629 | (@pxref{Frame Parameters}). | ||
| 1630 | |||
| 1626 | @item -d @var{display} | 1631 | @item -d @var{display} |
| 1627 | @itemx --display=@var{display} | 1632 | @itemx --display=@var{display} |
| 1628 | Tell Emacs to open the given files on the X display @var{display} | 1633 | Tell Emacs to open the given files on the X display @var{display} |
diff --git a/doc/man/ChangeLog b/doc/man/ChangeLog index 06ff5782003..88f70e410c8 100644 --- a/doc/man/ChangeLog +++ b/doc/man/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2011-06-25 Andreas Rottmann <a.rottmann@gmx.at> | ||
| 2 | |||
| 3 | * emacsclient.1: Mention --frame-parameters. | ||
| 4 | |||
| 1 | 2011-03-07 Chong Yidong <cyd@stupidchicken.com> | 5 | 2011-03-07 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 6 | ||
| 3 | * Version 23.3 released. | 7 | * Version 23.3 released. |
diff --git a/doc/man/emacsclient.1 b/doc/man/emacsclient.1 index cae4d76634b..4843053666a 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. | |||
| 58 | .B -c, \-\-create-frame | 58 | .B -c, \-\-create-frame |
| 59 | create a new frame instead of trying to use the current Emacs frame | 59 | create a new frame instead of trying to use the current Emacs frame |
| 60 | .TP | 60 | .TP |
| 61 | .B \-F, \-\-frame-parameters=ALIST | ||
| 62 | set the parameters of a newly-created frame. | ||
| 63 | .TP | ||
| 61 | .B \-d, \-\-display=DISPLAY | 64 | .B \-d, \-\-display=DISPLAY |
| 62 | tell the server to display the files on the given display. | 65 | tell the server to display the files on the given display. |
| 63 | .TP | 66 | .TP |
| @@ -84,6 +84,10 @@ client frame in parent X window ID, via XEmbed. This works like the | |||
| 84 | +++ | 84 | +++ |
| 85 | *** New emacsclient argument -q/--quiet suppresses some status messages. | 85 | *** New emacsclient argument -q/--quiet suppresses some status messages. |
| 86 | 86 | ||
| 87 | +++ | ||
| 88 | *** New emacsclient argument --frame-parameters can be used to set the | ||
| 89 | frame parameters of a newly-created graphical frame. | ||
| 90 | |||
| 87 | *** If emacsclient shuts down as a result of Emacs signalling an | 91 | *** If emacsclient shuts down as a result of Emacs signalling an |
| 88 | error, its exit status is 1. | 92 | error, its exit status is 1. |
| 89 | 93 | ||
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index ec123e85036..99ec98d62b0 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2011-06-25 Andreas Rottmann <a.rottmann@gmx.at> | ||
| 2 | |||
| 3 | * emacsclient.c (longopts, decode_options, main): Add frame-parameters. | ||
| 4 | |||
| 1 | 2011-06-10 Paul Eggert <eggert@cs.ucla.edu> | 5 | 2011-06-10 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 6 | ||
| 3 | * movemail.c: Fix race condition and related bugs (Bug#8836). | 7 | * movemail.c: Fix race condition and related bugs (Bug#8836). |
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index c334fb6a196..56535a02990 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -160,6 +160,10 @@ const char *server_file = NULL; | |||
| 160 | /* PID of the Emacs server process. */ | 160 | /* PID of the Emacs server process. */ |
| 161 | int emacs_pid = 0; | 161 | int emacs_pid = 0; |
| 162 | 162 | ||
| 163 | /* If non-NULL, a string that should form a frame parameter alist to | ||
| 164 | be used for the new frame */ | ||
| 165 | const char *frame_parameters = NULL; | ||
| 166 | |||
| 163 | static void print_help_and_exit (void) NO_RETURN; | 167 | static void print_help_and_exit (void) NO_RETURN; |
| 164 | static void fail (void) NO_RETURN; | 168 | static void fail (void) NO_RETURN; |
| 165 | 169 | ||
| @@ -175,6 +179,7 @@ struct option longopts[] = | |||
| 175 | { "nw", no_argument, NULL, 't' }, | 179 | { "nw", no_argument, NULL, 't' }, |
| 176 | { "create-frame", no_argument, NULL, 'c' }, | 180 | { "create-frame", no_argument, NULL, 'c' }, |
| 177 | { "alternate-editor", required_argument, NULL, 'a' }, | 181 | { "alternate-editor", required_argument, NULL, 'a' }, |
| 182 | { "frame-parameters", required_argument, NULL, 'F' }, | ||
| 178 | #ifndef NO_SOCKETS_IN_FILE_SYSTEM | 183 | #ifndef NO_SOCKETS_IN_FILE_SYSTEM |
| 179 | { "socket-name", required_argument, NULL, 's' }, | 184 | { "socket-name", required_argument, NULL, 's' }, |
| 180 | #endif | 185 | #endif |
| @@ -599,6 +604,10 @@ decode_options (int argc, char **argv) | |||
| 599 | print_help_and_exit (); | 604 | print_help_and_exit (); |
| 600 | break; | 605 | break; |
| 601 | 606 | ||
| 607 | case 'F': | ||
| 608 | frame_parameters = optarg; | ||
| 609 | break; | ||
| 610 | |||
| 602 | default: | 611 | default: |
| 603 | message (TRUE, "Try `%s --help' for more information\n", progname); | 612 | message (TRUE, "Try `%s --help' for more information\n", progname); |
| 604 | exit (EXIT_FAILURE); | 613 | exit (EXIT_FAILURE); |
| @@ -1630,6 +1639,13 @@ main (int argc, char **argv) | |||
| 1630 | send_to_emacs (emacs_socket, " "); | 1639 | send_to_emacs (emacs_socket, " "); |
| 1631 | } | 1640 | } |
| 1632 | 1641 | ||
| 1642 | if (frame_parameters && !current_frame) | ||
| 1643 | { | ||
| 1644 | send_to_emacs (emacs_socket, "-frame-parameters "); | ||
| 1645 | quote_argument (emacs_socket, frame_parameters); | ||
| 1646 | send_to_emacs (emacs_socket, " "); | ||
| 1647 | } | ||
| 1648 | |||
| 1633 | /* If using the current frame, send tty information to Emacs anyway. | 1649 | /* If using the current frame, send tty information to Emacs anyway. |
| 1634 | In daemon mode, Emacs may need to occupy this tty if no other | 1650 | In daemon mode, Emacs may need to occupy this tty if no other |
| 1635 | frame is available. */ | 1651 | frame is available. */ |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4fec617954a..bccbe9340b1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-06-25 Andreas Rottmann <a.rottmann@gmx.at> | ||
| 2 | |||
| 3 | * server.el (server-create-window-system-frame): Add parameters arg. | ||
| 4 | (server-process-filter): Doc fix. Handle frame-parameters. | ||
| 5 | |||
| 1 | 2011-06-25 Juanma Barranquero <lekktu@gmail.com> | 6 | 2011-06-25 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 7 | ||
| 3 | Fix bug#8730, bug#8781. | 8 | Fix bug#8730, bug#8781. |
diff --git a/lisp/server.el b/lisp/server.el index 04d35695c57..42da7a210c5 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -736,7 +736,8 @@ Server mode runs a process that accepts commands from the | |||
| 736 | 736 | ||
| 737 | frame)) | 737 | frame)) |
| 738 | 738 | ||
| 739 | (defun server-create-window-system-frame (display nowait proc parent-id) | 739 | (defun server-create-window-system-frame (display nowait proc parent-id |
| 740 | &optional parameters) | ||
| 740 | (add-to-list 'frame-inherited-parameters 'client) | 741 | (add-to-list 'frame-inherited-parameters 'client) |
| 741 | (if (not (fboundp 'make-frame-on-display)) | 742 | (if (not (fboundp 'make-frame-on-display)) |
| 742 | (progn | 743 | (progn |
| @@ -751,7 +752,8 @@ Server mode runs a process that accepts commands from the | |||
| 751 | ;; killing emacs on that frame. | 752 | ;; killing emacs on that frame. |
| 752 | (let* ((params `((client . ,(if nowait 'nowait proc)) | 753 | (let* ((params `((client . ,(if nowait 'nowait proc)) |
| 753 | ;; This is a leftover, see above. | 754 | ;; This is a leftover, see above. |
| 754 | (environment . ,(process-get proc 'env)))) | 755 | (environment . ,(process-get proc 'env)) |
| 756 | ,@parameters)) | ||
| 755 | (display (or display | 757 | (display (or display |
| 756 | (frame-parameter nil 'display) | 758 | (frame-parameter nil 'display) |
| 757 | (getenv "DISPLAY") | 759 | (getenv "DISPLAY") |
| @@ -832,6 +834,9 @@ The following commands are accepted by the server: | |||
| 832 | `-current-frame' | 834 | `-current-frame' |
| 833 | Forbid the creation of new frames. | 835 | Forbid the creation of new frames. |
| 834 | 836 | ||
| 837 | `-frame-parameters ALIST' | ||
| 838 | Set the parameters of the created frame. | ||
| 839 | |||
| 835 | `-nowait' | 840 | `-nowait' |
| 836 | Request that the next frame created should not be | 841 | Request that the next frame created should not be |
| 837 | associated with this client. | 842 | associated with this client. |
| @@ -940,6 +945,7 @@ The following commands are accepted by the client: | |||
| 940 | commands | 945 | commands |
| 941 | dir | 946 | dir |
| 942 | use-current-frame | 947 | use-current-frame |
| 948 | frame-parameters ;parameters for newly created frame | ||
| 943 | tty-name ; nil, `window-system', or the tty name. | 949 | tty-name ; nil, `window-system', or the tty name. |
| 944 | tty-type ; string. | 950 | tty-type ; string. |
| 945 | files | 951 | files |
| @@ -960,6 +966,13 @@ The following commands are accepted by the client: | |||
| 960 | ;; -current-frame: Don't create frames. | 966 | ;; -current-frame: Don't create frames. |
| 961 | (`"-current-frame" (setq use-current-frame t)) | 967 | (`"-current-frame" (setq use-current-frame t)) |
| 962 | 968 | ||
| 969 | ;; -frame-parameters: Set frame parameters | ||
| 970 | (`"-frame-parameters" | ||
| 971 | (let ((alist (pop args-left))) | ||
| 972 | (if coding-system | ||
| 973 | (setq alist (decode-coding-string alist coding-system))) | ||
| 974 | (setq frame-parameters (car (read-from-string alist))))) | ||
| 975 | |||
| 963 | ;; -display DISPLAY: | 976 | ;; -display DISPLAY: |
| 964 | ;; Open X frames on the given display instead of the default. | 977 | ;; Open X frames on the given display instead of the default. |
| 965 | (`"-display" | 978 | (`"-display" |
| @@ -1075,7 +1088,8 @@ The following commands are accepted by the client: | |||
| 1075 | (if display (server-select-display display))) | 1088 | (if display (server-select-display display))) |
| 1076 | ((eq tty-name 'window-system) | 1089 | ((eq tty-name 'window-system) |
| 1077 | (server-create-window-system-frame display nowait proc | 1090 | (server-create-window-system-frame display nowait proc |
| 1078 | parent-id)) | 1091 | parent-id |
| 1092 | frame-parameters)) | ||
| 1079 | ;; When resuming on a tty, tty-name is nil. | 1093 | ;; When resuming on a tty, tty-name is nil. |
| 1080 | (tty-name | 1094 | (tty-name |
| 1081 | (server-create-tty-frame tty-name tty-type proc)))) | 1095 | (server-create-tty-frame tty-name tty-type proc)))) |