diff options
| author | Karoly Lorentey | 2004-01-03 08:31:14 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-01-03 08:31:14 +0000 |
| commit | 4d553a13abdadb4bb469bc0b59c003d48066dce5 (patch) | |
| tree | 0b84a435d41801417190e60bf89ffa0305c8c4ac /src/term.c | |
| parent | b28c910d1f41815fa4744756852d5f2377d28636 (diff) | |
| download | emacs-4d553a13abdadb4bb469bc0b59c003d48066dce5.tar.gz emacs-4d553a13abdadb4bb469bc0b59c003d48066dce5.zip | |
Portability fixes (now it compiles & runs fine on Solaris).
lib-src/emacsclient.c: Removed tty proxy kludge. Emacs should just
use the same terminal as emacsclient.
(ec_get_tty, ec_set_tty, master, pty_name, old_tty, tty, old_tty_valid)
(tty_erase_char, quit_char, flow_control, meta_key, _sobuf, init_tty)
(window_change, reset_tty, init_pty, copy_from_to)
(pty_conversation): Removed.
(window_change_signal): Just forward the signal to Emacs, don't do
anything else.
(init_signals): Don't set handlers for SIGHUP & SIGINT.
(strprefix): New function.
(main): Don't touch the terminal, simply tell its name to Emacs.
lisp/server.el (server-frames): Changed name and semantics to server-ttys.
(server-tty-live-p): New function.
(server-sentinel): Delete the whole tty, not just the frame.
(server-handle-delete-frame): Removed.
(server-handle-delete-tty): New function. Close the client connection if
the tty is deleted.
(server-start): Clean up server-ttys, not server-frames. Set up
delete-tty-after-functions.
(server-process-filter): Set up server-ttys, not server-frames.
Updated protocol for sending our pid to emacsclient.
(server-buffer-done): Don't delete the client process directly, delete
the tty instead, and rely on the delete-tty hook to close the
connection. Otherwise the terminal could be left in a bad state.
src/cm.c (cmputc): Don't abort on write errors.
src/indent.c: #include <stdio.h>, for termchar.h.
src/window.c: Ditto.
src/xfaces.c: Ditto.
src/sysdep.c (init_sigio, reset_sigio, request_sigio)[!SIGIO]
(unrequest_sigio)[!SIGIO]: If SIGIO is not supported, don't do
anything. (For Solaris.)
(init_sys_modes): Moved tty_set_terminal_modes call back to here,
disable window system check.
(reset_sys_modes): Reset the terminal even if X is running.
src/term.c (Vdelete_tty_after_functions): New variable.
(syms_of_term): Initialize it.
(Fdelete_tty): Updated docs.
(delete_tty): Run delete-tty-after-functions.
(term_init): Removed tty_set_terminal_modes call.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-35
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/src/term.c b/src/term.c index 24dbc614c6f..96fa9baddac 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -100,6 +100,9 @@ static void delete_tty_1 P_ ((struct tty_display_info *)); | |||
| 100 | 100 | ||
| 101 | Lisp_Object Vring_bell_function; | 101 | Lisp_Object Vring_bell_function; |
| 102 | 102 | ||
| 103 | /* Functions to call after a tty was deleted. */ | ||
| 104 | Lisp_Object Vdelete_tty_after_functions; | ||
| 105 | |||
| 103 | /* Terminal characteristics that higher levels want to look at. */ | 106 | /* Terminal characteristics that higher levels want to look at. */ |
| 104 | 107 | ||
| 105 | struct tty_display_info *tty_list; | 108 | struct tty_display_info *tty_list; |
| @@ -2751,8 +2754,6 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2751 | /* Init system terminal modes (RAW or CBREAK, etc.). */ | 2754 | /* Init system terminal modes (RAW or CBREAK, etc.). */ |
| 2752 | init_sys_modes (tty); | 2755 | init_sys_modes (tty); |
| 2753 | 2756 | ||
| 2754 | tty_set_terminal_modes (tty); | ||
| 2755 | |||
| 2756 | return tty; | 2757 | return tty; |
| 2757 | #endif /* not WINDOWSNT */ | 2758 | #endif /* not WINDOWSNT */ |
| 2758 | } | 2759 | } |
| @@ -2772,7 +2773,11 @@ fatal (str, arg1, arg2) | |||
| 2772 | 2773 | ||
| 2773 | 2774 | ||
| 2774 | DEFUN ("delete-tty", Fdelete_tty, Sdelete_tty, 0, 1, 0, | 2775 | DEFUN ("delete-tty", Fdelete_tty, Sdelete_tty, 0, 1, 0, |
| 2775 | doc: /* Delete all frames on the terminal named TTY, and close the device. */) | 2776 | doc: /* Delete all frames on the terminal named TTY, and close the device. |
| 2777 | If omitted, TTY defaults to the controlling terminal. | ||
| 2778 | |||
| 2779 | This function runs `delete-tty-after-functions' after closing the | ||
| 2780 | tty. The functions are run with one arg, the frame to be deleted. */) | ||
| 2776 | (tty) | 2781 | (tty) |
| 2777 | Lisp_Object tty; | 2782 | Lisp_Object tty; |
| 2778 | { | 2783 | { |
| @@ -2802,7 +2807,8 @@ void | |||
| 2802 | delete_tty (struct tty_display_info *tty) | 2807 | delete_tty (struct tty_display_info *tty) |
| 2803 | { | 2808 | { |
| 2804 | Lisp_Object tail, frame; | 2809 | Lisp_Object tail, frame; |
| 2805 | 2810 | char *tty_name; | |
| 2811 | |||
| 2806 | if (deleting_tty) | 2812 | if (deleting_tty) |
| 2807 | /* We get a recursive call when we delete the last frame on this | 2813 | /* We get a recursive call when we delete the last frame on this |
| 2808 | tty. */ | 2814 | tty. */ |
| @@ -2838,8 +2844,7 @@ delete_tty (struct tty_display_info *tty) | |||
| 2838 | 2844 | ||
| 2839 | reset_sys_modes (tty); | 2845 | reset_sys_modes (tty); |
| 2840 | 2846 | ||
| 2841 | if (tty->name) | 2847 | tty_name = tty->name; |
| 2842 | xfree (tty->name); | ||
| 2843 | if (tty->type) | 2848 | if (tty->type) |
| 2844 | xfree (tty->type); | 2849 | xfree (tty->type); |
| 2845 | 2850 | ||
| @@ -2873,6 +2878,21 @@ delete_tty (struct tty_display_info *tty) | |||
| 2873 | bzero (tty, sizeof (struct tty_display_info)); | 2878 | bzero (tty, sizeof (struct tty_display_info)); |
| 2874 | xfree (tty); | 2879 | xfree (tty); |
| 2875 | deleting_tty = 0; | 2880 | deleting_tty = 0; |
| 2881 | |||
| 2882 | /* Run `delete-tty-after-functions'. */ | ||
| 2883 | if (!NILP (Vrun_hooks)) | ||
| 2884 | { | ||
| 2885 | Lisp_Object args[2]; | ||
| 2886 | args[0] = intern ("delete-tty-after-functions"); | ||
| 2887 | if (tty_name) | ||
| 2888 | { | ||
| 2889 | args[1] = build_string (tty_name); | ||
| 2890 | xfree (tty_name); | ||
| 2891 | } | ||
| 2892 | else | ||
| 2893 | args[1] = Qnil; | ||
| 2894 | Frun_hook_with_args (2, args); | ||
| 2895 | } | ||
| 2876 | } | 2896 | } |
| 2877 | 2897 | ||
| 2878 | 2898 | ||
| @@ -2911,6 +2931,12 @@ This variable can be used by terminal emulator packages. */); | |||
| 2911 | The function should accept no arguments. */); | 2931 | The function should accept no arguments. */); |
| 2912 | Vring_bell_function = Qnil; | 2932 | Vring_bell_function = Qnil; |
| 2913 | 2933 | ||
| 2934 | DEFVAR_LISP ("delete-tty-after-functions", &Vdelete_tty_after_functions, | ||
| 2935 | doc: /* Functions to be run after deleting a tty. | ||
| 2936 | The functions are run with one argument, the name of the tty to be deleted. | ||
| 2937 | See `delete-tty'. */); | ||
| 2938 | Vdelete_tty_after_functions = Qnil; | ||
| 2939 | |||
| 2914 | Qframe_tty_name = intern ("frame-tty-name"); | 2940 | Qframe_tty_name = intern ("frame-tty-name"); |
| 2915 | staticpro (&Qframe_tty_name); | 2941 | staticpro (&Qframe_tty_name); |
| 2916 | 2942 | ||