comparison src/term.c @ 82995:039bd6989d29

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
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 03 Jan 2004 08:31:14 +0000
parents 5de4189e659d
children 7900111db01c
comparison
equal deleted inserted replaced
82994:44ffe551079c 82995:039bd6989d29
97 #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0) 97 #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0)
98 98
99 /* Function to use to ring the bell. */ 99 /* Function to use to ring the bell. */
100 100
101 Lisp_Object Vring_bell_function; 101 Lisp_Object Vring_bell_function;
102
103 /* Functions to call after a tty was deleted. */
104 Lisp_Object Vdelete_tty_after_functions;
102 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;
106 109
2749 tty->top_frame = frame; 2752 tty->top_frame = frame;
2750 2753
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 }
2759 2760
2760 /* VARARGS 1 */ 2761 /* VARARGS 1 */
2770 } 2771 }
2771 2772
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 {
2779 struct tty_display_info *t; 2784 struct tty_display_info *t;
2780 char *name = 0; 2785 char *name = 0;
2800 2805
2801 void 2806 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. */
2809 return; 2815 return;
2810 2816
2836 } 2842 }
2837 } 2843 }
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
2846 if (tty->input) 2851 if (tty->input)
2847 { 2852 {
2871 #endif 2876 #endif
2872 2877
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
2879 2899
2880 2900
2909 DEFVAR_LISP ("ring-bell-function", &Vring_bell_function, 2929 DEFVAR_LISP ("ring-bell-function", &Vring_bell_function,
2910 doc: /* Non-nil means call this function to ring the bell. 2930 doc: /* Non-nil means call this function to ring the bell.
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
2917 Qframe_tty_type = intern ("frame-tty-type"); 2943 Qframe_tty_type = intern ("frame-tty-type");
2918 staticpro (&Qframe_tty_type); 2944 staticpro (&Qframe_tty_type);