comparison src/term.c @ 83512:5d328dadd0f4

Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.) * lisp/vc.el (vc-annotate-color-map): Undo previous change. * src/dispnew.c (Fsend_string_to_terminal): Update call to `get_tty_terminal'. * src/term.c (Fsuspend_tty, Fresume_tty): Update call to `get_tty_terminal'. (get_tty_terminal): Add throw parameter. (Ftty_display_color_p, Ftty_display_color_cells): Don't throw errors on X frames. * src/dispextern.h (get_tty_terminal): Update prototype. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-552
author Karoly Lorentey <lorentey@elte.hu>
date Thu, 20 Apr 2006 16:09:11 +0000
parents c1e013e3dc0e
children 40a5d8a15056
comparison
equal deleted inserted replaced
83511:f714f11da40a 83512:5d328dadd0f4
1840 frame's terminal). This function always returns nil if TERMINAL 1840 frame's terminal). This function always returns nil if TERMINAL
1841 is not on a tty device. */) 1841 is not on a tty device. */)
1842 (terminal) 1842 (terminal)
1843 Lisp_Object terminal; 1843 Lisp_Object terminal;
1844 { 1844 {
1845 struct terminal *t = get_tty_terminal (terminal); 1845 struct terminal *t = get_tty_terminal (terminal, 0);
1846 if (!t) 1846 if (!t)
1847 return Qnil; 1847 return Qnil;
1848 else 1848 else
1849 return t->display_info.tty->TN_max_colors > 0 ? Qt : Qnil; 1849 return t->display_info.tty->TN_max_colors > 0 ? Qt : Qnil;
1850 } 1850 }
1853 DEFUN ("tty-display-color-cells", Ftty_display_color_cells, 1853 DEFUN ("tty-display-color-cells", Ftty_display_color_cells,
1854 Stty_display_color_cells, 0, 1, 0, 1854 Stty_display_color_cells, 0, 1, 0,
1855 doc: /* Return the number of colors supported by the tty device TERMINAL. 1855 doc: /* Return the number of colors supported by the tty device TERMINAL.
1856 1856
1857 TERMINAL can be a terminal id, a frame or nil (meaning the selected 1857 TERMINAL can be a terminal id, a frame or nil (meaning the selected
1858 frame's terminal). This function always returns nil if TERMINAL 1858 frame's terminal). This function always returns 0 if TERMINAL
1859 is not on a tty device. */) 1859 is not on a tty device. */)
1860 (terminal) 1860 (terminal)
1861 Lisp_Object terminal; 1861 Lisp_Object terminal;
1862 { 1862 {
1863 struct terminal *t = get_tty_terminal (terminal); 1863 struct terminal *t = get_tty_terminal (terminal, 0);
1864 if (!t) 1864 if (!t)
1865 return make_number (0); 1865 return make_number (0);
1866 else 1866 else
1867 return make_number (t->display_info.tty->TN_max_colors); 1867 return make_number (t->display_info.tty->TN_max_colors);
1868 } 1868 }
2007 2007
2008 2008
2009 /* Return the tty display object specified by TERMINAL. */ 2009 /* Return the tty display object specified by TERMINAL. */
2010 2010
2011 struct terminal * 2011 struct terminal *
2012 get_tty_terminal (Lisp_Object terminal) 2012 get_tty_terminal (Lisp_Object terminal, int throw)
2013 { 2013 {
2014 struct terminal *t = get_terminal (terminal, 0); 2014 struct terminal *t = get_terminal (terminal, throw);
2015 2015
2016 if (t && t->type == output_initial) 2016 if (t && t->type == output_initial)
2017 t = NULL; 2017 return NULL;
2018 2018
2019 if (t && t->type != output_termcap) 2019 if (t && t->type != output_termcap)
2020 error ("Device %d is not a termcap terminal device", t->id); 2020 {
2021 if (throw)
2022 error ("Device %d is not a termcap terminal device", t->id);
2023 else
2024 return NULL;
2025 }
2021 2026
2022 return t; 2027 return t;
2023 } 2028 }
2024 2029
2025 /* Return the active termcap device that uses the tty device with the 2030 /* Return the active termcap device that uses the tty device with the
2126 2131
2127 A suspended tty may be resumed by calling `resume-tty' on it. */) 2132 A suspended tty may be resumed by calling `resume-tty' on it. */)
2128 (tty) 2133 (tty)
2129 Lisp_Object tty; 2134 Lisp_Object tty;
2130 { 2135 {
2131 struct terminal *t = get_tty_terminal (tty); 2136 struct terminal *t = get_tty_terminal (tty, 1);
2132 FILE *f; 2137 FILE *f;
2133 2138
2134 if (!t) 2139 if (!t)
2135 error ("Unknown tty device"); 2140 error ("Unknown tty device");
2136 2141
2183 TTY may be a terminal id, a frame, or nil for the terminal device of 2188 TTY may be a terminal id, a frame, or nil for the terminal device of
2184 the currently selected frame. */) 2189 the currently selected frame. */)
2185 (tty) 2190 (tty)
2186 Lisp_Object tty; 2191 Lisp_Object tty;
2187 { 2192 {
2188 struct terminal *t = get_tty_terminal (tty); 2193 struct terminal *t = get_tty_terminal (tty, 1);
2189 int fd; 2194 int fd;
2190 2195
2191 if (!t) 2196 if (!t)
2192 error ("Unknown tty device"); 2197 error ("Unknown tty device");
2193 2198