diff options
| author | Chong Yidong | 2010-05-29 19:50:47 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-05-29 19:50:47 -0400 |
| commit | 0191e222e375db31e08ef55f4eddc9e01e8d1f80 (patch) | |
| tree | 4d968cbb6a7df0b288311f3275253b45194541ff | |
| parent | b233600fbd201794a34bee1f3a819adb63eda7ec (diff) | |
| download | emacs-0191e222e375db31e08ef55f4eddc9e01e8d1f80.tar.gz emacs-0191e222e375db31e08ef55f4eddc9e01e8d1f80.zip | |
Add --parent-id argument to emacsclient.
* lib-src/emacsclient.c (longopts, decode_options, print_help_and_exit):
New arg `-parent-id'.
(main): Send parent-id to Emacs.
* lisp/server.el (server-process-filter): Receive parent-id argument
from emacsclient.
(server-create-window-system-frame): New arg. Pass parent-id as
frame parameter.
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lib-src/ChangeLog | 6 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 19 | ||||
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/server.el | 38 |
5 files changed, 59 insertions, 15 deletions
| @@ -43,6 +43,10 @@ You can disable this by using --without-selinux. | |||
| 43 | 43 | ||
| 44 | * Changes in Emacs 24.1 | 44 | * Changes in Emacs 24.1 |
| 45 | 45 | ||
| 46 | ** New emacsclient argument --parent-id ID can be used to open a | ||
| 47 | client frame in parent X window ID, via XEmbed. This works like the | ||
| 48 | --parent-id argument to Emacs. | ||
| 49 | |||
| 46 | ** Completion can cycle, depending on completion-cycle-threshold. | 50 | ** Completion can cycle, depending on completion-cycle-threshold. |
| 47 | 51 | ||
| 48 | ** auto-mode-case-fold is now enabled by default. | 52 | ** auto-mode-case-fold is now enabled by default. |
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index ac1641a552e..d23fe3ff6c2 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-05-29 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * emacsclient.c (longopts, decode_options, print_help_and_exit): | ||
| 4 | New arg `-parent-id'. | ||
| 5 | (main): Send parent-id to Emacs. | ||
| 6 | |||
| 1 | 2010-05-27 Glenn Morris <rgm@gnu.org> | 7 | 2010-05-27 Glenn Morris <rgm@gnu.org> |
| 2 | 8 | ||
| 3 | * Makefile.in (distclean): No more Makefile.c. | 9 | * Makefile.in (distclean): No more Makefile.c. |
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 1e7ec7d9678..3172ebb8cd1 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -138,6 +138,9 @@ int current_frame = 1; | |||
| 138 | /* The display on which Emacs should work. --display. */ | 138 | /* The display on which Emacs should work. --display. */ |
| 139 | char *display = NULL; | 139 | char *display = NULL; |
| 140 | 140 | ||
| 141 | /* The parent window ID, if we are opening a frame via XEmbed. */ | ||
| 142 | char *parent_id = NULL; | ||
| 143 | |||
| 141 | /* Nonzero means open a new Emacs frame on the current terminal. */ | 144 | /* Nonzero means open a new Emacs frame on the current terminal. */ |
| 142 | int tty = 0; | 145 | int tty = 0; |
| 143 | 146 | ||
| @@ -173,6 +176,7 @@ struct option longopts[] = | |||
| 173 | #ifndef WINDOWSNT | 176 | #ifndef WINDOWSNT |
| 174 | { "display", required_argument, NULL, 'd' }, | 177 | { "display", required_argument, NULL, 'd' }, |
| 175 | #endif | 178 | #endif |
| 179 | { "parent-id", required_argument, NULL, 'p' }, | ||
| 176 | { 0, 0, 0, 0 } | 180 | { 0, 0, 0, 0 } |
| 177 | }; | 181 | }; |
| 178 | 182 | ||
| @@ -583,6 +587,11 @@ decode_options (argc, argv) | |||
| 583 | current_frame = 0; | 587 | current_frame = 0; |
| 584 | break; | 588 | break; |
| 585 | 589 | ||
| 590 | case 'p': | ||
| 591 | parent_id = optarg; | ||
| 592 | current_frame = 0; | ||
| 593 | break; | ||
| 594 | |||
| 586 | case 'H': | 595 | case 'H': |
| 587 | print_help_and_exit (); | 596 | print_help_and_exit (); |
| 588 | break; | 597 | break; |
| @@ -656,7 +665,8 @@ The following OPTIONS are accepted:\n\ | |||
| 656 | -e, --eval Evaluate the FILE arguments as ELisp expressions\n\ | 665 | -e, --eval Evaluate the FILE arguments as ELisp expressions\n\ |
| 657 | -n, --no-wait Don't wait for the server to return\n\ | 666 | -n, --no-wait Don't wait for the server to return\n\ |
| 658 | -d DISPLAY, --display=DISPLAY\n\ | 667 | -d DISPLAY, --display=DISPLAY\n\ |
| 659 | Visit the file in the given display\n" | 668 | Visit the file in the given display\n\ |
| 669 | --parent-id=ID Open in parent window ID, via XEmbed\n" | ||
| 660 | #ifndef NO_SOCKETS_IN_FILE_SYSTEM | 670 | #ifndef NO_SOCKETS_IN_FILE_SYSTEM |
| 661 | "-s SOCKET, --socket-name=SOCKET\n\ | 671 | "-s SOCKET, --socket-name=SOCKET\n\ |
| 662 | Set filename of the UNIX socket for communication\n" | 672 | Set filename of the UNIX socket for communication\n" |
| @@ -1620,6 +1630,13 @@ main (argc, argv) | |||
| 1620 | send_to_emacs (emacs_socket, " "); | 1630 | send_to_emacs (emacs_socket, " "); |
| 1621 | } | 1631 | } |
| 1622 | 1632 | ||
| 1633 | if (parent_id) | ||
| 1634 | { | ||
| 1635 | send_to_emacs (emacs_socket, "-parent-id "); | ||
| 1636 | quote_argument (emacs_socket, parent_id); | ||
| 1637 | send_to_emacs (emacs_socket, " "); | ||
| 1638 | } | ||
| 1639 | |||
| 1623 | /* If using the current frame, send tty information to Emacs anyway. | 1640 | /* If using the current frame, send tty information to Emacs anyway. |
| 1624 | In daemon mode, Emacs may need to occupy this tty if no other | 1641 | In daemon mode, Emacs may need to occupy this tty if no other |
| 1625 | frame is available. */ | 1642 | frame is available. */ |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ee97e4f6af1..edde627ac20 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2010-05-29 Chong Yidong <cyd@stupidchicken.com> | 1 | 2010-05-29 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 2 | ||
| 3 | * server.el (server-process-filter): Receive parent-id argument | ||
| 4 | from emacsclient. | ||
| 5 | (server-create-window-system-frame): New arg. Pass parent-id as | ||
| 6 | frame parameter. | ||
| 7 | |||
| 8 | 2010-05-29 Chong Yidong <cyd@stupidchicken.com> | ||
| 9 | |||
| 3 | * ansi-color.el: Delete unused escape sequences (Bug#6085). | 10 | * ansi-color.el: Delete unused escape sequences (Bug#6085). |
| 4 | (ansi-color-drop-regexp): New constant. | 11 | (ansi-color-drop-regexp): New constant. |
| 5 | (ansi-color-apply, ansi-color-filter-region) | 12 | (ansi-color-apply, ansi-color-filter-region) |
diff --git a/lisp/server.el b/lisp/server.el index fd2026c4ab8..1ac2fb5b361 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -711,7 +711,7 @@ Server mode runs a process that accepts commands from the | |||
| 711 | (number-to-string (emacs-pid)) "\n")) | 711 | (number-to-string (emacs-pid)) "\n")) |
| 712 | frame)) | 712 | frame)) |
| 713 | 713 | ||
| 714 | (defun server-create-window-system-frame (display nowait proc) | 714 | (defun server-create-window-system-frame (display nowait proc parent-id) |
| 715 | (add-to-list 'frame-inherited-parameters 'client) | 715 | (add-to-list 'frame-inherited-parameters 'client) |
| 716 | (if (not (fboundp 'make-frame-on-display)) | 716 | (if (not (fboundp 'make-frame-on-display)) |
| 717 | (progn | 717 | (progn |
| @@ -727,12 +727,14 @@ Server mode runs a process that accepts commands from the | |||
| 727 | (let* ((params `((client . ,(if nowait 'nowait proc)) | 727 | (let* ((params `((client . ,(if nowait 'nowait proc)) |
| 728 | ;; This is a leftover, see above. | 728 | ;; This is a leftover, see above. |
| 729 | (environment . ,(process-get proc 'env)))) | 729 | (environment . ,(process-get proc 'env)))) |
| 730 | (frame (make-frame-on-display | 730 | (display (or display |
| 731 | (or display | 731 | (frame-parameter nil 'display) |
| 732 | (frame-parameter nil 'display) | 732 | (getenv "DISPLAY") |
| 733 | (getenv "DISPLAY") | 733 | (error "Please specify display"))) |
| 734 | (error "Please specify display")) | 734 | frame) |
| 735 | params))) | 735 | (if parent-id |
| 736 | (push (cons 'parent-id (string-to-number parent-id)) params)) | ||
| 737 | (setq frame (make-frame-on-display display params)) | ||
| 736 | (server-log (format "%s created" frame) proc) | 738 | (server-log (format "%s created" frame) proc) |
| 737 | (select-frame frame) | 739 | (select-frame frame) |
| 738 | (process-put proc 'frame frame) | 740 | (process-put proc 'frame frame) |
| @@ -900,15 +902,16 @@ The following commands are accepted by the client: | |||
| 900 | (coding-system (and (default-value 'enable-multibyte-characters) | 902 | (coding-system (and (default-value 'enable-multibyte-characters) |
| 901 | (or file-name-coding-system | 903 | (or file-name-coding-system |
| 902 | default-file-name-coding-system))) | 904 | default-file-name-coding-system))) |
| 903 | nowait ; t if emacsclient does not want to wait for us. | 905 | nowait ; t if emacsclient does not want to wait for us. |
| 904 | frame ; The frame that was opened for the client (if any). | 906 | frame ; Frame opened for the client (if any). |
| 905 | display ; Open the frame on this display. | 907 | display ; Open frame on this display. |
| 906 | dontkill ; t if the client should not be killed. | 908 | parent-id ; Window ID for XEmbed |
| 909 | dontkill ; t if client should not be killed. | ||
| 907 | commands | 910 | commands |
| 908 | dir | 911 | dir |
| 909 | use-current-frame | 912 | use-current-frame |
| 910 | tty-name ;nil, `window-system', or the tty name. | 913 | tty-name ; nil, `window-system', or the tty name. |
| 911 | tty-type ;string. | 914 | tty-type ; string. |
| 912 | files | 915 | files |
| 913 | filepos | 916 | filepos |
| 914 | command-line-args-left | 917 | command-line-args-left |
| @@ -935,6 +938,12 @@ The following commands are accepted by the client: | |||
| 935 | (setq display (pop command-line-args-left)) | 938 | (setq display (pop command-line-args-left)) |
| 936 | (if (zerop (length display)) (setq display nil))) | 939 | (if (zerop (length display)) (setq display nil))) |
| 937 | 940 | ||
| 941 | ;; -parent-id ID: | ||
| 942 | ;; Open X frame within window ID, via XEmbed. | ||
| 943 | ((and (equal "-parent-id" arg) command-line-args-left) | ||
| 944 | (setq parent-id (pop command-line-args-left)) | ||
| 945 | (if (zerop (length parent-id)) (setq parent-id nil))) | ||
| 946 | |||
| 938 | ;; -window-system: Open a new X frame. | 947 | ;; -window-system: Open a new X frame. |
| 939 | ((equal "-window-system" arg) | 948 | ((equal "-window-system" arg) |
| 940 | (setq dontkill t) | 949 | (setq dontkill t) |
| @@ -1039,7 +1048,8 @@ The following commands are accepted by the client: | |||
| 1039 | (setq tty-name nil tty-type nil) | 1048 | (setq tty-name nil tty-type nil) |
| 1040 | (if display (server-select-display display))) | 1049 | (if display (server-select-display display))) |
| 1041 | ((eq tty-name 'window-system) | 1050 | ((eq tty-name 'window-system) |
| 1042 | (server-create-window-system-frame display nowait proc)) | 1051 | (server-create-window-system-frame display nowait proc |
| 1052 | parent-id)) | ||
| 1043 | ;; When resuming on a tty, tty-name is nil. | 1053 | ;; When resuming on a tty, tty-name is nil. |
| 1044 | (tty-name | 1054 | (tty-name |
| 1045 | (server-create-tty-frame tty-name tty-type proc)))) | 1055 | (server-create-tty-frame tty-name tty-type proc)))) |